Minimal Telegram bot template with user registration and SQLite storage. Built with Go and telegram-bot-api.
/startcommand that registers users in local SQLite database/statuscommand showing bot version- Access control: public mode or allowlist by Telegram user ID
- Automatic database migrations
- Clean Architecture: repository pattern, dependency injection, interface-based design
- Register a bot with BotFather and get a token
- Copy the config template and fill in your values:
cp .env.example .env
| Variable | Description | Default |
|---|---|---|
TOKEN |
Telegram bot token | (required) |
DEBUG |
Enable debug logging | false |
PUBLIC |
Allow all users to use the bot | true |
ALLOWED_TG_IDS |
Comma-separated list of allowed Telegram user IDs (when PUBLIC=false) |
When running outside of make, use the BOT_ prefix (e.g. BOT_TOKEN). Command-line flags (--token, --debug, etc.) override environment variables.
make startmake build # build binary
make test # run tests
make lint # run linter
make fmt # format code
make db-reset # backup db and recreate with migrations
make db-migrate # apply migrations onlycmd/bot/ Application entry point and configuration
internal/
app/ Bot logic and command handlers
model/ Domain entities and repository interfaces
storage/sqlite/ SQLite repository implementations
migrations/ SQL migration files
version/ Build version info