Essential Commands for the Tanstack Start Supabase SaaS Kit

Quick reference for development, database, testing, and code quality commands in the Tanstack Start Supabase SaaS Kit.

A quick reference for the commands you'll use daily. All commands run from the project root.

Daily Development

CommandWhat It Does
pnpm devStart the Tanstack Start dev server
pnpm run supabase:web:startStart local Supabase
pnpm run supabase:web:stopStop local Supabase
pnpm run stripe:listenForward Stripe webhooks locally

Database Operations

Starting and Stopping

# Start Supabase (requires Docker running)
pnpm run supabase:web:start
# Stop Supabase
pnpm run supabase:web:stop

Migrations

# Reset database (re-run all migrations + seed)
pnpm run supabase:web:reset
# Generate types after schema changes
pnpm run supabase:web:typegen
# Run database tests
pnpm run supabase:web:test

Creating New Migrations

After modifying tables in Supabase Studio, create a migration:

# See what changed
pnpm --filter web supabase db diff
# Create a named migration file
pnpm --filter web supabase db diff -f add-projects-table

This 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 project
pnpm --filter web supabase link --project-ref your-project-ref
# Push migrations to production
pnpm --filter web supabase db push
# Pull remote schema
pnpm --filter web supabase db pull

Code Quality

Run these before committing:

# Type checking
pnpm typecheck
# Lint and auto-fix
pnpm lint:fix
# Format code
pnpm format:fix

Or run all three:

pnpm typecheck && pnpm lint:fix && pnpm format:fix

Testing

# Run all tests
pnpm test
# Run E2E tests (requires app running)
pnpm --filter e2e test

Environment Variables

Environment variables are stored in per-mode files under apps/web/:

apps/web/.env # Shared defaults
apps/web/.env.development # Local development
apps/web/.env.production # Production build
apps/web/.env.test # Test runs

Client-exposed variables must use the VITE_ prefix (they are inlined by Vite via import.meta.env). Keep secrets in an untracked .env.local file.

Cleaning Up

When dependencies get out of sync or caches cause issues:

# Clean all workspaces
pnpm run clean:workspaces
# Clean root
pnpm run clean
# Reinstall everything
pnpm i

Package Management

# Install dependencies
pnpm i
# Update all dependencies
pnpm update -r
# Check for version mismatches
pnpm syncpack:list
# Fix version mismatches
pnpm syncpack:fix

Building for Production

# Build all packages and apps
pnpm build
# Preview the production build locally
pnpm --filter web preview

Quick Reference Card

# Start everything
pnpm run supabase:web:start && pnpm dev
# Database workflow
pnpm run supabase:web:reset # Reset to clean state
pnpm run supabase:web:typegen # Update TypeScript types
# Before committing
pnpm typecheck && pnpm lint:fix && pnpm format:fix
# When things break
pnpm run clean:workspaces && pnpm run clean && pnpm i