One-Click Deployment
Click the button below to deploy Openfront to Railway:- Create a new Railway project
- Provision a managed PostgreSQL database
- Configure environment variables automatically
- Deploy Openfront with optimized build settings
Railway Template Configuration
Openfront includes arailway.toml configuration file that optimizes the deployment:
Railway can’t access the database during the build phase, so migrations are run at startup instead of during build.
Deployment Process
Configure Project
Railway will automatically:
- Create a new project
- Provision PostgreSQL database
- Set up environment variables
- Connect the GitHub repository
Environment Variables
Automatic Configuration
Railway automatically configures:DATABASE_URL- PostgreSQL connection stringPORT- Application port- Service networking and URLs
Required Variables
You must manually add:SESSION_SECRET
- Select your Openfront service
- Go to the “Variables” tab
- Click “New Variable”
- Add
SESSION_SECRETwith your generated value - Save and redeploy
Optional Variables
Add these for additional functionality:Payment Providers
Stripe:Shipping Provider
File Storage (S3)
Railway provides persistent volumes, but S3 storage is recommended for production deployments for better performance and CDN integration.
Email Configuration
Database Configuration
Managed PostgreSQL
Railway automatically provisions a PostgreSQL database with:- Automatic backups
- Connection pooling
- Monitoring and metrics
- Automatic scaling
DATABASE_URL is automatically injected as an environment variable.
Database Migrations
Unlike standard deployments, Railway runs migrations at startup:External Database
To use an external PostgreSQL database:- Remove the Railway PostgreSQL service
- Add
DATABASE_URLenvironment variable:
Build Process
Build Command
The Railway template uses a custom build command:- Generates KeystoneJS schema and GraphQL types
- Builds Next.js application for production
- Skips Keystone Admin UI (not needed)
Start Command
The start command runs migrations before starting:Build Time
Expect build times of 4-6 minutes:- Dependency installation: 1-2 minutes
- KeystoneJS build: 30-60 seconds
- Next.js build: 2-3 minutes
- Initial startup (with migrations): 30-60 seconds
Railway-Specific Features
Automatic Deployments
Railway automatically deploys when you:- Push to the connected GitHub repository
- Update environment variables
- Manually trigger a deployment
Preview Environments
Create preview environments for:- Pull requests
- Feature branches
- Testing new features
Monitoring and Logs
Railway provides:- Real-time logs
- CPU and memory metrics
- Network traffic monitoring
- Database performance metrics
Custom Domains
Add custom domains:- Go to project settings
- Click “Domains”
- Add your domain
- Configure DNS records
- SSL certificates are automatic
Volume Storage
Persistent Storage
Railway provides persistent volumes for file storage:- Go to your service settings
- Click “Volumes”
- Create a new volume
- Mount at
/app/public/uploads
Volumes persist between deployments but are limited to a single region. For multi-region deployments, use S3 storage.
Post-Deployment Setup
Webhook Configuration
Stripe Webhooks
- Go to Stripe Dashboard > Developers > Webhooks
- Add endpoint:
https://your-railway-app.railway.app/api/webhooks/stripe - Select events:
payment_intent.succeededpayment_intent.payment_failedcharge.refunded
- Copy webhook signing secret to Railway environment variables
PayPal Webhooks
- Go to PayPal Developer Dashboard
- Add webhook:
https://your-railway-app.railway.app/api/webhooks/paypal - Select event types:
PAYMENT.CAPTURE.COMPLETEDPAYMENT.CAPTURE.DENIED
Troubleshooting
Deployment Failures
Build timeout:- Railway has a 15-minute build timeout
- If builds consistently timeout, check for network issues
- Consider optimizing dependencies
- Check logs during startup
- Verify database is accessible
- Ensure
DATABASE_URLis correctly set
Runtime Issues
Application crashes at startup:- Check logs for migration errors
- Verify all required environment variables are set
- Check database connection string
- First startup with migrations takes 30-60 seconds
- Subsequent startups should be faster
- Check database performance
- Configure persistent volume or S3 storage
- Check volume mount path
- Verify write permissions
Database Issues
Connection pool errors:- Railway provides connection pooling by default
- Check number of concurrent connections
- Consider upgrading database plan
- Check Railway database storage limits
- Clean up old data
- Upgrade to larger plan
Scaling on Railway
Vertical Scaling
Increase resources for your service:- More CPU for better performance
- More memory for larger datasets
- Adjust in service settings
Database Scaling
Scale your PostgreSQL database:- Storage: Increase as needed
- Memory: Better query performance
- CPU: Handle more concurrent queries
Horizontal Scaling
Cost Optimization
Railway Pricing
- Hobby Plan: $5/month credit (limited resources)
- Pro Plan: Usage-based pricing
- Enterprise: Custom pricing
Cost-Saving Tips
- Use sleep mode: Enable for development environments
- Optimize builds: Cache dependencies to reduce build time
- Monitor usage: Use Railway’s cost estimation tools
- Right-size resources: Don’t over-provision
Monitoring and Maintenance
Health Checks
Railway automatically monitors:- HTTP health checks
- Service availability
- Resource usage
Backups
Railway PostgreSQL includes:- Automatic daily backups
- Point-in-time recovery
- Manual backup triggers
For production, implement additional backup strategies for critical data.
Updates and Maintenance
- Test updates in preview environment
- Monitor logs during deployment
- Keep dependencies updated
- Regular database maintenance
Advanced Configuration
Custom Build Settings
Modifyrailway.toml for custom configuration: