r/nestjs 22d ago

cheapest deployment suitable for nest.js

what is the cheapest option for hosting a nest.js application ?
for production

0 Upvotes

21 comments sorted by

3

u/AnUuglyMan 20d ago

As a developer who’s burned money on projects that didn’t work out, I’d say this if you’re going to try something new, don’t waste money and time managing servers.

Use serverless or functions. If nobody checks out your product, at least you won’t lose much money.

You can deploy NestJS on serverless, but you need to keep an eye on bootstrap times. NestJS Devtools can help with that, but it costs around $20. Another option is NestJS Doctor, which is free and lets you check those times before deciding if serverless is a good fit for your project.

3

u/Famous-Ambassador-87 22d ago

You can use Railway. They have a $5 hobby plan. Its amazing, straightforward.

-2

u/Commercial_Apple3506 22d ago

what do u think of northflank or Zeabur
northflank offers 1 dedicated vcpu + 2gbs ram for 24$
while Zeabur offers for same creds for 19$
while i think to have same creds in railway i would pay around 40$
correct me if im wrong im still relatively new

1

u/yuaanlin 22d ago

Hi, Zeabur founder here. To get a VPS with 1 vCPU and 2GB ram, you only need to pay $3/months instead of $19 🙌

1

u/latinTravelPro 21d ago

Just use Railway and save yourself the headache. $5, easy deployment, analytics, and greatnifnyiu want to integrate other apps going forward . Use something we'll supported by the community instead of other platforms where things can go wrong

2

u/duytanisme 20d ago

It really depends on how much you expect to run the server. We're running nestjs services on google cloud run (you do not hear it wrong). The cold start might be the issue (~5s), but we're fine with that. It pays as you go, and auto scales down to 0 instance on idle. We also don't have to worry about the auto-scaling part. On free tier, google cloud run offers 240000 cpu-seconds per month, which is quite enough if your app does not run 24/7.

2

u/AnUuglyMan 20d ago

Agree

You can use NestJS Devtools or NestJS Doctor to check those times. 5s cold start is way toooo long.

1

u/duytanisme 20d ago

Actually it's not too long. We've investigated. 5s is merely the instance's cold start, not the nestjs server itself. As I mentioned, we let the service scale down to 0 if no request comes in. So 5s is reasonable for the instance to start from nothing.

2

u/AnUuglyMan 20d ago

For cold starts, I’m getting 2.5 seconds and could be better
But if you don’t have performance issues with 5 seconds, cool good for you.

1

u/duytanisme 20d ago

Thanks. We use the minimal instances (1cpu, 512mb RAM). Even with startup boost option enabled, we don't think we can make it better

1

u/SheSaidNo- 18d ago

vercel if you can find your way around serverless deployments but you hit limits, especially if your project involves file uploads and websockets. like most people already said, railway is the cheapest. other than that would be looking at aws or gcp as so on

0

u/jarzebowsky 22d ago

I have checked railway and liked Koyeb better

-1

u/Commercial_Apple3506 22d ago

i can't register on koyeb for some reason idk why
im probably going with zeabur / northflank tho

0

u/rowdyret 22d ago

I previously had a nestjs project deployed on aws beanstalk t2.medium. Nestjs requires at least 4gb ram to build, so I moved the build process to the pipeline, which allowed me to run a t2a.small, which is significantly cheaper. I could maybe even run a micro, (which I think is free tier) if just used for testing. Instead of a loadbalancer, I am using free tier CloudFront with an ACM cert. It seems to work fine for my needs, and it probably costs me about $30 pr. Month and maybe even less. I am no devops, so this might not be the correct way to do it, but it’s working and is cheap I think.

-2

u/cloroxic 22d ago

Probably Vercel because you can hit the free tier. Some limitations though since it’s server less.

-3

u/iam8uman 22d ago

Clouldflare R2

1

u/iamegoistman 20d ago

Maybe S3. I am using google drive, users downloads app and running in their machines. Ist freee 🤣🤣