Deployment
Deploy LaunchSaaS to production on Vercel, Railway, or Docker
Deployment
This guide covers deploying LaunchSaaS to production, including platform-specific instructions and best practices.
Pre-Deployment Checklist
Before deploying, ensure you have:
- Database set up and accessible from production
- All required environment variables configured
- Database migrations applied (
npm run db:migrate) - Admin user created (
npm run init:scripts) - Stripe webhooks configured with production URL
- Email domain verified in Resend
- Social OAuth apps configured with production callback URLs
-
APP_ENVset toproduction -
NEXT_PUBLIC_APP_URLset to your production domain
Vercel (Recommended)
Vercel is the creators of Next.js and offers the best deployment experience.
Deploy via Dashboard
- Go to vercel.com
- Click "Add New Project"
- Import your Git repository
- Configure environment variables (add all from your
.envfile) - Click "Deploy"
Deploy via CLI
- Install Vercel CLI:
npm install -g vercel- Login and deploy:
vercel login
vercel --prodEnvironment Variables
Add all required environment variables in Vercel Dashboard:
- Go to Project Settings → Environment Variables
- Add each variable for "Production" environment
- Redeploy after adding variables
Custom Domain
- Go to Project Settings → Domains
- Add your domain
- Configure DNS (CNAME to
cname.vercel-dns.comor use Vercel nameservers) - Wait for DNS propagation
Railway
Railway offers simple deployment with database included.
Deploy to Railway
- Go to railway.app
- Click "New Project"
- Select "Deploy from GitHub repo"
- Select your repository
- Add environment variables
- Click "Deploy"
Database on Railway
Railway can provision a PostgreSQL database:
- Click "New" → "Database" → "PostgreSQL"
- Copy the connection string
- Add as
DATABASE_URLenvironment variable
Docker
Deploy anywhere using Docker.
Build Docker Image
Create a Dockerfile in your project root:
FROM node:20-alpine AS base
FROM base AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV PORT=3000
CMD ["node", "server.js"]Build and Run
docker build -t launchsaas .
docker run -p 3000:3000 --env-file .env launchsaasPost-Deployment
Update Webhook URLs
After deployment, update your Stripe webhook URL:
- Go to Stripe Dashboard → Webhooks
- Update endpoint URL to:
https://yourdomain.com/api/auth/stripe/webhook
Update OAuth Callback URLs
Update social login callback URLs:
- GitHub:
https://yourdomain.com/api/auth/callback/github - Google:
https://yourdomain.com/api/auth/callback/google
Verify Deployment
- Visit your production URL
- Test sign up and sign in
- Test payment flow with Stripe test cards
- Verify emails are being sent
- Check admin panel access