Put the bot in a GitHub repository
curl -LO https://botnetwork.tech/downloads/telegram-grammy.zip unzip telegram-grammy.zip -d mi-bot && cd mi-bot git init && git add . && git commit -m "first version" # create an empty repo on GitHub, then: git remote add origin git@github.com:YOUR_USER/mi-bot.git git push -u origin mainCheck that
.envis listed in.gitignorebefore the first commit.Create the Railway project
Sign in to Railway, choose New Project, then Deploy from GitHub repo and pick your repository. Railway detects the Dockerfile and builds it.
Add the variables
Open the service, go to Variables and add:
BOT_TOKEN=123456789:your-real-token MODE=pollingFor the discord.js template use
DISCORD_TOKENandCLIENT_IDinstead, and run the register script once from your machine.Deploy and read the logs
Saving variables triggers a redeploy. Open Deployments, then the latest deploy logs.
Figure 2. What a healthy first deploy looks like in the Deploy Logs view (illustration, not a real screenshot). Keep a single replica for long polling: two copies polling the same token cause 409 Conflict.
Optional: switch to webhooks
In Settings, Networking generate a public domain. Then set:
MODE=webhook WEBHOOK_URL=https://YOUR-SERVICE.up.railway.app/telegram/webhook WEBHOOK_SECRET=paste-output-of-openssl-rand-hex-32Railway injects
PORT; the template listens on it and answers/healthz. Webhooks allow more than one replica.Understand the cost
Railway's pricing page (verified 2026-10-19) lists a Hobby plan at $5/month that includes $5 of usage, and usage rates of about $10 per GB of RAM per month and $20 per vCPU per month, billed per second. A small idle bot using around 100 MB of RAM and very little CPU uses roughly $1 of RAM per month by those rates, which fits inside the included usage. This is an estimate: check the Usage page after a few days and set a usage limit. railway.com/pricing
Troubleshooting
- Build fails on npm ci: commit package-lock.json, or change the Dockerfile to npm install.
- Bot starts then stops: a variable is missing; the template exits with a clear message in the logs.
- 409 Conflict: your local copy is still polling with the same token. Stop it.
Compare with other hosts in the hosting comparator.