HeadlinesBriefing favicon HeadlinesBriefing.com

Telegram Serverless: Run Bot Code Without Servers

Hacker News •
×

Telegram Serverless lets you run backend code for bots and Mini Apps directly on Telegram's infrastructure — no servers to provision, no containers to maintain. You write plain JavaScript modules, deploy with a single tgcloud command, and Telegram executes them in a fast, isolated V8 sandbox alongside the Bot API and a built‑in SQLite database.

A project lives in a local folder with three parts: handlers/ for update entry points, lib/ for shared code, and schema.js for database tables. When an update arrives, Telegram routes it to the matching handler, which uses the SDK to call the Bot API and database. Deploy with `npx tgcloud push`; schema changes use `npx tgcloud migrate` — code and data migrations stay separate.

Getting started: enable Serverless in @BotFather, scaffold a project with `npm create @tgcloud/bot`, link your bot via `npx tgcloud login`, then push and migrate. The CLI shows local vs. cloud diffs with `status` and `diff`.

Ideal for conversational AI bots, Mini App backends, games, and automations that call third‑party APIs. Persistent per‑user state, leaderboards, and dynamic content all run without managing infrastructure.