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
1
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)
2
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}}
3
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
4
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.5
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
6
Run database migrations
Open the API service’s Shell tab in Railway and run:Alternatively, run migrations locally against the production Turso database:
7
Deploy
Push to your main branch. Railway builds and deploys automatically.Watch the build logs in the Railway dashboard. Once the deployment succeeds, Railway assigns a public URL like
https://your-service.up.railway.app.Custom Domains
1
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.2
Update DNS
Add a CNAME record pointing to your Railway domain:
3
Update environment variables
Change Update the Stripe webhook endpoint URL as well.
API_URL to match your custom domain: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:
To handle more traffic, increase the API service’s memory and CPU in Settings > Resources, or deploy multiple instances by increasing the replica count.
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

