Next.js SaaS Starter: Complete Template with Auth & Payments

Jumpstart your SaaS project with this Next.js starter template. Includes Stripe payments, authentication, and a Postgres DB with Drizzle.

Next.js SaaS Starter is Next.js’ official starter template for building Software-as-a-Service applications. Built on top of Next.js, Postgres database, Drizzle ORM, and shadcn/ui components.

The template includes pre-configured Stripe integration for subscription management, JWT-based authentication, and role-based access control. You get a marketing landing page, pricing pages, and a complete dashboard system right out of the box.

Features

🚀 Complete SaaS application structure with Next.js framework

🔐 JWT-based authentication with email/password login

💳 Stripe integration for payments and subscription management

👥 Role-based access control with Owner and Member roles

📊 Dashboard with CRUD operations for users and teams

🛡️ Global and local middleware for route protection

📧 Customer portal integration with Stripe

📈 Activity logging system for user event tracking

🎨 Modern UI components with shadcn/ui library

🗄️ PostgreSQL database with Drizzle ORM

📱 Responsive design with animated landing page elements

🔄 Database migrations and seeding scripts

Preview

saas-starter-auth-payment

Use Cases

  • Subscription-Based Content Platforms: Build platforms that require recurring payments for access to exclusive content, such as online courses, newsletters, or video tutorials.
  • Micro-SaaS Products: Quickly launch niche SaaS products that solve a specific problem.
  • Developer Tools: Create and monetize developer tools that offer tiered access plans.
  • Collaborative Project Management Tools: Develop applications for teams to manage projects.

How To Use It

1. Clone the repository and install the dependencies.

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

2. Install the Stripe CLI and log in to your account.

stripe login

3. Run the setup script to create your .env file with the required environment variables.

pnpm db:setup

4. Apply the database migrations and seed the database with initial data. This creates a default user and team.

pnpm db:migrate
pnpm db:seed

5. Start the Next.js development server. Your application will be running at http://localhost:3000. You can test payments with Stripe’s provided test card details. To handle subscription events locally, you can forward Stripe webhooks to your local server.

pnpm dev

Related Resources

FAQs

Q: What database does this starter template support?
A: The template uses PostgreSQL as the primary database with Drizzle ORM for type-safe database operations and migrations.

Q: Can I customize the authentication system?
A: Yes, the authentication system uses JWT tokens stored in cookies. You can modify the authentication logic in the included middleware and API routes.

Q: How do I add new subscription plans?
A: Create new products and prices in your Stripe dashboard, then update the pricing page component to display the new plans.

Q: Is this template suitable for production deployment?
A: Yes, the template includes production deployment instructions for Vercel with proper environment variable configuration and Stripe webhook setup.

Q: What payment methods does the starter support?
A: The template supports all payment methods available through Stripe Checkout including credit cards, digital wallets, and bank transfers.

Next.js

Next.js

Leave a Reply

Your email address will not be published. Required fields are marked *