Getting Started
Commands
Reference for all npm scripts
TL;DR:
npm run devto start,npm run db:pushfor schema changes,npm run db:studioto browse data.
Development
| Command | Description |
|---|---|
npm run dev | Start development server with hot reload |
npm run dev:setup | First-time setup: push schema + seed database |
# Start developing
npm run dev
# First time? Run setup first
npm run dev:setupBuild & Production
| Command | Description |
|---|---|
npm run build | Create production build |
npm run start | Start production server (requires build) |
npm run preview | Build and start in one command |
# Test production build locally
npm run previewDatabase
All database commands use Drizzle Kit.
| Command | Description |
|---|---|
npm run db:push | Push schema changes to database (dev) |
npm run db:generate | Generate migration files |
npm run db:migrate | Run migrations (production) |
npm run db:studio | Open Drizzle Studio (visual database editor) |
npm run db:seed | Create user and organization |
npm run db:seed:demo | Add demo data (44 companies, 70+ contacts) |
npm run db:reset | Drop all tables and re-seed |
Drizzle Studio
npm run db:studioOpens a visual database editor at localhost:4983. It connects to whatever database is in your DATABASE_URL - local PostgreSQL or cloud (Neon, Supabase, etc.). Browse tables, view data, edit records directly. Like pgAdmin or TablePlus, but built into Drizzle.
When to use which
db:push vs db:migrate
- Use
db:pushduring development - it's faster and doesn't create migration files - Use
db:generate+db:migratefor production deployments
# Development workflow
npm run db:push
# Production workflow
npm run db:generate
npm run db:migrateSeeding
# Basic seed (1 user, 1 org, dictionaries)
npm run db:seed
# Demo data (companies, contacts, activities)
npm run db:seed:demo
# Start fresh
npm run db:resetRequires ALLOW_DB_SEED=true in .env.local. See Environment Variables.
Docker
| Command | Description |
|---|---|
npm run docker:up | Start all containers |
npm run docker:down | Stop all containers |
npm run docker:rebuild | Rebuild and restart containers |
npm run docker:clean | Remove volumes and rebuild (fresh start) |
# Start everything
npm run docker:up
# Something broken? Clean slate
npm run docker:cleanSee Docker Setup for full guide.
Code Quality
| Command | Description |
|---|---|
npm run lint | Check for ESLint errors |
npm run lint:fix | Fix auto-fixable ESLint errors |
npm run format | Format code with Prettier |
npm run format:check | Check formatting without changes |
npm run typecheck | Run TypeScript type checking |
# Before committing
npm run lint:fix && npm run format
# CI checks
npm run lint && npm run format:check && npm run typecheckPre-commit hooks run lint-staged automatically via Husky.
| Command | Description |
|---|---|
npm run email:dev | Start React Email preview server |
# Preview email templates at localhost:3005
npm run email:devEmail templates live in src/emails/.