Essential Commands for the Next.js Supabase SaaS Kit
Quick reference for development, database, testing, and code quality commands in the Next.js Supabase SaaS Kit.
A quick reference for the commands you'll use daily. All commands run from the project root.
Daily Development
| Command | What It Does |
|---|---|
pnpm dev | Start Next.js dev server + dev tools |
pnpm run supabase:web:start | Start local Supabase |
pnpm run supabase:web:stop | Stop local Supabase |
pnpm run stripe:listen | Forward Stripe webhooks locally |
Database Operations
Starting and Stopping
# Start Supabase (requires Docker running)pnpm run supabase:web:start# Stop Supabasepnpm run supabase:web:stopMigrations
# Reset database (re-run all migrations + seed)pnpm run supabase:web:reset# Generate types after schema changespnpm run supabase:web:typegen# Run database testspnpm run supabase:web:testCreating New Migrations
After modifying tables in Supabase Studio, create a migration:
# See what changedpnpm --filter web supabase db diff# Create a named migration filepnpm --filter web supabase db diff -f add-projects-tableThis creates a new file in apps/web/supabase/migrations/.
Running Supabase CLI Commands
The Supabase CLI is scoped to apps/web. To run any Supabase command:
pnpm --filter web supabase <command>Examples:
# Link to remote projectpnpm --filter web supabase link --project-ref your-project-ref# Push migrations to productionpnpm --filter web supabase db push# Pull remote schemapnpm --filter web supabase db pullCode Quality
Run these before committing:
# Type checkingpnpm typecheck# Lint and auto-fixpnpm lint:fix# Format codepnpm format:fixOr run all three:
pnpm typecheck && pnpm lint:fix && pnpm format:fixTesting
# Run all testspnpm test# Run E2E tests (requires app running)pnpm --filter e2e testEnvironment Variables
# Generate environment variables from templatepnpm turbo gen env# Validate environment variablespnpm turbo gen validate-envCleaning Up
When dependencies get out of sync or caches cause issues:
# Clean all workspacespnpm run clean:workspaces# Clean rootpnpm run clean# Reinstall everythingpnpm iPackage Management
# Install dependenciespnpm i# Update all dependenciespnpm update -r# Check for version mismatchespnpm syncpack:list# Fix version mismatchespnpm syncpack:fixBuilding for Production
# Build all packages and appspnpm build# Analyze bundle sizepnpm --filter web analyzeQuick Reference Card
# Start everythingpnpm run supabase:web:start && pnpm dev# Database workflowpnpm run supabase:web:reset # Reset to clean statepnpm run supabase:web:typegen # Update TypeScript types# Before committingpnpm typecheck && pnpm lint:fix && pnpm format:fix# When things breakpnpm run clean:workspaces && pnpm run clean && pnpm i