Skip to content

Deployment

Ready to deploy your LaunchKit app? Let’s get it live in minutes!

Vercel is the easiest way to deploy your Next.js LaunchKit app.

  1. Push your code to GitHub, GitLab, or Bitbucket
  2. Have a Vercel account
  1. Connect Your Repository:

    • Go to Vercel Dashboard
    • Click “New Project”
    • Import your LaunchKit repository
  2. Configure Environment Variables: Add these environment variables in Vercel:

    Terminal window
    # -----------------------------------------------------------------------------
    # Resend
    # -----------------------------------------------------------------------------
    RESEND_API_KEY=
    # -----------------------------------------------------------------------------
    # Database URI
    # -----------------------------------------------------------------------------
    NEXT_PUBLIC_APP_URL=
    NEXT_PUBLIC_SUPABASE_URL=
    NEXT_PUBLIC_SUPABASE_ANON_KEY=
    SUPABASE_SERVICE_ROLE_KEY=
    # -----------------------------------------------------------------------------
    # Stripe
    # -----------------------------------------------------------------------------
    STRIPE_PUBLIC_KEY=
    STRIPE_SECRET_KEY=
    STRIPE_WEBHOOK_SECRET=
  3. Deploy: Click “Deploy” and wait for the build to complete.

  4. Update Supabase Settings:

    • Go to your Supabase dashboard
    • Navigate to Authentication > Settings
    • Add your Vercel domain to “Site URL” and “Redirect URLs”
  1. In Vercel, go to your project settings
  2. Click “Domains”
  3. Add your custom domain
  4. Update your DNS records as instructed
  5. Update Supabase redirect URLs with your custom domain
  1. Build Settings:
  • Build command: npm run build
  • Publish directory: .next
  1. Environment Variables: Add the same environment variables as listed above

  2. Redirects: Create a _redirects file in your public folder:

    /* /index.html 200
  1. Connect your GitHub repository to Railway
  2. Add environment variables
  3. Railway will automatically detect and deploy your Next.js app

Make sure you have all required environment variables set:

  • NEXT_PUBLIC_SUPABASE_URL - Your Supabase project URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY - Supabase anonymous key
  • SUPABASE_SERVICE_ROLE_KEY - Supabase service role key
  • RESEND_API_KEY - Resend API key for emails
  • STRIPE_PUBLIC_KEY - Stripe publishable key
  • STRIPE_SECRET_KEY - Stripe secret key
  • STRIPE_WEBHOOK_SECRET - Stripe webhook secret
  1. Run Database Migrations: If you have any custom migrations, run them in your Supabase dashboard

  2. Set up Row Level Security (RLS): Ensure your RLS policies are properly configured

  3. Test Database Connection: Verify your app can connect to the database

  1. Update Webhook URL: In your Stripe dashboard, update your webhook endpoint to point to your production domain:

    https://yourdomain.com/api/webhook/stripe
  2. Test Payments: Make a test payment to ensure everything works

  3. Enable Live Mode: Switch from test mode to live mode when ready

Add analytics to track your app performance:

Terminal window
npm install @vercel/analytics
app/layout.tsx
import { Analytics } from '@vercel/analytics/react';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html>
<body>
{children}
<Analytics />
</body>
</html>
);
}

LaunchKit uses Next.js Image component for automatic optimization:

import Image from 'next/image';
<Image
src="/hero-image.jpg"
alt="Hero"
width={800}
height={600}
priority // For above-the-fold images
/>;

Analyze your bundle size:

Terminal window
npm install @next/bundle-analyzer
npm run build
npm run analyze

Configure caching in next.config.js:

/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
images: {
domains: ['yourdomain.com'],
},
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
],
},
];
},
};
module.exports = nextConfig;
  • ✅ Environment variables are secure and not exposed
  • ✅ HTTPS is enabled (automatic with Vercel)
  • ✅ Content Security Policy configured
  • ✅ Rate limiting implemented for API routes
  • ✅ Input validation on all forms
  • ✅ Supabase RLS policies are properly configured
  • ✅ Stripe webhooks are secured with signatures

Set up error tracking with Sentry:

Terminal window
npm install @sentry/nextjs

Set up uptime monitoring with services like:

  • Vercel Analytics (built-in)
  • UptimeRobot
  • Pingdom
  • StatusPage

For a custom domain like yourlaunchkit.com:

  1. Purchase your domain from a registrar (Namecheap, GoDaddy, etc.)

  2. Configure DNS records:

    • For apex domain: A record pointing to 76.76.19.61
    • For www subdomain: CNAME record pointing to cname.vercel-dns.com

Vercel automatically provides SSL certificates for all domains. No additional setup required!

  1. Database Backups: Supabase automatically backs up your database
  2. Code Backups: Keep your code in version control (Git)
  3. Environment Variables: Keep a secure backup of your .env file

Your LaunchKit app is now live and ready to serve users! 🚀