Tech stack for an API, bot or background worker
Bots and workers have to keep running around the clock, and many free app hosts put idle apps to sleep. A small server or an always-on container, a lightweight framework and a heartbeat check cover most of them.
Cost About $4 to $6 a month for a small server, or $0 if the job fits in Cloudflare’s free tier.
- 1
A framework
Handles HTTP routes, request validation and middleware, so your code is only the logic.
HonoFree, open source
Small TypeScript framework that runs the same code on Node, Bun, Deno, Cloudflare Workers and Lambda.
- 2
A machine that stays on
A small virtual server (VPS) never sleeps and runs anything you can run on your own computer. You keep it updated and backed up yourself.
DigitalOcean DropletsFrom $4/mo
From $4 a month, with tutorials that walk you through setting up the server.
At $0
No free option
No free server is worth the trouble. Free tiers exist (Oracle’s is the best known), but they need a card, are often sold out and can take back a server that sits idle.
- 3
Or a host that runs it for you
OptionalIf you would rather not run Linux, a container host runs the same code from GitHub and restarts it when it crashes.
RailwayFree tier, then from $5/mo
Pauses No backups
Runs long-lived bots and workers from GitHub for a few dollars a month of usage, with a database next to them.
At $0
Cloudflare Workers (incl. Pages)Free tier, then from $5/mo
Stops at the limit
Good for HTTP APIs, webhooks and scheduled jobs: 100,000 requests a day free. Not for bots that hold a connection open all day.
- 4
A database
OptionalOnly if the job has to remember things between runs. A SQLite file on the server is enough for many bots.
NeonFree tier, then usage-based
Pauses
Postgres that sleeps when idle and wakes on the next query, billed by use with no monthly minimum.
- 5
A job queue
OptionalWhen work arrives faster than you can do it, or has to retry until it succeeds.
BullMQFree, open source
The standard Node.js queue: free, with delayed, repeating and parent-child jobs, on the Redis you run next to your app.
- 6
Knowing it still runs
Scheduled jobs fail silently. A heartbeat check expects your job to ping it on schedule and emails you when it does not.
Healthchecks.ioFree tier, then from $20/mo
Not stated Paused if unused
Watches 20 jobs free, no card needed. It is open source too.
What can wait
- A managed Kubernetes cluster. One small server runs dozens of bots.
- A hosted queue service until one worker cannot keep up.
- A domain, unless people need to reach the API by name.
What do I need to build an API, bot or background worker?
A framework, A machine that stays on, Knowing it still runs. About $4 to $6 a month for a small server, or $0 if the job fits in Cloudflare’s free tier.
Where can I host a Discord bot for free?
Reliable free always-on hosting is rare: free container tiers sleep and free cloud servers come with catches. A $4 to $6 server runs a bot around the clock; HTTP-only bots can run on Cloudflare Workers’ free plan.