Backend Development

Building a Production-Ready Telegram Bot with aiogram 3

Lessons from building a volunteer-management bot with aiogram 3, SQLAlchemy and Redis — FSM flows, support tickets and broadcasts.

June 22, 2026 1 min read

Telegram bots are a great way to ship real value fast, but a production bot needs more than a few command handlers. While building my Volunteers Bot, I leaned on a few ideas that kept it maintainable.

Structure by responsibility

Splitting the code into handlers/, services/, database/ and middlewares/ made each part easy to reason about. Routers group related handlers; business logic lives in services, not in the handlers.

State with FSM + Redis

Multi-step flows like registration are perfect for aiogram's FSM. Backing the state with Redis means it survives restarts and scales beyond one process.

Treat admins as users too

The support-ticket system simply forwards user messages to an admin group; admins reply by responding to the bot's post. No custom dashboard needed.

Add rate limiting, centralised logging and a global error handler, and you have a bot that's ready for real traffic.