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 account — stripe.com (free to create, use test mode)
- -- Clerk account — clerk.com (free tier available)
- -- Resend account — resend.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_NAME | My SaaS | App name shown in UI |
NEXT_PUBLIC_APP_URL | https://yourdomain.com | Production URL (no trailing slash) |
DATABASE_URL | postgresql://user:pass@host:5432/db | PostgreSQL connection string |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | pk_test_... | Clerk publishable key |
CLERK_SECRET_KEY | sk_test_... | Clerk secret key |
NEXT_PUBLIC_CLERK_SIGN_IN_URL | /sign-in | Sign-in page path |
NEXT_PUBLIC_CLERK_SIGN_UP_URL | /sign-up | Sign-up page path |
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL | /dashboard | Redirect after sign-in |
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL | /dashboard | Redirect after sign-up |
CLERK_WEBHOOK_SECRET | whsec_... | Clerk webhook signing secret |
STRIPE_SECRET_KEY | sk_test_... | Stripe secret key |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY | pk_test_... | Stripe publishable key |
STRIPE_WEBHOOK_SECRET | whsec_... | Stripe webhook signing secret |
STRIPE_PRICE_PRO_MONTHLY | price_... | Stripe Price ID for Pro monthly |
STRIPE_PRICE_PRO_YEARLY | price_... | Stripe Price ID for Pro yearly |
STRIPE_PRICE_BUSINESS_MONTHLY | price_... | Stripe Price ID for Business monthly |
STRIPE_PRICE_BUSINESS_YEARLY | price_... | Stripe Price ID for Business yearly |
RESEND_API_KEY | re_... | Resend API key |
RESEND_FROM_EMAIL | noreply@yourdomain.com | Sender email address |
ADMIN_USER_IDS | user_abc123 | Comma-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 dev | Start development server |
npm run build | Production build |
npm run start | Start production server |
npm run lint | Run ESLint |
npm run db:push | Push Prisma schema to database |
npm run db:migrate | Run Prisma migrations |
npm run db:seed | Seed database with initial data |
npm run db:studio | Open Prisma Studio GUI |
npm run stripe:listen | Forward Stripe webhooks locally |
npm run email:dev | Preview email templates |