Prerequisites
- A Railway account
- Your Kit project with a Dockerfile (run
kit docker:init) - Git repository (GitHub, GitLab, or Bitbucket)
Quick Start
1. Create a New Project
- Go to Railway Dashboard
- Click “New Project”
- Select “Deploy from GitHub repo”
- Connect your repository
2. Add PostgreSQL
- In your project, click “New”
- Select “Database” -> “Add PostgreSQL”
- Railway creates the database and sets
DATABASE_URLautomatically
3. Configure Environment Variables
Click on your web service and go to Variables:Railway automatically injects
DATABASE_URL from your PostgreSQL service. You don’t need to set it manually.4. Deploy
Railway automatically deploys when you push to your repository. Your Kit application will:- Build using your Dockerfile
- Run migrations on startup
- Start serving requests
Adding a Scheduler
If your application has scheduled tasks, add a worker service:1. Add Another Service
- In your project, click “New”
- Select “GitHub Repo” (same repo)
- Name it something like “scheduler”
2. Configure the Scheduler
In the scheduler service settings: Start Command:DATABASE_URL.
Custom Domain
- Go to your web service Settings
- Click “Generate Domain” for a Railway subdomain
- Or click “Custom Domain” to add your own
Monitoring
Railway provides built-in monitoring:- Logs: Real-time logs from your services
- Metrics: CPU, memory, and network usage
- Deployments: History and rollback options
Example railway.json
For more control, add arailway.json to your project:
Costs
Railway offers:- Hobby Plan: 5 of usage
- Pro Plan: $20/month with team features
Troubleshooting
Build Fails
Check that your Dockerfile builds locally:Connection Refused
EnsureSERVER_HOST=0.0.0.0 is set. Railway requires binding to all interfaces.
Migrations Fail
Check the DATABASE_URL is correct. View logs in the Railway dashboard for error details.Scheduler Not Running
Verify the start command is exactly./app schedule:work and that environment variables are configured.