This guide will help you deploy your Finance Tracker Bot to various hosting platforms.
Before deploying, make sure you have:
- A Telegram bot token from @BotFather
- An OpenAI API key (optional, for AI features)
- Your code pushed to a Git repository (GitHub, GitLab, etc.)
Set these environment variables in your hosting platform:
BOT_TOKEN=your_actual_bot_token_here
OPENAI_API_KEY=your_openai_api_key_here # Optional
NODE_ENV=productionPros: Easy deployment, free tier, automatic HTTPS Best for: Quick deployment and development
- Go to railway.app
- Sign up with your GitHub account
- Click "New Project" → "Deploy from GitHub repo"
- Select your repository
- Add environment variables in the "Variables" tab
- Deploy! Your bot will be live in minutes
Pros: Free tier, easy setup, good documentation Best for: Budget-friendly hosting
- Go to render.com
- Sign up and connect your GitHub account
- Click "New" → "Web Service"
- Connect your repository
- Configure:
- Name:
finance-tracker-bot - Environment:
Node - Build Command:
npm install - Start Command:
npm start
- Name:
- Add environment variables
- Deploy!
Pros: Reliable, good free tier (with limitations) Best for: Production applications
- Install Heroku CLI
- Login:
heroku login - Create app:
heroku create your-bot-name - Set environment variables:
heroku config:set BOT_TOKEN=your_token heroku config:set NODE_ENV=production
- Deploy:
git push heroku main
Pros: Fast, serverless, great for bots Best for: Serverless architecture
- Go to vercel.com
- Sign up with GitHub
- Import your repository
- Configure environment variables
- Deploy!
Pros: Reliable, scalable, good performance Best for: Production applications
- Go to DigitalOcean
- Create account and add payment method
- Go to "Apps" → "Create App"
- Connect your GitHub repository
- Configure environment variables
- Deploy!
After deploying, verify:
-
Bot is running:
- Check your hosting platform's logs
- Send
/startto your bot on Telegram
-
Environment variables:
- Verify
BOT_TOKENis set correctly - Test basic commands like
/help
- Verify
-
Monitoring:
- Set up uptime monitoring (UptimeRobot, etc.)
- Check logs regularly
-
Bot not responding:
- Check if the service is running
- Verify bot token is correct
- Check platform logs for errors
-
Environment variables not working:
- Restart the service after adding variables
- Check variable names (case-sensitive)
-
Service keeps crashing:
- Check memory limits on free tiers
- Review error logs
- Ensure all dependencies are in
package.json
-
Never commit sensitive data:
- Keep
.envfiles out of Git - Use environment variables for secrets
- Keep
-
Use HTTPS:
- Most platforms provide this automatically
- Verify your bot uses secure connections
-
Regular updates:
- Keep dependencies updated
- Monitor for security patches
- Railway: $5/month after free tier
- Render: Free tier available
- Heroku: Free tier discontinued
- Vercel: Generous free tier
- DigitalOcean: $5/month minimum
- Development: Railway or Render
- Production: DigitalOcean or Railway
- Budget: Render or Vercel
If you encounter issues:
- Check the platform's documentation
- Review error logs
- Test locally first
- Join platform-specific communities
Happy Deploying! 🚀