Deploy Formbricks on Railway for a fully managed, zero-configuration deployment. Railway handles infrastructure, scaling, and SSL certificates automatically.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/formbricks/formbricks/llms.txt
Use this file to discover all available pages before exploring further.
Why Railway?
Railway provides a streamlined deployment experience:- One-click deployment from template
- Automatic SSL certificates
- Built-in PostgreSQL and Redis
- Auto-scaling and load balancing
- Pay-as-you-go pricing
- Zero DevOps overhead
Railway is ideal for small to medium deployments. For large-scale production workloads, consider Kubernetes or Docker.
Quick Deploy
Configure Environment Variables
Railway will prompt you to configure required environment variables:
| Variable | Description | Required |
|---|---|---|
WEBAPP_URL | Your Railway URL (auto-generated) | Yes |
NEXTAUTH_SECRET | Secret for NextAuth | Auto-generated |
ENCRYPTION_KEY | Encryption key for 2FA | Auto-generated |
CRON_SECRET | API secret for cron jobs | Auto-generated |
Wait for Deployment
Railway will:
- Build the Formbricks container
- Run database migrations
- Start the application
- Provision SSL certificate
Custom Domain Setup
You can use your own domain instead of the Railway-provided URL:Add Custom Domain in Railway
- Open your Railway project
- Click on the Formbricks service
- Navigate to Settings → Networking
- Click Add Custom Domain
- Enter your domain (e.g.,
formbricks.example.com)
Configure DNS
Add a CNAME record in your DNS provider:
Or for apex domains, use Railway’s provided A records.
| Type | Name | Value |
|---|---|---|
| CNAME | formbricks | your-app.up.railway.app |
Update Environment Variables
Update Railway will automatically redeploy after variable changes.
WEBAPP_URL and NEXTAUTH_URL to use your custom domain:Configuration
Environment Variables
Customize your deployment by adding environment variables in Railway:Email Configuration (SMTP)
Email Configuration (SMTP)
Enable email verification and password reset:
File Storage (S3)
File Storage (S3)
Store file uploads in S3 or compatible storage:
OAuth Providers
OAuth Providers
Enable social login:
Enterprise License
Enterprise License
Activate Enterprise features:
Database Configuration
Railway automatically provisions a PostgreSQL database with pgvector support. The connection string is injected asDATABASE_URL.
Access PostgreSQL
Connect to your database using Railway’s CLI:Redis Configuration
Railway provisions a Redis instance for caching and rate limiting. The connection string is injected asREDIS_URL.
Monitoring and Logs
View Application Logs
Access real-time logs in the Railway dashboard:- Open your project
- Click on the Formbricks service
- Navigate to Logs
Metrics
Railway provides built-in metrics:- CPU usage
- Memory usage
- Network traffic
- Request count
Scaling
Vertical Scaling
Increase resources for your Formbricks instance:- Navigate to Settings → Resources
- Adjust memory and CPU allocation
- Railway will restart the service with new limits
Railway automatically scales resources based on usage. You can set limits to control costs.
Horizontal Scaling
Railway supports horizontal scaling with multiple replicas:- Navigate to Settings → Replicas
- Increase replica count
- Railway handles load balancing automatically
Backup and Restore
Database Backups
Railway automatically backs up PostgreSQL databases:- Automatic backups: Daily snapshots (retained for 7 days)
- Manual backups: Create on-demand snapshots
Create Manual Backup
- Navigate to PostgreSQL service
- Click Backups
- Click Create Backup
Restore from Backup
- Navigate to Backups
- Select backup snapshot
- Click Restore
Export Database
Export your database for external backups:Updating Formbricks
Railway automatically deploys from the Formbricks GitHub repository:Automatic Updates
- Enable Auto-Deploy in Railway settings
- Railway will automatically deploy new releases
- Database migrations run automatically
Manual Updates
- Navigate to Deployments
- Click Deploy
- Select the latest commit or tag
- Railway will build and deploy
Troubleshooting
Deployment Failed
Deployment Failed
Check build logs:Common issues:
- Missing environment variables
- Build timeout (increase build resources)
- Database connection errors
Application Won't Start
Application Won't Start
View runtime logs:Check for:
- Database migration failures
- Invalid environment variables
- Port binding issues (Railway uses PORT variable)
Database Connection Errors
Database Connection Errors
Verify database status:
- Navigate to PostgreSQL service
- Check service status (should be “Running”)
- Verify
DATABASE_URLis injected correctly
High Memory Usage
High Memory Usage
Railway may kill containers exceeding memory limits.Solutions:
- Increase memory allocation in Settings → Resources
- Optimize database queries
- Enable Redis caching
- Reduce concurrent requests
Custom Domain Not Working
Custom Domain Not Working
Verify:
- DNS CNAME record is correct
- DNS has propagated (use
digornslookup) - SSL certificate provisioned (check Networking tab)
WEBAPP_URLupdated to custom domain
- Remove custom domain
- Wait 1 minute
- Re-add custom domain
Cost Optimization
Pricing Considerations
Railway charges based on:- Execution time: vCPU-hour usage
- Memory: GB-hour usage
- Network: Outbound bandwidth
- Database storage: GB-month
Optimization Tips
- Right-size resources: Don’t over-allocate CPU/memory
- Enable Redis caching: Reduces database queries
- Use CDN for assets: Offload static file serving
- Optimize images: Compress uploaded files
- Set up auto-scaling: Scale down during low traffic
Migrating from Railway
If you need to migrate to another platform:Deploy to New Platform
Follow the Docker or Kubernetes guides.
Railway vs Other Platforms
| Feature | Railway | Docker | Kubernetes |
|---|---|---|---|
| Setup Time | 5 minutes | 30 minutes | 1-2 hours |
| Management Overhead | Low | Medium | High |
| Scaling | Automatic | Manual | Automatic |
| Cost | Pay-as-you-go | Infrastructure cost | Infrastructure cost |
| SSL | Automatic | Manual config | Ingress config |
| Best For | Small-medium | Single server | Enterprise |
Next Steps
Configure Integrations
Connect Formbricks with your tools
Create Your First Survey
Start collecting feedback