How to Run OpenClaw on Railway — One-Click Deploy from GitHub
Railway offers one-click deploy from GitHub. Container-based. Different audience (Next.js/Node devs). Here's how to run OpenClaw on Railway.

Railway offers one-click deploys from GitHub. It's container-based, developer-friendly, and beloved by the Next.js/Node crowd. If you've been looking for a way to get your OpenClaw-powered Telegram bot running without wrestling with server configs, this is probably the fastest path from zero to live.
I'm going to walk you through the entire process: forking the repo, deploying on Railway, wiring up Telegram, and understanding what it'll cost you. Total time investment: about 15 minutes if you type slowly.
Let's get into it.
Why Railway for OpenClaw?
Before we touch any buttons, let's talk about why this pairing makes sense.
OpenClaw is an open-source framework for building AI-powered Telegram bots — specifically designed for claw machine games and interactive experiences through Telegram Mini Apps. It handles the Telegram Bot API integration, webhook management, game logic, and AI-powered interactions. You bring the idea and a few API keys. OpenClaw handles the rest.
Railway is a cloud platform that deploys containers from GitHub repos. Push code, get a running service. No Kubernetes manifests, no nginx configs, no SSH-ing into a VPS at 2am because your bot crashed.
The combination means: fork a repo, click deploy, set some environment variables, and you have a production Telegram bot running OpenClaw. That's it. That's the whole pitch.
If you've deployed on Heroku before it got expensive, Railway is the spiritual successor. If you've used Vercel but needed something that runs persistent processes (like a bot), Railway fills that gap.
What You Need Before Starting
Gather these before you start clicking around:
A Railway account. Sign up at railway.app. Free tier gives you $5 in credits, which is more than enough to test everything.
A GitHub account. You'll fork the OpenClaw repo and connect it to Railway.
A Telegram Bot Token. Open Telegram, message @BotFather, send /newbot, follow the prompts. You'll get a token that looks something like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11. Save this somewhere safe. Don't commit it to a public repo. Don't paste it in a Discord channel. You'd be surprised.
An OpenAI API key (optional). If you want the AI-powered claw predictions and game logic that makes OpenClaw interesting, you'll need this. Get one at platform.openai.com.
A MongoDB URI (optional). For persisting game data, user scores, session state. You can add Railway's built-in database or use MongoDB Atlas's free tier.
Got everything? Good.
Step 1: Fork the OpenClaw Repository
Head to the OpenClaw GitHub repo: github.com/homanp/openclaw.
Click Fork in the top right. Fork it to your personal GitHub account.
That's it for this step. The repo already includes a Dockerfile, which Railway will auto-detect. The Dockerfile looks something like this:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
Node 18 Alpine base image, production dependencies only, exposes port 3000. Clean, lightweight, roughly 200-300MB when built. Railway handles the build process automatically — you don't need Docker installed locally.
If you want to add a healthcheck (recommended for production), you can add this line before the CMD instruction:
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
This lets Railway know if your container is actually healthy, not just running.
Step 2: Deploy on Railway
Log into railway.app.
- Click New Project
- Select Deploy from GitHub repo
- Connect your GitHub account if you haven't already
- Select your forked OpenClaw repository
Railway will detect the Dockerfile and start building. But hold on — it won't work yet because we haven't set the environment variables.
Step 3: Configure Environment Variables
This is where the actual configuration happens. In your Railway project dashboard, click on the deployed service, then navigate to the Variables tab.
Add the following:
| Variable | Value | Required? |
|---|---|---|
TELEGRAM_TOKEN | Your bot token from BotFather | Yes |
OPENAI_API_KEY | sk-... your OpenAI key | Optional (for AI features) |
MONGODB_URI | mongodb+srv://... | Optional (for persistence) |
PORT | 3000 | Auto-set by Railway |
NODE_ENV | production | Recommended |
The PORT variable is usually auto-injected by Railway, but setting it explicitly to 3000 doesn't hurt. NODE_ENV=production ensures you're not running development middleware, debug logging, or other things that eat resources for no reason.
After setting these, Railway will automatically trigger a redeploy. Watch the build logs — they should show a clean npm ci and successful start.
Step 4: Set Up the Telegram Webhook
Once your deploy succeeds, Railway assigns your service a public URL. Find it in the Settings tab under Domains. It'll look something like:
https://openclaw-production-abc123.up.railway.app
If no domain is assigned, click Generate Domain to get one.
Now you need to tell Telegram where to send messages. OpenClaw exposes a /webhook endpoint automatically. Set it up with a single curl command:
curl -X POST "https://api.telegram.org/bot<YOUR_TELEGRAM_TOKEN>/setWebhook?url=https://your-railway-domain.up.railway.app/webhook"
Replace <YOUR_TELEGRAM_TOKEN> with your actual token and the URL with your actual Railway domain.
You should get a response like:
{
"ok": true,
"result": true,
"description": "Webhook was set"
}
That's it. Your bot is live.
Open Telegram, find your bot, send /start. You should get a response. If you're using the claw game features, the interactive Mini App should load right in the chat.
If webhooks aren't working, OpenClaw also supports polling mode. Add POLLING=true to your Railway environment variables. Polling mode doesn't require a public URL — the bot actively checks Telegram for new messages. It's slightly less efficient but works when webhook routing is being difficult.
Step 5: Add a Database (Optional but Recommended)
For anything beyond a demo, you want persistence. Game scores, user sessions, interaction history — it all needs to live somewhere.
Option A: Railway's built-in database
In your Railway project, click New → Database → choose MongoDB or PostgreSQL. Railway provisions the database and gives you a connection string. Copy it into your MONGODB_URI or DATABASE_URL environment variable.
This keeps everything in one place. One dashboard, one bill, one set of logs.
Option B: MongoDB Atlas free tier
Sign up at mongodb.com/atlas, create a free M0 cluster, whitelist 0.0.0.0/0 for access (or Railway's IP ranges if you want to be specific), and use the connection string they give you.
Either way, once the MONGODB_URI is set, OpenClaw handles schema creation and data management automatically.
Step 6: Configure the Telegram Mini App
This is where OpenClaw gets interesting. It's not just a chatbot — it's a full interactive experience using Telegram's Web Apps (Mini Apps) feature.
Your Railway domain serves as the Mini App URL. To set it up:
- Open Telegram, message @BotFather
- Send
/setmenubutton - Select your bot
- Choose Web App
- Enter your Railway URL as the Web App URL
Now when users open your bot, they'll see a menu button that launches the full OpenClaw claw machine interface — right inside Telegram. The game renders in a webview, communicates with your Railway-hosted backend, and AI handles the claw physics and prediction logic.
This is the part that makes people go "wait, this runs inside Telegram?" Yes. Yes it does.
What It Costs
Let's talk money. Railway's pricing is straightforward but worth understanding before you scale.
Railway Plans
| Plan | Monthly Cost | What You Get |
|---|---|---|
| Trial | Free ($5 credit) | 500 execution hours, 512MB RAM, 1GB storage, shared vCPU |
| Hobby | $5/month | Unlimited hours, pay-per-use resources, custom domains |
| Pro | $20+/user/month | Priority support, unlimited resources, team features |
What OpenClaw Actually Costs to Run
Here's what I'd estimate based on a standard OpenClaw deployment:
| Scenario | Monthly Cost |
|---|---|
| Idle bot (webhook, minimal traffic) | $0-1 |
| ~100 daily active users | $1-3 |
| ~1,000 daily active users | $3-7 |
| Heavy AI usage (lots of OpenAI calls) | + OpenAI API costs on top |
The bot itself is lightweight. It's a Node.js process that listens for webhooks and responds. When nobody's messaging it, it's barely consuming resources. Railway's pay-per-use billing on the Hobby plan means you're not paying for idle compute the way you would with a fixed VPS.
The real cost driver is OpenAI API calls if you're using AI-powered claw prediction. That's billed by OpenAI, not Railway.
For comparison: a $5/month DigitalOcean droplet gives you similar compute but requires you to manage the server, install Node, configure nginx, set up SSL, handle process management with PM2, and deal with updates. Railway does all of that automatically. The convenience premium is minimal.
Production Hardening
If you're running this for real users (not just a demo), do these things:
Add Redis for Session Management
In your Railway project, add a Redis database (New → Database → Redis). Use the connection string in your environment variables. This gives you fast session storage so users don't lose their game state between interactions.
Set Up Monitoring
Railway's built-in logs are good for debugging but not for alerting. Set up UptimeRobot (free tier) to ping your Railway domain's health endpoint every 5 minutes. If your bot goes down, you'll know before your users do.
Custom Domain
If you want a cleaner URL (for the Mini App especially), add a custom domain in Railway's Settings → Domains. Point a CNAME record from your domain to Railway's provided target. SSL is automatic.
Auto-Deploy from GitHub
This is already the default behavior. Every push to your main branch triggers a new deploy on Railway. If you want to be more careful, set up a staging branch and only deploy from main when you're ready.
Troubleshooting Common Issues
Build fails with "node version" error: The OpenClaw repo requires Node 18+. Railway's Nixpacks builder usually handles this, but if you're seeing version issues, add an .nvmrc file to your repo root containing just 18.
Bot doesn't respond to messages: Check, in order: (1) Is the webhook set correctly? Run curl https://api.telegram.org/bot<TOKEN>/getWebhookInfo and verify the URL matches your Railway domain. (2) Are the environment variables set? Check the Variables tab. (3) Check deploy logs for startup errors.
Port mismatch: Railway injects a PORT environment variable. Make sure your app listens on process.env.PORT, not a hardcoded value. The OpenClaw repo handles this by default, but if you've modified the code, double-check.
Webhook SSL errors: Railway provides SSL automatically. If you're getting certificate errors, make sure you're using https:// in your webhook URL, not http://.
Deploy works but Mini App shows blank page: Your Railway domain needs to serve the frontend assets. Check that the build process includes the frontend build step. The default Dockerfile should handle this, but custom modifications might skip it.
Find OpenClaw Machines and Gear
If you're building claw machine experiences with OpenClaw, you might also be interested in physical claw machines, parts, or accessories. Claw Mart is where you'll find curated listings for claw machines — from mini arcade setups to commercial-grade units, replacement parts, and prize supplies.
Whether you're running a virtual claw game on Telegram or setting up a physical arcade, it's worth browsing what's available. Listings are regularly updated, and you can find everything from home claw machines to commercial arcade equipment in one place.
What's Next
You now have a live OpenClaw bot running on Railway, connected to Telegram, with a Mini App interface. In 15 minutes. Without touching a terminal (except for that one curl command).
From here, the interesting work begins:
- Customize the claw game logic — fork the repo and modify the game mechanics. Adjust difficulty, prizes, physics parameters.
- Add analytics — track which users play most, win rates, engagement metrics. Pipe data to your MongoDB instance.
- Monetize — Telegram supports payments natively. OpenClaw can integrate with Telegram's payment API for premium plays or in-game purchases.
- Scale — Railway handles horizontal scaling. If your bot goes viral on Telegram (it happens), you can bump resources in the dashboard without redeploying.
The OpenClaw repo is actively maintained and the community is growing. Star the repo, watch for updates, and contribute back if you build something cool.
Now go ship something.