Skip to main content
Early access — new tools and guides added regularly
🔴 Launch a Business — Guide 3 of 8
View track
>_ claude codeIntermediate25 min

Deploy to Production: Vercel, Railway, and Beyond

Take your project from localhost to the real internet. Learn deployment platforms, environment variables, domains, and monitoring.

What you will build
Your application deployed to production with a custom domain, HTTPS, and monitoring

Choosing the right platform

Vercel for Next.js frontends and serverless functions — it is the company that makes Next.js, so the integration is seamless. Railway for backend services, databases, and long-running processes. Neon for serverless PostgreSQL — generous free tier and instant branching for development. Turso for edge SQLite — fastest reads for globally distributed apps. The typical SaaS stack: Next.js on Vercel (frontend + API routes), PostgreSQL on Neon (database), Resend for email, Stripe for payments, and Upstash for Redis caching. Ask Claude Code: "Prepare this project for deployment. Create a .env.example listing all required environment variables with descriptions. Ensure no secrets are hardcoded. Add the appropriate deployment configuration files."

Environment variables and secrets management

Every deployment platform has an environment variables section. The pattern is the same everywhere: set the variable name and value in the platform's UI, and reference it in your code via process.env.VARIABLE_NAME. Ask Claude Code: "Audit this project for all environment variables. Create a .env.example file with every variable, its purpose, and where to get the value. Check that no secrets appear in the codebase — search for API keys, database URLs, and tokens in committed files." Critical variables: DATABASE_URL (your database connection string), NEXTAUTH_SECRET (a random 32-character string), NEXTAUTH_URL (your production URL), STRIPE_SECRET_KEY, and STRIPE_WEBHOOK_SECRET.

Custom domains and DNS

After deploying, you get a generated URL like your-app.vercel.app. To use your own domain: buy a domain from Namecheap, Cloudflare, or any registrar. In your deployment platform, add the domain and get the DNS records (usually an A record or CNAME). In your domain registrar, add those DNS records. HTTPS is automatic on Vercel and Railway. Ask Claude Code: "Update the project configuration for the production domain [your-domain.com]. Update NEXTAUTH_URL, Stripe webhook URLs, Open Graph meta tags, sitemap.xml, and any other hardcoded URLs."

Monitoring, logging, and uptime

Your app is live — now you need to know when things break. Ask Claude Code: "Add error tracking with Sentry — catch all unhandled errors in both client and server. Add a health check endpoint at /api/health that checks database connectivity. Set up structured logging for API routes." Use a free uptime monitor like UptimeRobot or BetterStack to ping your health check endpoint every 5 minutes and alert you when it is down. Monitor your Vercel dashboard for function errors and slow responses. Check your database dashboard for connection limits and query performance. These take 15 minutes to set up and save you from waking up to a dead product and angry users.

Related Lesson

Deployment and DevOps

This guide is hands-on and practical. The full curriculum covers the conceptual foundations in depth with structured lessons and quizzes.

Go to lesson