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
-
Push to GitHub: Ensure your code is pushed to a GitHub repository.
-
Import Project: Go to Vercel Dashboard, select your repository, and click Import.
-
Environment Variables: Vercel will automatically detect that it's a Next.js project. You need to copy your
.envcontent to the Environment Variables section.[!IMPORTANT] Ensure
NEXT_PUBLIC_HOSTis set to your production domain (e.g.,https://my-saas.com). -
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:migrateSelf-Hosting (Docker)
You can also self-host NextSaas using Docker.
-
Build the image:
docker build -t next-saas . -
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.