Postgres, Auth, Tailwind, shadcn/ui, and more.
This is a starter template for building a SaaS application using Next.js with support for authentication, Stripe integration for payments, and a dashboard for logged-in users.
Demo: https://next-saas-start.vercel.app/
/
/pricing
git clone https://github.com/nextjs/saas-startercd saas-starterpnpm install
Install and log in to your Stripe account:
stripe login
Use the included setup script to create your
.env
pnpm db:setup
Run the database migrations and seed the database with a default user and team:
pnpm db:migratepnpm db:seed
This will create the following user and team:
test@test.com
admin123
You can also create new users through the
/sign-up
Finally, run the Next.js development server:
pnpm dev
Open http://localhost:3000 in your browser to see the app in action.
You can listen for Stripe webhooks locally through their CLI to handle subscription change events:
stripe listen --forward-to localhost:3000/api/stripe/webhook
To test Stripe payments, use the following test card details:
4242 4242 4242 4242
When you're ready to deploy your SaaS application to production, follow these steps:
https://yourdomain.com/api/stripe/webhook
checkout.session.completed
customer.subscription.updated
In your Vercel project settings (or during deployment), add all the necessary environment variables. Make sure to update the values for the production environment, including:
BASE_URL
STRIPE_SECRET_KEY
STRIPE_WEBHOOK_SECRET
POSTGRES_URL
AUTH_SECRET
openssl rand -base64 32
While this template is intentionally minimal and to be used as a learning resource, there are other paid versions in the community which are more full-featured:
Postgres, Auth, Tailwind, shadcn/ui, and more.
This is a starter template for building a SaaS application using Next.js with support for authentication, Stripe integration for payments, and a dashboard for logged-in users.
Demo: https://next-saas-start.vercel.app/
/
/pricing
git clone https://github.com/nextjs/saas-startercd saas-starterpnpm install
Install and log in to your Stripe account:
stripe login
Use the included setup script to create your
.env
pnpm db:setup
Run the database migrations and seed the database with a default user and team:
pnpm db:migratepnpm db:seed
This will create the following user and team:
test@test.com
admin123
You can also create new users through the
/sign-up
Finally, run the Next.js development server:
pnpm dev
Open http://localhost:3000 in your browser to see the app in action.
You can listen for Stripe webhooks locally through their CLI to handle subscription change events:
stripe listen --forward-to localhost:3000/api/stripe/webhook
To test Stripe payments, use the following test card details:
4242 4242 4242 4242
When you're ready to deploy your SaaS application to production, follow these steps:
https://yourdomain.com/api/stripe/webhook
checkout.session.completed
customer.subscription.updated
In your Vercel project settings (or during deployment), add all the necessary environment variables. Make sure to update the values for the production environment, including:
BASE_URL
STRIPE_SECRET_KEY
STRIPE_WEBHOOK_SECRET
POSTGRES_URL
AUTH_SECRET
openssl rand -base64 32
While this template is intentionally minimal and to be used as a learning resource, there are other paid versions in the community which are more full-featured: