Getting Started

Get up and running in under 5 minutes.

# Prerequisites

Before you begin, make sure you have the following installed and ready:

  • -- Node.js 20+nodejs.org
  • -- PostgreSQL — local install or managed (Neon, Supabase, Railway)
  • -- Stripe accountstripe.com (free to create, use test mode)
  • -- Clerk accountclerk.com (free tier available)
  • -- Resend accountresend.com (3,000 emails/month free)

# Installation

Clone the repository and install dependencies:

git clone <your-repo>
cd saas-starter
npm install

Create your environment file:

cp .env.example .env

# Environment Variables

Fill in all variables in your .env file. Here is a complete reference:

Variable Example Description
NEXT_PUBLIC_APP_NAMEMy SaaSApp name shown in UI
NEXT_PUBLIC_APP_URLhttps://yourdomain.comProduction URL (no trailing slash)
DATABASE_URLpostgresql://user:pass@host:5432/dbPostgreSQL connection string
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYpk_test_...Clerk publishable key
CLERK_SECRET_KEYsk_test_...Clerk secret key
NEXT_PUBLIC_CLERK_SIGN_IN_URL/sign-inSign-in page path
NEXT_PUBLIC_CLERK_SIGN_UP_URL/sign-upSign-up page path
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL/dashboardRedirect after sign-in
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL/dashboardRedirect after sign-up
CLERK_WEBHOOK_SECRETwhsec_...Clerk webhook signing secret
STRIPE_SECRET_KEYsk_test_...Stripe secret key
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYpk_test_...Stripe publishable key
STRIPE_WEBHOOK_SECRETwhsec_...Stripe webhook signing secret
STRIPE_PRICE_PRO_MONTHLYprice_...Stripe Price ID for Pro monthly
STRIPE_PRICE_PRO_YEARLYprice_...Stripe Price ID for Pro yearly
STRIPE_PRICE_BUSINESS_MONTHLYprice_...Stripe Price ID for Business monthly
STRIPE_PRICE_BUSINESS_YEARLYprice_...Stripe Price ID for Business yearly
RESEND_API_KEYre_...Resend API key
RESEND_FROM_EMAILnoreply@yourdomain.comSender email address
ADMIN_USER_IDSuser_abc123Comma-separated Clerk user IDs for admins

# Database Setup

Push the Prisma schema to your PostgreSQL database:

# Quick push (development)
npx prisma db push

# Or create a proper migration (recommended for production)
npx prisma migrate dev --name init

Optionally seed the database with initial data:

npx prisma db seed

You can browse your data with Prisma Studio:

npx prisma studio

# Run Dev Server

npm run dev

Open http://localhost:3000 in your browser.

# Project Structure

src/
├── app/
│   ├── (auth)/          # Sign-in, Sign-up (Clerk)
│   ├── (marketing)/     # Landing, Blog, Pricing
│   ├── dashboard/       # Protected dashboard pages
│   ├── admin/           # Admin panel (users, metrics)
│   └── api/             # API routes + webhooks
├── components/
│   ├── ui/              # Reusable UI components
│   ├── landing/         # Landing page sections
│   ├── dashboard/       # Dashboard components
│   └── shared/          # Shared components
├── lib/                 # Utilities, config, helpers
└── styles/              # Global styles + CSS variables

prisma/
├── schema.prisma        # Database schema
└── seed.ts              # Seed script

content/
└── blog/                # MDX blog posts

# Available Scripts

Command Description
npm run devStart development server
npm run buildProduction build
npm run startStart production server
npm run lintRun ESLint
npm run db:pushPush Prisma schema to database
npm run db:migrateRun Prisma migrations
npm run db:seedSeed database with initial data
npm run db:studioOpen Prisma Studio GUI
npm run stripe:listenForward Stripe webhooks locally
npm run email:devPreview email templates

# Next Steps