Prerequisites
- A Railway account
- A Turso account for the database
- A Stripe account with live API keys
- A Resend account for transactional email
Deploy to Railway
Create a new project
Log in to Railway and click New Project. Choose Deploy from GitHub repo and select your BunShip repository.Railway detects the Dockerfile automatically. Point it to
docker/Dockerfile.api if it does not detect it on its own:- Go to your service Settings
- Under Build, set the Dockerfile path to
docker/Dockerfile.api - Set the build context to
/(repository root)
Add a Redis service
In your Railway project, click New and select Database > Redis.Railway provisions a managed Redis instance and exposes a
REDIS_URL variable. Link it to your API service:- Click the API service
- Go to Variables
- Add a reference variable:
REDIS_URL=${{Redis.REDIS_URL}} - Add
REDIS_HOST=${{Redis.REDISHOST}} - Add
REDIS_PORT=${{Redis.REDISPORT}}
Set up Turso database
BunShip uses Turso for its database. Create a production database:Add these as Railway variables:
DATABASE_URL=libsql://your-db-name.turso.ioDATABASE_AUTH_TOKEN= your token
Configure environment variables
Add all remaining variables in the Railway service settings. See the full list in the Deployment Overview.The minimum set:
Generate JWT secrets with
openssl rand -base64 32. Use different values for JWT_SECRET and JWT_REFRESH_SECRET.Add a worker service
BunShip needs a separate worker process for background jobs. In your Railway project:
- Click New > GitHub Repo and select the same repository
- Name the service
worker - Set the Dockerfile path to
docker/Dockerfile.api - Override the start command:
bun run apps/api/src/worker.ts - Copy all environment variables from the API service
- Link the same Redis instance
Run database migrations
Open the API service’s Shell tab in Railway and run:Alternatively, run migrations locally against the production Turso database:
Custom Domains
Add a domain in Railway
Go to your API service Settings > Networking > Public Networking and click Generate Domain or Custom Domain.Enter your domain, for example
api.yourdomain.com.Monitoring
Build and Deploy Logs
Railway shows real-time build output and deploy logs in the dashboard. Click a service, then switch to the Deployments tab to see previous deployments and their logs.Health Checks
Railway monitors your service automatically. To add an explicit health check:- Go to service Settings > Deploy
- Set the health check path to
/health - Set the health check timeout to
30seconds
Metrics
The Railway dashboard shows CPU, memory, and network usage per service. For deeper observability, add Sentry error tracking:Alerts
Railway sends notifications for failed deployments. Configure Slack or Discord webhooks under Project Settings > Integrations for team-wide alerts.Costs and Scaling
Railway bills per resource-second. Typical BunShip costs for a small SaaS:| Service | Estimated Monthly Cost |
|---|---|
| API (512 MB, shared CPU) | ~$5-10 |
| Worker (512 MB, shared CPU) | ~$5-10 |
| Redis (25 MB) | ~$3-5 |
| Total | ~$13-25 |
Redeployments
Railway redeploys automatically on every push to your connected branch. To trigger a manual redeploy:- Go to the service Deployments tab
- Click Redeploy on the latest deployment

