Skip to main content
Railway provides the easiest way to deploy Cap with managed infrastructure, automatic SSL, and zero server maintenance.

Deploy to Railway

Click this button to deploy Cap in under 2 minutes: Deploy on Railway

What Gets Deployed

The Railway template creates:
  • Cap Web - Next.js application (automatically scaled)
  • Media Server - FFmpeg processing service
  • MySQL Database - Managed MySQL 8.0 instance
  • MinIO - S3-compatible object storage
  • Automatic SSL - Free SSL certificates for your domain
  • Environment Variables - Pre-configured with secure defaults

Deployment Steps

1

Click Deploy Button

Click the Deploy on Railway button above.You’ll be prompted to:
  • Sign in with GitHub (or create a Railway account)
  • Select which GitHub organization/account to use
2

Configure Environment

Railway will show a form with environment variables.Required variables (Railway generates secure defaults):
  • NEXTAUTH_SECRET - Session encryption key
  • DATABASE_ENCRYPTION_KEY - Database field encryption
  • MEDIA_SERVER_WEBHOOK_SECRET - Webhook authentication
  • MYSQL_PASSWORD - Database password
  • MYSQL_ROOT_PASSWORD - Database root password
  • MINIO_ROOT_PASSWORD - MinIO admin password
Optional variables:
  • RESEND_API_KEY - For sending login emails
  • RESEND_FROM_DOMAIN - Your domain for emails
  • DEEPGRAM_API_KEY - For AI transcription
  • GROQ_API_KEY - For AI summaries
You can add optional variables later in the Railway dashboard.
3

Deploy

Click Deploy to start the deployment.Railway will:
  • Provision all services
  • Build Docker images
  • Configure networking
  • Generate a public URL
This takes 3-5 minutes.
4

Get Your URL

Once deployed, Railway provides a public URL like:
https://cap-web-production-xxxx.up.railway.app
Click the URL or find it in the Railway dashboard under the cap-web service.
5

Get Login Link

Without email configured, login links appear in the deploy logs:
  1. Click on the cap-web service in Railway dashboard
  2. Click View Logs
  3. Look for:
Login link: https://your-app.railway.app/api/auth/callback/email?token=...
Copy this URL and paste it into your browser to log in.

Custom Domain

Railway provides a free .railway.app subdomain, but you can use your own domain:
1

Add Domain in Railway

  1. Go to your cap-web service in Railway
  2. Click SettingsDomains
  3. Click Add Domain
  4. Enter your domain (e.g., cap.yourdomain.com)
2

Configure DNS

Railway will show DNS records to add:
Type: CNAME
Name: cap
Value: your-app.railway.app
Add this record in your domain registrar’s DNS settings.
3

Update Environment Variables

After DNS propagates:
  1. Go to cap-web service → Variables
  2. Update these variables:
WEB_URL=https://cap.yourdomain.com
NEXTAUTH_URL=https://cap.yourdomain.com
  1. Railway will automatically redeploy
4

Configure MinIO Domain (Optional)

For better performance, add a separate domain for MinIO:
  1. Add domain to MinIO service: s3.yourdomain.com
  2. Configure DNS (same as above)
  3. Update cap-web variables:
S3_PUBLIC_ENDPOINT=https://s3.yourdomain.com
SSL certificates are automatically provisioned by Railway. No manual configuration needed.

Email Configuration

To send login emails instead of using log links:
1

Create Resend Account

  1. Sign up at resend.com
  2. Verify your domain
  3. Create an API key
2

Add Environment Variables

In Railway dashboard, add to cap-web service:
RESEND_API_KEY=re_xxxxxxxxxxxxx
RESEND_FROM_DOMAIN=yourdomain.com
Railway will redeploy automatically.
3

Test Email

Try logging in - you should receive an email with the login link.
See Email Setup for detailed instructions.

AI Features

Enable AI transcription and summaries:
1

Get API Keys

  • Deepgram - Sign up for transcription
  • Groq - Sign up for fast AI summaries (recommended)
  • OpenAI - Alternative for AI summaries
2

Add to Railway

In cap-web service variables:
DEEPGRAM_API_KEY=your-deepgram-key
GROQ_API_KEY=your-groq-key

Connect Cap Desktop

1

Download Cap Desktop

Get the desktop app from cap.so/download
2

Configure Server URL

  1. Open Cap Desktop
  2. Go to Settings
  3. Set Cap Server URL to your Railway URL:
https://cap.yourdomain.com
or
https://cap-web-production-xxxx.up.railway.app
3

Test Upload

Record a video and share it - it will upload to your Railway instance.

Monitoring & Logs

View Logs

  1. Go to Railway dashboard
  2. Click on a service (e.g., cap-web)
  3. Click View Logs
Logs show:
  • Application startup
  • HTTP requests
  • Errors and warnings
  • Login links (if email not configured)

Metrics

Railway provides built-in metrics:
  1. Click on a service
  2. Click Metrics tab
View:
  • CPU usage
  • Memory usage
  • Network traffic
  • Response times

Alerts

Set up alerts for service failures:
  1. Go to project settings
  2. Click Integrations
  3. Add Slack or Discord webhook

Scaling

Automatic Scaling

Railway automatically scales based on:
  • CPU usage
  • Memory usage
  • Request volume
No configuration needed for basic autoscaling.

Vertical Scaling

Increase resources for individual services:
  1. Click on service (e.g., cap-web)
  2. Go to SettingsResources
  3. Adjust:
    • Memory limit (default: 8GB)
    • CPU shares
Higher resource limits increase Railway costs. See pricing.

Database Scaling

For high traffic:
  1. Consider upgrading to Railway’s managed MySQL
  2. Or use external managed database: Update DATABASE_URL environment variable accordingly.

Storage Considerations

The template uses MinIO for object storage, which stores data on Railway’s ephemeral disk.
Railway containers can restart and lose ephemeral data. For production, use external S3-compatible storage.

Use External S3

Recommended for production:
1

Choose S3 Provider

2

Create Bucket

Create a bucket in your S3 provider with public read access.
3

Update Environment Variables

In Railway cap-web service:
CAP_AWS_BUCKET=your-bucket-name
CAP_AWS_REGION=us-east-1
CAP_AWS_ACCESS_KEY=your-access-key
CAP_AWS_SECRET_KEY=your-secret-key
S3_PUBLIC_ENDPOINT=https://s3.amazonaws.com
S3_PATH_STYLE=false
4

Remove MinIO Service

Delete the minio service from Railway project (optional).
See S3 Storage for detailed configuration.

Costs

Railway pricing:
  • Free Trial - $5 credit, no credit card required
  • Hobby Plan - $5/month + usage
  • Pro Plan - $20/month + usage
Estimated monthly cost for Cap (Hobby plan):
  • Base: $5
  • 4 services running 24/7: ~$15-25
  • Total: ~$20-30/month
Actual costs vary based on:
  • Number of users
  • Video upload volume
  • Storage usage (if using Railway MinIO)
  • Traffic volume
Using external S3 storage significantly reduces Railway costs.

Backups

Railway doesn’t provide automatic backups. Implement backup strategy:

Database Backups

# Install Railway CLI
npm i -g @railway/cli

# Login
railway login

# Link to your project
railway link

# Create backup
railway run mysqldump -h mysql -u cap -p cap > backup.sql
Schedule this with cron or GitHub Actions.

Storage Backups

If using Railway MinIO, download volumes periodically:
railway run mc mirror local/cap ./backup
For production, use external S3 with versioning enabled.

Troubleshooting

Service Won’t Start

  1. Check logs for errors
  2. Verify environment variables are set
  3. Restart service:
    • Click service → SettingsRestart

Database Connection Errors

  1. Verify MySQL service is running
  2. Check DATABASE_URL format:
    mysql://user:password@host:port/database
    
  3. Railway internal networking uses service names (e.g., mysql:3306)

Out of Memory

  1. Check service metrics
  2. Increase memory limit in service settings
  3. Consider splitting services across multiple Railway projects

Deployment Fails

  1. Check build logs
  2. Verify Dockerfile syntax
  3. Try manual redeploy:
    • Service → SettingsRedeploy

Migration from Railway

To migrate to self-hosted Docker Compose:
1

Backup Data

Export database and files using Railway CLI (see Backups above).
2

Set Up Docker Compose

3

Import Data

# Import database
docker compose exec -T mysql mysql -u cap -p cap < backup.sql

# Import files to MinIO
docker compose exec minio mc mirror ./backup local/cap
4

Update DNS

Point your domain to your new server.

Next Steps

Email Setup

Configure email delivery with Resend

S3 Storage

Switch to external S3 for production

Environment Variables

Complete configuration reference

Troubleshooting

Common issues and solutions

Build docs developers (and LLMs) love