Telegram bots,
the NestJS way.
A real NestJS framework for the Telegram Bot API — modules, DI, pipes & guards, built to scale and survive production.
Other libraries wrap the API.
Nestgram is the framework.
Telegraf, grammY and node-telegram-bot-api are great clients. The “NestJS” packages around them are thin adapters. Nestgram is built from the ground up on Nest’s own lifecycle — so the framework works for you, not the API.
◇ Thin wrappers
- ✕ Middleware lives outside Nest’s pipeline
- ✕ Bot logic bolted onto a service, not routed
- ✕ Magic strings & manual update parsing
- ✕ No guardrails for production foot-guns
◆ Nestgram
- ✓ Guards, pipes & interceptors from Nest’s pipeline
- ✓ A router is a controller — updates map to handlers
- ✓ Typed events & decorators: @Sender() @Args()
- ✓ Framework warns you before you ship a mistake
Everything NestJS, mapped to Telegram.
Native Nest pipeline
Guards, pipes and interceptors run on the exact same lifecycle as your HTTP routes. No parallel system to learn.
01Router = Controller
Your update handlers are just controllers. Decorators bind messages, callbacks & commands to methods.
02Typed events & decorators
Each handler gets the concrete update it asked for. Pull the sender or args with one explicit decorator — no magic strings.
03If you know Nest,
you already know this.
A controller declares routes. In Nestgram, those routes are Telegram updates. Same decorator discipline, same DI, same testability — pointed at a different transport.
@Router() export class GreetRouter { @Command('start') start(@Sender() user: User) { return `Welcome, ${user.first_name} 👋`; } @OnMessage() echo(message: Message) { return message.text; } }
One predictable pipeline.
Every Telegram update flows through the same Nest lifecycle your team already reasons about — no parallel middleware system.
Guardrails against
production foot-guns.
The framework knows the Telegram Bot API’s sharp edges. It surfaces them at boot — not in an incident channel at 2 a.m.
Build the bot like you build the app.
Bring your NestJS instincts. Nestgram brings the Telegram transport, the pipeline, and the guardrails.