Can anyone share the expiriance deploying NestJs app on Glitch?

I was just wondering would it be within guidelines to deploy the NestJs app on Glitch, and did anyone do this before?

Thank you !

Never tried it myself, though I’ve used NestJS before, a long time ago. You should definitely be able to use it. Node is not too fast on here, though Fastify is probably a bit quicker than Express.

I would personally go with Heroku as a free option if you can. You always get what you (don’t) pay for, but unless your app here is boosted, Heroku will probably be more consistent.

There exists several code starters for using NextJS with Glitch (haven’t tested):

In light of giving your question more thought rather than considering how it personally affects me, I do not think Heroku is a better “value.” I said that it’s more consistent. It is. They’re also backed by Salesforce (for better or worse, haha).

There have actually been times (and yes, it does depend on the app) where Glitch loaded my data a bit faster than Heroku, but this has varied. On Glitch, I’ve also more frequently run into CORS issues, and faced the problem of waiting for the Node app itself to fire up via the Glitch loading screen. This can look a bit unprofessional when a project is in someone’s portfolio. That’s why I said, “unless your app here is boosted,” etc. Those problems lead to more of the same annoying questions in this forum and Support potentially being overwhelmed by bigger things they can’t fix right away.

And like I said before, I try not to overwhelm people with a lot of information. I have written longer posts and it seems people are less likely to read them, and probably feel bogged down. That said, if someone has more questions, they can reply to me.

When you (and others) post things like “Node is not too fast on here” and “Fastify is probably quicker than Express” would you please back up those claims with some evidence that led you to these conclusions?

Hey, good question about this.

Heroku uses a “buildpack” system that compiles an app into a “slug,” which is like a big file archive with everything the app needs in order to start on demand. For Node.js apps, this involves getting the right version of node and downloading and building the dependencies. You can imagine how much time it would save to have this, as compared to Glitch, where the system installs dependencies each time it needs to start your project in a new container—devDependencies included :scream:.

A few things I’ll call out that result from this:

  • The project filesystem on Heroku is ephemeral. It’ll start out with a fresh state created from the slug every time. You shouldn’t store things in the filesystem that are meant to be seen from a later request. (This also leads to a sensible way for Heroku to scale apps to multiple app instances.) If you want persistent or shared state, you use a database.
  • Glitch can theoretically install newer patched versions of dependencies without you having to publish a new version. Or the same could make your project break when a library releases incompatible changes. Not sure if this actually happens, due to there being a package-lock.json or shrinkwrap.yaml. But we do hear about people’s projects breaking when they haven’t changed anything themselves.
  • As prominently mentioned, having all the dependencies stored as part of the project saves startup time.

Glitch has a custom pnpm setup that’s supposedly faster than plain npm, by delivering the dependencies from the same datacenter and caching compiled native libraries. However, that’s only supported up to Node.js 12, and I see lots of people needing to use newer versions of Node due to the libraries they use needing a more recent version, and I see lots of weird issues where the advice from the forum has been “run enable-npm.” And even with the custom pnpm, it’s still a nonzero amount of time to set up the dependencies.

To me, the persistent filesystem is Glitch’s killer feature. I’ll leave it to the Heroku proponents come in with the numbers on how much faster the buildpack+slug system is. I won’t dispute it.


Thanks for clarifying that in a way I couldn’t have. :slightly_smiling_face:

1 Like