NextSaas
NextSaas
IntroductionGetting StartedConfigurationDatabaseAuthenticationEmailsInternationalizationPaymentsStorageDeploymentChangelog

Deployment

Deploy your NextSaas application to production.

NextSaas is a standard Next.js application, so it can be deployed anywhere Next.js is supported. However, we highly recommend Vercel for the seamless integration and best performance.

Vercel Deployment

  1. Push to GitHub: Ensure your code is pushed to a GitHub repository.

  2. Import Project: Go to Vercel Dashboard, select your repository, and click Import.

  3. Environment Variables: Vercel will automatically detect that it's a Next.js project. You need to copy your .env content to the Environment Variables section.

    [!IMPORTANT] Ensure NEXT_PUBLIC_HOST is set to your production domain (e.g., https://my-saas.com).

  4. Deploy: Click Deploy. Vercel will build your app and deploy it.

Database Migrations

In production, you should run migrations as part of your build process or manually before deployment.

We recommend adding the migration command to your package.json:

"scripts": {
  "build": "bun run db:migrate && next build"
}

Or, if you prefer manual control, run it from your local machine connecting to the production database:

# .env needs to point to production DB
bun run db:migrate

Self-Hosting (Docker)

You can also self-host NextSaas using Docker.

  1. Build the image:

    docker build -t next-saas .
  2. Run the container:

    docker run -p 3000:3000 \
      -e DATABASE_URL="postgresql://..." \
      -e BETTER_AUTH_SECRET="..." \
      next-saas

Production Checklist

Before going live, check the following:

  • Database: Ensure your production database is secure and backed up.
  • Stripe: Switch Stripe API keys to Live Mode.
  • Auth: Update OAuth callbacks (Google/GitHub) to use your production domain.
  • Emails: Verify your domain in Resend to ensure high deliverability.
  • Analytics: Set up Google Analytics or Umami IDs.

Storage

Configure file storage with S3 or local filesystem.

Changelog

Latest updates and improvements to NextSaas

On this page

Vercel DeploymentDatabase MigrationsSelf-Hosting (Docker)Production Checklist