Extending the Template
The starter is intentionally small, but it is not meant to stay frozen. The important part is extending it without erasing the boundaries that already help the codebase stay maintainable.
Preserve the current roles
Try to keep these rules intact:
cmd/serverstays responsible for process startupinternal/configremains the only place that knows how environment variables are parsed and validatedinternal/appremains the wiring layerinternal/botremains the Telegram-facing transport layerinternal/sessionremains a small chat-state abstraction
Introduce a use-case layer when needed
The next architectural step for most real bots is a package that owns business rules separate from Telegram delivery.
That package might:
- Validate domain inputs
- Call external APIs
- Talk to domain persistence
- Return domain results that handlers format for Telegram
Do that before internal/bot/service.go becomes the home of everything.
Evolve storage deliberately
The current session store is appropriate for ephemeral chat state. If your bot needs:
- Permanent user profiles
- Reports
- Admin data
- Search indexes
Add dedicated persistence abstractions rather than stretching the session API beyond its current purpose.
Keep operational behavior first-class
As you add features, preserve these service qualities:
- Configuration validation should fail fast
- Health and readiness behavior should stay meaningful
- Transport switching should remain explicit
- Graceful shutdown should still close external resources cleanly
A practical growth path
- Add new handlers and extract reusable formatting helpers.
- Move business logic into a separate use-case layer.
- Add external integrations behind interfaces.
- Add richer observability once the bot becomes operationally important.
- Split the bot package internally if the number of handlers grows substantially.
The goal is not to keep the starter tiny forever. The goal is to let it grow without losing coherence.