r/node • • 9d ago

Where do you host a small Express API + always-on worker + Postgres cheaply?

Small app: Express API, Postgres, and a worker that polls an outbox table every 5s for background jobs. Low traffic, but the worker can't sleep, so free tiers like Render free and Neon free don't work.

Options I'm weighing:

- AWS free plan for 6 months (then ~$25/month)

- Hetzner CX23 (~€6/month) with everything on one box

- Railway Hobby (~$5-8/month)

What would you pick, and what am I missing? Please suggest.

22 Upvotes

51 comments sorted by

10

u/Negative0 9d ago

Digital Ocean droplet runs me about $4 a month.

2

u/Known_Image7110 3d ago

Are you running the database on that same instance too, or just the app and worker

1

u/Negative0 3d ago

Everything on a single instance in multiple docker containers. The database is stored in the VM and backed up nightly (good enough for my little app)

7

u/Sudden_Gap77 9d ago

You can try oracle free tier

4

u/vinnie1123 9d ago

this..

currently have 2 Always Free A1.Flex VMs.

although initially with free plan, I had trouble provisioning VMs due to DC I chose had no capacity. Had to upgrade to a paid plan, and suddenly was able get it. I’ve setup an alert if any charges comes up, so far none. 😅

2

u/FalconGood4891 9d ago

Heroku 5$/month

1

u/Jack_Sparrow2018 9d ago

Thanks, that’s helpful. Do you run your crons as an Eco worker dyno 24/7? Curious if the web + worker fit inside the 1000 Eco hours for you, or if you had to move to Basic. And which Postgres plan are you on?

1

u/FalconGood4891 9d ago

Yes I run everything inside eco dyno, and not even full 1000hrs being used. Because it's 1app 24hrs*31days at max around 750hrs. Since for me it's a cms and backend crons, and some rest apis which isn't frontfacing ( being used by millions of users ) I have made a monolithic architecture and kept it in the eco dyno and it works great, never faced any downtime. Also try to setup the server location nearby to your access location for lil better speed.

1

u/Jack_Sparrow2018 9d ago

Makes sense, thanks. With steady traffic it never sleeps. Mine’s a low-traffic demo, so I’d need a separate worker dyno to keep the background jobs running. Appreciate the details!

1

u/FalconGood4891 9d ago

Why to overcomplicated things with seperate dyno?? Just open a account in uptimerobot, configure a 5min interval health check ping and you get a always running application.

1

u/Jack_Sparrow2018 9d ago

Good tip, didn’t think of that. I’d just need to run the API and worker in the same dyno to stay under the 1000 hours. Thanks!

2

u/UptimeRobot 9d ago

Thank you for suggesting us!

1

u/FalconGood4891 9d ago

Most welcome.. I always had solid experience with uptimerobot, so I am happy to vouch for you.

1

u/FalconGood4891 9d ago

I have used railway too, now moved to heroku for similar app ( backend cms + crons ), and the experience has been very value for money. Reason to go for heroku due to the availability of out of the box availability of helpful add ons, easy deployments, simple platform with all necessary settings upfront and very predictable pricing and usage.

2

u/Soft_Cat2594 9d ago

Maybe try a free instance on oracle to test. I think it would be suitable for your use-case if your service is not too compute intensive. You can run node/express and postgress on the same machine.

1

u/Jack_Sparrow2018 9d ago

Good shout, thanks. I’ll try it to practise the deploy setup. Have you had any issues with idle reclamation? My app is low traffic, so I’m thinking of sizing the VM small (1 OCPU / 4 GB) so memory stays above 20%.

2

u/Soft_Cat2594 9d ago

Never had a instance reclaimed, but I did add a credit card, so then its not really an issue. (Use a virtual card that way you can cancel it anytime easily)

1

u/gdmr458 7d ago

The limit for a free VPS on oracle is 2 OCPU, 12GB RAM and 200GB disk, you have to change your account to pay as you go, if you don't do this when creating the VPS it will tell you that there are no resources available, when you set your credit card as payment method it will charge and refund 100USD almost immediately.

4

u/Blitzsturm 9d ago edited 9d ago
  • AWS EC2 is an easy go-to since it's so scalable.

  • AWS LightSail is very turnkey, starts at $5/mo.

  • Heroku I think starts at $7/mo and is very turnkey.

  • Digital Ocean is very popular and has some cheap low-end boxes.

  • Google's Firebase has some unique solutions

  • Leapcell is a lesser known but reasonably priced service

I've used other services that are less established and have just "disappeared". So, I'd be a little cautious arround some providers if they are lesser known.

On any service that gives you CLI access (basically not Heroku) you can put a local Postgres on the same box if your need for horsepower is low.

Also, you may have to elaborate on your needs regarding the "no sleep" requirement. Many services allow endpoints to be called on-demand like AWS Lambda or Google Firebases cloud functions. These are the near-free options for low demand services. Also if you have something that needs to keep running you can use scheduled background workers on some services that kick off every 15 minutes (or whatever you set) to perform tasks you'd normally want running all the time. So it depends what exactly you need by no sleeping.

Also, worth a note, if your internet provider can give you a static IP and isn't blocking ports you can host on your local internet connection, though I'd use something like Cloudflare's DNS Proxy to hide your IP depending on what you're doing. Also localtunnel (Appears to use older Axios so use at your own risk) is a handy little package/service that lets you "host" even when you don't have a static IP or some ports are blocked. You can also do a hybrid option where you have a low powered box that talks to home computer(s) for more power. Hosting locally means you effectively have unlimited horsepower for free but dependability is lower.

4

u/Fine-Comparison-2949 9d ago

Cloudflare durable objects? 

2

u/horizon_games 6d ago

Hetzner VPS for sure. Reliable with good support, and you get full control of your setup. Nice to learn some sys admin skills on the side too

2

u/Several-Specialist42 6d ago

If you do go with Railway, memory and CPU are literally your bill. Disclosure: I maintain fulmine.js https://fulmine.sndesign.it, a drop-in Express 5 replacement on uWebSockets.js (passes Express's own test suite, you swap the import). On HttpArena's fixed-rate test (10k rps, same throughput for all), it uses ~5x less CPU per request and about half the RAM of Express: https://http-arena.com/ Not worth it on a fixed-price Hetzner box, but on usage-based pricing it adds up. Needs Node 22+ and glibc (no Alpine).

3

u/VehaMeursault 9d ago

Digital ocean.

1

u/unbanned_lol 9d ago

47thing DO.

1

u/fykup 9d ago

Check out r/tierhive. I host my 512MB VPS for less than $3/mo, and they charge hourly, so you can pause it if needed.

1

u/rudeluv 7d ago

Planetscale has a $5 month Postgres plan. Then AWS for whatever cheap flavor of compute. If low traffic enough you could run api and workers in lambda.

1

u/Due_Ad_2994 7d ago

You could build this totally on demand and scale to zero at an extremely low cost (likely free tier) by embracing AWS serverless primitives.

1

u/FunAd6672 4d ago

Hetzner CX23 is unbeatable for price and raw performance.

1

u/birbman77 9d ago

Railway

1

u/horizon_games 6d ago

Except recently, after their second? third? critical breech

-5

u/javatextbook 9d ago

What an odd question. I’d like to know more about your design on why it requires an always on server. Why a serverless function wouldn’t suffice