Skip to content

Guide · Open source

How to use saas-starter: setup, Stripe and deployment guide

Updated · written with AI from the project's own documentation and checked against our catalogue data

saas-starter is an open-source template from the nextjs organisation for building a subscription web app with Next.js, Postgres, Stripe and shadcn/ui. It includes email and password login, Stripe Checkout, a Customer Portal and a dashboard for logged-in users. This guide walks you through cloning it, running it locally, testing payments and preparing a production deployment.

Next.js SaaS Starternextjs/saas-starter · ★ 16.2k · MIT

Quick start

  1. 1Clone the repo. Run git clone on nextjs/saas-starter and enter the saas-starter folder.
  2. 2Install dependencies. Run pnpm install to install the project packages.
  3. 3Create your .env file. Run pnpm db:setup to generate the environment file with the included setup script.
  4. 4Set up the database. Run pnpm db:migrate and pnpm db:seed to create tables and the test user and team.
  5. 5Start the app. Run pnpm dev and open http://localhost:3000.
  6. 6Test Stripe. Forward webhooks with stripe listen and pay with test card 4242 4242 4242 4242.

What do you need before you install saas-starter?

You need Node.js, pnpm, a PostgreSQL database, a Stripe account and the Stripe CLI. The project is set up as clone-and-build, so you run it from your own copy of the code rather than installing a packaged app.

The README is written for developers. Setup requires running terminal commands, editing environment variables and configuring Stripe, so it is not a point-and-click tool.

  • Node.js
  • pnpm
  • PostgreSQL database
  • Stripe account
  • Stripe CLI

How do you clone and install saas-starter?

Clone the repository, move into the project folder and install dependencies with pnpm.

git clone https://github.com/nextjs/saas-starter cd saas-starter pnpm install

How do you run saas-starter locally?

Install the Stripe CLI and log in to your Stripe account. Then run the included setup script, which creates your .env file. Next, run the database migrations and seed the database with a default user and team. The seed creates a test user with the email test@test.com and password admin123. You can also create new users through the /sign-up route.

Start the Next.js development server with pnpm dev and open http://localhost:3000 in your browser. To handle subscription change events locally, forward Stripe webhooks to your app with the Stripe CLI.

  • Log in to Stripe with the CLI, then run the setup script
  • Run migrations and seed data
  • Start the dev server and open localhost:3000
  • Forward webhooks to localhost:3000/api/stripe/webhook
stripe login pnpm db:setup pnpm db:migrate pnpm db:seed pnpm dev stripe listen --forward-to localhost:3000/api/stripe/webhook

How do you test payments in saas-starter?

Use Stripe's test card details to run a checkout without real money. The README gives card number 4242 4242 4242 4242, any future expiration date and any 3-digit CVC. Use the pricing page at /pricing, which connects to Stripe Checkout.

  • Card number: 4242 4242 4242 4242
  • Expiration: any future date
  • CVC: any 3-digit number

What do you change before going to production?

The README describes three parts of a production release: a production Stripe webhook, a deployment on Vercel and production environment variables. Create the webhook in the Stripe Dashboard with your production URL, such as https://yourdomain.com/api/stripe/webhook, and select the events you need, for example checkout.session.completed and customer.subscription.updated.

Deploy by pushing your code to a GitHub repository and connecting it to Vercel. In the Vercel project settings, set BASE_URL, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, POSTGRES_URL and AUTH_SECRET to production values. The README suggests generating AUTH_SECRET with openssl rand -base64 32.

  • BASE_URL: your production domain
  • STRIPE_SECRET_KEY: production Stripe secret key
  • STRIPE_WEBHOOK_SECRET: secret from the production webhook
  • POSTGRES_URL: production database URL
  • AUTH_SECRET: a random string
openssl rand -base64 32

What features does saas-starter include?

The template includes a marketing landing page, a pricing page connected to Stripe Checkout, and dashboard pages with CRUD operations on users and teams. It has basic role-based access control with Owner and Member roles, and subscription management through the Stripe Customer Portal.

Authentication uses email and password, with JWTs stored in cookies. Global middleware protects logged-in routes, local middleware protects Server Actions and validates Zod schemas, and an activity logging system records user events. The stack is Next.js, Postgres, the Drizzle ORM, Stripe and shadcn/ui.

  • Marketing landing page at /
  • Pricing page at /pricing with Stripe Checkout
  • Dashboard with CRUD on users and teams
  • Owner and Member roles
  • Stripe Customer Portal for subscriptions
  • Email/password login with JWTs in cookies
  • Activity logging

What people use it for

  • Learning how login, payments and a dashboard fit together in one Next.js codebase
  • Prototyping a subscription product before building custom features
  • Using shadcn/ui components already wired into a sample app
  • Studying Drizzle ORM with Postgres in a working project

Frequently asked questions

Is saas-starter free to use?

The repository is published under the MIT licence. The README does not list any hosting or service prices, so check the costs of Postgres, Stripe and Vercel separately.

What do I need to install saas-starter?

The README lists Node.js, pnpm, a PostgreSQL database, a Stripe account and the Stripe CLI. You clone the repo and run pnpm install, then the setup commands.

Can I use a database other than Postgres?

The README only covers Postgres and Stripe. If you need a different database or payment provider, you would need to change the code yourself, and the README does not describe how.

Is saas-starter production-ready?

The README says the template is intentionally minimal and meant as a learning resource. It is a starting point, not a finished product.

What is the default login for saas-starter?

After running pnpm db:seed, the README says a test user is created with the email test@test.com and password admin123. You can also sign up new users at /sign-up.

What are alternatives to saas-starter?

The README lists other templates, which it describes as paid and more full-featured: Achromatic, ShipFast, Makerkit, Zero to Shipped and TurboStarter. Supabase starter templates are another option for comparison.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Choose saas-starter if you are a developer or student who wants a working reference combining Next.js, Postgres and Stripe, or a quick prototype to learn from. Pick a more complete paid template if you need a production-ready SaaS out of the box, or a non-developer setup that avoids terminal and Stripe configuration.

Install options & downloads