Telegram Serverless lets you run a Telegram bot or Mini App backend without renting a server. That matters because, until now, for a bot to answer /start, someone had to keep a server running somewhere. A VPS, a cloud function, or a free hosting tier that goes to sleep when idle. For many small bots, the server costs more effort than the bot itself.
On December 2, 2026, Telegram founder and CEO Pavel Durov presented Telegram Serverless in his keynote at Blockchain Life 2026 in Dubai, according to Technext. It is a platform that runs the backend code for bots and Mini Apps directly on Telegram's own servers. You can even build and edit it from BotFather on your phone.
The product is not brand new. The official documentation was already live in July, when Habr reported it on July 15, 2026, and developers were getting early-access invites inside BotFather. Technext reports Durov said about 50,000 testers used it during the beta. The keynote is the public push.
This article explains how it works, based on the official docs, and where the limits are.
What is Telegram Serverless?
You write plain JavaScript files. Telegram runs them in an isolated V8 sandbox (the same JavaScript engine used in Chrome and Node.js), next to the Bot API and a built-in database. The docs put it this way: "no servers to provision, no containers to keep alive, no scaling to think about." Your bot gets three things with no setup: the full Bot API, an SQLite-backed database, and outbound HTTP.
How to build and deploy a Telegram bot with Serverless
Everything Telegram runs sits in one tgcloud/ folder with four kinds of code:
tgcloud/
├─ endpoints/ # functions your Mini App calls
├─ handlers/ # functions that react to Telegram update types
├─ lib/ # shared code you import from anywhere
└─ schema.js # your database tables
Handlers are the bot. Each file matches one Telegram update type. When a message arrives, Telegram calls the default export of handlers/message.js. When someone taps a button, it calls handlers/callback_query.js. If there is no file for an update type, Telegram ignores those updates and runs nothing.
This is the starter example from the docs. It saves each message and replies with a count:
// tgcloud/handlers/message.js
import { api, db } from 'sdk';
import { eq } from 'sdk/db';
import { messages } from '../schema.js';
export default async function (message) {
await db.insert(messages)
.values({ chatId: message.chat.id, text: message.text })
.run();
const count = await db.$count(messages, eq(messages.chatId, message.chat.id));
await api.sendMessage({
chat_id: message.chat.id,
text: `Saved. That's ${count} message(s) from this chat so far.`,
});
}
There is no webhook URL to set, no bot token in the code, and no server entry point. The api object covers every Bot API method, including future ones, with no SDK update needed.
The database uses an API that follows Drizzle ORM. If you know Drizzle, the queries will look familiar: select().from().where(), onConflictDoUpdate, .returning(). You declare tables in schema.js.
Deploying is two commands:
npx tgcloud push # upload the code
npx tgcloud migrate # apply database schema changes
The split is deliberate. The docs say "Deploying never touches your database." A code push only reports pending schema changes. You review and apply them with migrate. That design prevents a common accident: a deploy that silently changes production data.
There is also npx tgcloud run, which executes a handler on the platform with your local files and a fake payload, without deploying. It prints the logs, the return value and the time it took.
How to build a Telegram Mini App backend
Mini Apps are web apps that open inside Telegram. Until now, you had to host the front-end somewhere and build your own API for it, including checking that each request really came from a Telegram user.
Serverless handles both. Since an October 6, 2026 update:
-
Hosting. You build your front-end with React, Vue, Svelte or plain HTML. One
pushuploads the build output, and Telegram serves it athttps://app<app_id>.tgcloud.ai/. -
Endpoints. Each file in
endpoints/is a function your Mini App calls by name withTelegram.WebApp.Serverless.call('getProfile', ...). -
Verified users. The platform checks the Mini App's init data before your code runs. A call without valid init data gets a
401. So inside an endpoint,ctx.initData.userreally is the person who opened the app. You don't build a login system.
The last point matters more than it looks. Validating Mini App init data by hand is easy to get wrong, and getting it wrong means anyone can call your API as any user. Here, the platform does it for you.
How to build a Mini App from your phone with BotFather
This is the "even from your phone" part. Each bot's project also lives inside @BotFather. Open your bot, tap Serverless, and you get the same project the CLI manages:
- Handlers: create, edit and test-run them. Running one shows its console output in the chat.
- Endpoints: the functions your Mini App calls.
-
Library: your shared
lib/code. -
Database: edit
schema.js, review pending changes and apply them. - Mini App Files: the front-end your users open.
It is one project, not a copy. You can start a handler on your phone and later run npx tgcloud pull to continue on a laptop.
Editing code on a phone screen is not comfortable for big projects. But for fixing a typo in a reply, changing a price, or checking why a handler failed, it removes the need to open a laptop and SSH into a server.
Built for AI coding agents
Every new project comes with an AGENTS.md file and an SDK reference in docs/tgcloud-sdk.md. Coding agents like Claude Code, Cursor and opencode read these automatically. The docs say they cover "the conventions generic codegen tends to miss here," such as relative imports ending in .js and every database call being async.
The suggested flow: describe the bot in plain language, let the agent edit schema.js and the handlers, test with tgcloud run, then deploy. The small, closed runtime helps here. With one SDK and no npm packages, there are fewer ways for an agent to pick the wrong library.
Telegram Serverless limits you should know
The docs are open about the constraints. These are the ones that will shape your design:
-
No npm packages. At runtime, a module can import only the platform
sdkand your own files. Nozod, nolodash, no Stripe SDK. If a library you depend on can't be copied in as plain code, you can't use it. -
No filesystem, and no network except the SDK's
fetch. Responses from outside APIs are capped at 30 MB. -
No foreign keys. The database runs with
PRAGMA foreign_keysoff, and declaring a foreign key makes the schema fail to deploy. The docs call it "a deliberate constraint, not an oversight." You enforce relationships in your own code. - Telegram's normal file limits still apply: 50 MB per file upload from a bot, 10 MB for a photo.
- Everything is triggered by Telegram. Code runs when an update arrives or a Mini App calls an endpoint. The docs don't describe scheduled jobs, so a bot that must post something every morning on its own needs another trigger.
And some questions the docs don't answer yet:
- Pricing. Reports from the keynote describe the hosting as free. The documentation has no pricing page, quotas or published resource limits.
- Execution limits. CPU time, memory and request limits per bot are not documented.
-
Exit path. Your code uses a Telegram-specific SDK and your data lives in Telegram's database. Moving to your own server later means rewriting the parts that use
sdk. The query API is close to Drizzle, which helps, but it is not identical.
Should you use Telegram Serverless?
Good fit:
- Small and medium bots: reminders, quizzes, support flows, group tools, to-do lists.
- Mini App backends that store per-user data and call a few outside APIs.
- Prototypes and hackathon projects, where a server is pure overhead.
- People building with AI agents who don't want to learn deployment.
Think twice:
- Bots that need heavy npm dependencies, background jobs or long-running work.
- Anything where you need a clear contract for cost, uptime and data location before launch.
- Products that might leave Telegram later. The less your logic depends on
sdk, the easier that will be. A reasonable middle path is to keep business logic in plain functions inlib/and only callapianddbat the edges.
Telegram Serverless FAQ
Is Telegram Serverless free?
Reports from Durov's keynote describe it as free hosting. The official documentation does not yet list prices, quotas or resource limits.
What language does Telegram Serverless use?
JavaScript. Your modules run in an isolated V8 sandbox, the same engine used in Chrome and Node.js. You need Node.js 18 or newer on your machine to use the tgcloud CLI.
Can I use npm packages?
No. At runtime, code can import only the platform sdk and your own files inside the tgcloud/ folder.
What database does it use?
Each bot gets its own SQLite-backed database. You define tables in schema.js with an API that follows Drizzle ORM, and apply changes with npx tgcloud migrate.
Can I build a Telegram Mini App from my phone?
Yes. In @botfather, open your bot and tap Serverless. You can edit handlers, endpoints, the database schema and the Mini App files, and test-run handlers in the chat.
The bigger picture
Telegram already owns the audience, the identity layer and, with Telegram Stars, the payment layer. Serverless adds the hosting layer. A developer can now go from idea to a live Mini App with users, login, storage and payments without leaving Telegram.
That is great for getting started, and it is also how platforms keep developers. The trade is the usual one: less work today, more dependence later. For a hobby bot, that trade is easy. For a business, wait until Telegram publishes the pricing and limits.
Would you move an existing bot to Telegram Serverless, or keep your own server?
Top comments (0)