Deploy Telegram Bot API Gateway
Self-hosted Telegram Bot API gateway, register bot tokens in a web admin.
tgbot-gate
Just deployed
/app/data
Deploy and Host Telegram Bot API gateway on Railway
TG Bot Gate is a lightweight Telegram Bot API gateway written in Rust. You register bot tokens in a built-in admin UI; the service proxies /bot/ to Telegram only for registered bots, stores token hashes (not raw tokens) in SQLite, and rejects unknown tokens with 403.
About Hosting Telegram Bot API gateway
Deploying TG Bot Gate means running a single HTTP service that fronts the official Telegram Bot API (api.telegram.org). Your bots call your Railway URL instead of Telegram directly; the gateway checks the token against a registry, forwards allowed traffic, and can optionally log or persist audit data. The Docker image builds the React admin UI and the Rust binary in one container. Railway assigns PORT and HTTPS on your public domain; you set ADMIN_PASSWORD and persist GATE_DB_PATH so bot registrations and settings survive restarts. After deploy, open /admin, add tokens, and point webhooks or HTTP clients at https://.up.railway.app/bot/sendMessage (and other methods).
Common Use Cases
- Self-hosted bot proxy — Run your own gateway URL so only bots you register can reach Telegram.
- Multi-bot control plane — Manage several Telegram bots from one admin console with hashed token storage.
- Observable bot traffic — Enable stdout JSON logging or SQLite audit capture from Settings after deploy.
Dependencies for Telegram Bot API gateway Hosting
- Telegram Bot API (upstream) — Outbound HTTPS to
https://api.telegram.orgfor proxied requests. - Persistent volume (recommended) — SQLite at
GATE_DB_PATH(default/app/data/gate.db) for bot registry, admin password hash, and settings.
Deployment Dependencies
- Deploy on Railway
- Railway volumes
- Telegram Bot API documentation
- Repository
Dockerfilein this repo
Implementation Details
| Variable | Example | Description |
|---|---|---|
ADMIN_PASSWORD | strong secret | Bootstrap admin password; stored as hash in SQLite |
GATE_DB_PATH | /app/data/gate.db | SQLite path; use a volume-backed path in production |
PORT | set by Railway | HTTP listen port |
- Deploy from the template or connect this repo (builds via
Dockerfile). - Mount a volume at
/app/dataand setGATE_DB_PATH=/app/data/gate.db. - Set
ADMIN_PASSWORD. - Open
https:///admin, register bot tokens. - Call
https:///bot/like the standard Telegram API.
Why Deploy
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Telegram Bot API gateway on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
tgbot-gate
ghcr.io/tailabs/tgbot-gate:latest