---
title: "Deploy Telegram Bot API Gateway"
description: "Self-hosted Telegram Bot API gateway, register bot tokens in a web admin."
category: "Other"
url: https://railway.com/deploy/telegram-bot-api-gateway
---

# Deploy Telegram Bot API Gateway

Self-hosted Telegram Bot API gateway, register bot tokens in a web admin.

**[Deploy Telegram Bot API Gateway on Railway](https://railway.com/template/telegram-bot-api-gateway)**

- **Creator:** Hi Jack's Projects
- **Category:** Other
- **Total deploys:** 16

## Template content

### tgbot-gate https://devicons.railway.app/telegram

- **Image:** ghcr.io/tailabs/tgbot-gate:latest
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# 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.org` for 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](https://railway.com/deploy/Piv1dC?referralCode=kubernetes&amp;utm_medium=integration&amp;utm_source=template&amp;utm_campaign=generic)
- [Railway volumes](https://docs.railway.com/guides/volumes)
- [Telegram Bot API documentation](https://core.telegram.org/bots/api)
- Repository `Dockerfile` in 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 |

1. Deploy from the template or connect this repo (builds via `Dockerfile`).
2. Mount a volume at `/app/data` and set `GATE_DB_PATH=/app/data/gate.db`.
3. Set `ADMIN_PASSWORD`.
4. Open `https:///admin`, register bot tokens.
5. 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.

## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/telegram-bot-api-gateway
