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.

For example: a Discord or Telegram bot, a scraper, a webhook receiver, a scheduled script, a small API.

Cost About $4 to $6 a month for a small server, or $0 if the job fits in Cloudflare’s free tier.

  1. 1

    A framework

    Handles HTTP routes, request validation and middleware, so your code is only the logic.

    Hono

    Free, open source

    Small TypeScript framework that runs the same code on Node, Bun, Deno, Cloudflare Workers and Lambda.

    Also worth a look: FastAPI, Fastify, Laravel · compare all backend →

  2. 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 Droplets

    From $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.

    Also worth a look: Hetzner Cloud, Vultr Cloud Compute · compare all VPS →

  3. 3

    Or a host that runs it for you

    Optional

    If you would rather not run Linux, a container host runs the same code from GitHub and restarts it when it crashes.

    Railway

    Free 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.

    Also worth a look: Fly.io, Render · compare all paaS →

  4. 4

    A database

    Optional

    Only if the job has to remember things between runs. A SQLite file on the server is enough for many bots.

    Neon

    Free tier, then usage-based

    Pauses

    Postgres that sleeps when idle and wakes on the next query, billed by use with no monthly minimum.

    Also worth a look: Turso, Supabase · compare all databases →

  5. 5

    A job queue

    Optional

    When work arrives faster than you can do it, or has to retry until it succeeds.

    BullMQ

    Free, open source

    The standard Node.js queue: free, with delayed, repeating and parent-child jobs, on the Redis you run next to your app.

    Also worth a look: pg-boss, Upstash QStash · compare all jobs and queues →

  6. 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.io

    Free tier, then from $20/mo

    Not stated Paused if unused

    Watches 20 jobs free, no card needed. It is open source too.

    Also worth a look: UptimeRobot, Sentry · compare all monitoring →

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.