Getting Started
How to start the SaaSProKit project
Quick Start
SaaSProKit is a production-grade Next.js 16 monorepo using pnpm workspaces and Turborepo. Follow these steps to get the project running locally.
Prerequisites
Ensure you have the following installed:
- Node.js 22+ (required, see
enginesin rootpackage.json) - pnpm 10+ (project pins
pnpm@10.19.0viapackageManager) - Git
- PostgreSQL 12+ (or use Docker Compose — see below)
- macOS, Linux, or Windows (WSL2 recommended)
Installation Steps
-
Clone the repository
git clone <repository-url> cd saasprokit -
Install dependencies
pnpm install -
Set up environment variables
Recommended: run the interactive setup CLI. It asks for your project name and deploy target (Cloudflare Workers / Vercel / Docker), then generates both
apps/web/.env.localandpackages/database/.envfor you and removes the other hosts' configuration:pnpm run setupSetup rewrites this clone in place and cannot be re-run. Three deletions happen without a prompt: the deploy configs for the hosts you did not pick; this documentation tree (
docs/, workspace packagekit-docs, and thekit-docs:*scripts /--filter=!kit-docsguards); and — unless you pass--keep-setup— the CLI's own tooling (scripts/,dist/,tsup.config.ts,vitest.config.mts). Run it on a clean checkout, and pass flags if you want to keep any of it:Flag Effect --keep-setupKeep the CLI so you can run setup again --keep-all-hostsKeep every host's deploy config --no-installSkip pnpm installand the Prisma client build--no-commitSkip the git commit step --yesSkip confirmations (dirty-tree warning, env overwrite, commit). Still asks for project name and deploy target unless you also pass --nameand--host--name <name>Project name (required to skip the name prompt) --host <host>Deploy target: cloudflare|vercel|dockerThe interactive run asks before committing.
--yesdoes not — it commits straight away on a clean tree, and on a dirty tree it skips the commit rather than sweeping your uncommitted work into it.docs/is always removed; there is no flag to keep kit-docs.--yesalone is not unattended. For a no-prompt run:pnpm run setup --yes --name acme --host cloudflareDo not copy the
.env.examplefiles by hand —pnpm run setupwrites bothapps/web/.env.localandpackages/database/.envfrom the sameDATABASE_URL. The database example ships with an empty URL. Prisma CLI commands (migrate,studio,db:seed) loadpackages/database/.env, not the Next.js app env.Families in
apps/web/.env.example(edit the files setup wrote if you need to fill optional keys later):Family Vars App (required) NEXT_PUBLIC_APP_URL,NEXT_PUBLIC_APP_NAME,NEXT_PUBLIC_DOCS_URLDatabase DATABASE_URL(default matches Docker postgres). OptionalDIRECT_URLwhen using a pooled Neon URLBetter Auth BETTER_AUTH_SECRET,BETTER_AUTH_URL,BETTER_AUTH_TRUSTED_ORIGINS. OptionalADMIN_EMAILSfor first-admin bootstrapOAuth (optional) GOOGLE_CLIENT_ID/_SECRET,GITHUB_CLIENT_ID/_SECRETStripe (optional in dev) STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET,STRIPE_{PRO,ENTERPRISE}_PRICE_ID_{MONTHLY,ANNUAL}Email EMAIL_FROM,RESEND_API_KEY(prod),SMTP_*(dev defaults to MailDev onlocalhost:1025)Storage STORAGE_PROVIDER(local/s3) plus local path / S3 (AWS_*) vars -
Start local infrastructure
pnpm devdoes not start Postgres or MailDev.docker compose up -d postgres maildevPostgres is on
5432. MailDev SMTP is1025; caught mail is at http://localhost:1080. -
Set up the database
pnpm migrate -
Seed the database (optional, destructive)
pnpm --filter @repo/database db:seedThis wipes tables first (except
RateLimit), then creates sample users (includingadmin@example.com/Password@saaspro), organizations, memberships, and subscriptions. It exits without running ifNODE_ENV=production. See Database Design for what is seeded. -
Run the development server
pnpm devThis is
turbo dev --filter=!kit-docs. It starts the customer apps, not this documentation site:- Main app: http://localhost:3000
- Customer docs (
apps/docs, empty Fumadocs starter): http://localhost:3004 - Email preview: http://localhost:3003
- Storybook: http://localhost:6006
- Prisma Studio: http://localhost:3005
SaaSProKit's own docs (this site, workspace package
kit-docs) run separately:pnpm kit-docs:dev # http://localhost:3006After
pnpm run setup, rootdocs/is deleted andkit-docs:devis gone. Product docs stay atpnpm --filter docs dev(port 3004).
First Time Setup
After starting the app:
- Navigate to http://localhost:3000
- Sign in (not sign up) with the seed user
admin@example.com/Password@saaspro. Signing up with that email collides with the seeded account. Seed already creates organizations — skip "create your first org" unless you want another - Explore the dashboard
Common Development Commands
# Customer apps (excludes kit-docs)
pnpm dev
# Run a specific app
pnpm --filter app dev # Main SaaS app (port 3000)
pnpm --filter docs dev # Customer product docs (port 3004)
pnpm kit-docs:dev # This site — kit-docs (port 3006)
pnpm --filter storybook dev # Component library (port 6006)
# Build the customer apps (excludes kit-docs)
pnpm build
pnpm kit-docs:build # This site only
# Run linting checks
pnpm check
# Auto-fix linting issues
pnpm fix
# Run tests
pnpm test # Unit tests via turbo (app, @repo/auth, @repo/database)
# Type check the web app
pnpm --filter app typecheck
# Database commands
pnpm migrate # Format, generate, push schema
pnpm --filter @repo/database db:seed # Wipe (keeps RateLimit), then seedTroubleshooting
Port already in use
- Change the port:
pnpm --filter app dev -- -p 3001
Database connection issues
- Verify
DATABASE_URLinapps/web/.env.localandpackages/database/.env(both are required, and must match) - Ensure Postgres is running (
docker compose up -d postgres maildev) - Check Neon credentials if using Neon
Caught email (password reset, magic link, verify)
- MailDev UI: http://localhost:1080 (SMTP
localhost:1025)
Dependencies not installing
- Clear pnpm cache:
pnpm store prune - Delete node_modules and reinstall:
rm -rf node_modules && pnpm install
Build fails
- Ensure all environment variables are set
- Run
pnpm migrateto update database schema - Check TypeScript errors:
pnpm --filter app typecheck
Next Steps
- Read the Project Structure guide
- Learn about Features
- Understand the Database Design
- Review Deployment options