Deploy to Production in 5 Minutes
January 25, 2025 · Eden Stack Team
Deploy to Production in 5 Minutes
Eden Stack is designed for fast deployment. The web app goes to Vercel, the API goes to Railway, and the database is already on Neon. Let's get you live.
Prerequisites
Before you start:
- Neon database created (you should have this from development)
- GitHub repo with your code pushed
- Vercel account (free tier works)
- Railway account (free tier works)
Minute 0-2: Deploy the API to Railway
Step 1: Install Railway CLI
npm install -g @railway/cli
railway loginStep 2: Initialize and Deploy
cd apps/api
railway init
# Select "Create new project"
# Name it: my-app-api
railway upStep 3: Set Environment Variables
railway variables set DATABASE_URL="your-neon-connection-string"
railway variables set BETTER_AUTH_SECRET="your-secret"
railway variables set BETTER_AUTH_URL="https://your-app-api.railway.app"
railway variables set NODE_ENV="production"
# Add any other secrets you need
railway variables set STRIPE_SECRET_KEY="sk_live_..."
railway variables set STRIPE_WEBHOOK_SECRET="whsec_..."
railway variables set RESEND_API_KEY="re_..."
railway variables set OPENAI_API_KEY="sk-..."Step 4: Generate Domain
railway domain
# Copy the generated URL (e.g., my-app-api-production.railway.app)Your API is now live! Test it:
curl https://my-app-api-production.railway.app/health
# Should return: {"status":"ok","timestamp":"..."}Minute 2-4: Deploy the Web App to Vercel
Step 1: Import Project
- Go to vercel.com/new
- Import your GitHub repository
- Set the root directory to
apps/web
Step 2: Configure Environment Variables
Add these in Vercel's dashboard:
| Variable | Value |
|---|---|
VITE_API_URL | https://my-app-api-production.railway.app |
BETTER_AUTH_URL | https://my-app.vercel.app |
Step 3: Deploy
Click Deploy. Vercel will build and deploy automatically.
Your web app is now live at https://my-app.vercel.app!
Minute 4-5: Connect the Pieces
Update CORS on Railway
Your API needs to accept requests from your Vercel domain:
railway variables set CORS_ORIGIN="https://my-app.vercel.app"
railway up # Redeploy with new configUpdate Auth URLs
If using OAuth (Google, etc.), update callback URLs in your provider's dashboard:
| Provider | Callback URL |
|---|---|
https://my-app-api-production.railway.app/api/auth/callback/google |
Verify Everything Works
- Visit your Vercel URL
- Try logging in
- Create some data
- Check Railway logs for any errors
railway logsQuick Reference: All Commands
# Deploy API
cd apps/api
railway up
# Deploy Web (push to main branch triggers Vercel)
git push origin main
# View logs
railway logs
# Check status
railway statusEnvironment Variables Checklist
Railway (API)
| Variable | Required | Notes |
|---|---|---|
DATABASE_URL | Yes | Neon connection string |
BETTER_AUTH_SECRET | Yes | 32+ char random string |
BETTER_AUTH_URL | Yes | Your Railway URL |
NODE_ENV | Yes | Set to production |
CORS_ORIGIN | Yes | Your Vercel URL |
STRIPE_SECRET_KEY | If using payments | Live key |
STRIPE_WEBHOOK_SECRET | If using payments | Webhook secret |
RESEND_API_KEY | If using email | |
INNGEST_EVENT_KEY | If using background jobs | |
OPENAI_API_KEY | If using AI | |
ANTHROPIC_API_KEY | If using agents |
Vercel (Web)
| Variable | Required | Notes |
|---|---|---|
VITE_API_URL | Yes | Your Railway URL |
BETTER_AUTH_URL | Yes | Your Vercel URL |
Troubleshooting
CORS Errors
If you see CORS errors in the browser console:
- Verify
CORS_ORIGINis set correctly on Railway - Ensure the URL doesn't have a trailing slash
- Redeploy:
railway up
Auth Not Working
- Check
BETTER_AUTH_URLmatches your actual URL (no trailing slash) - Verify
BETTER_AUTH_SECRETis the same in both environments - Check Railway logs for auth errors
Database Connection Errors
- Verify
DATABASE_URLis correct - Ensure it ends with
?sslmode=require - Check if Neon project is active (not suspended)
Build Failures
# Check build logs
railway logs --build
# Or on Vercel, check the deployment logs in the dashboardAutomatic Deployments
Railway
Railway auto-deploys when you push to your connected branch:
# In apps/api
railway link
# Connect to your project
# Now every push deploys automatically
git push origin mainVercel
Vercel deploys automatically on push by default. To disable:
- Go to Project Settings → Git
- Toggle off "Auto Deploy"
Cost Estimate
For a small-to-medium app:
| Service | Free Tier | Paid Estimate |
|---|---|---|
| Neon | 0.5 GB storage, 190 compute hours | $19/mo for Pro |
| Railway | $5 credit/month | ~$5-20/mo |
| Vercel | 100 GB bandwidth | ~$0-20/mo |
| Total | $0-5/mo | ~$25-60/mo |
Custom Domain
Vercel
- Go to Project Settings → Domains
- Add your domain
- Update DNS as instructed
Railway
railway domain --set yourdomain.comThen add the CNAME record to your DNS.
Next Steps
- Set up monitoring with Sentry - see
@eden/observabilitypackage - Add analytics with PostHog - see
@eden/analyticspackage - Configure Stripe webhooks for production
- Set up Inngest in production
Your app is live! Check out the Deploy to Vercel and Deploy API docs for more advanced configuration.