Getting started

Local Development Setup

Run OpsDash on your machine in 15 minutes.

Prerequisites

ToolVersionInstall
Node.js≥ 18https://nodejs.org
pnpm≥ 8npm install -g pnpm
Supabase CLI≥ 1.100npm install -g supabase
DockerLatesthttps://docker.com — required for local Supabase

Steps

1. Clone and install

git clone <your-repo-url> opsdash
cd opsdash
pnpm install

2. Start local Supabase

Docker must be running. This command starts a local Postgres, Auth, Storage, and Studio instance.

supabase start

The command prints your local keys:

API URL:          http://127.0.0.1:54321
anon key:         eyJhbGc...
service_role key: eyJhbGc...

Keep this terminal open.

3. Create your environment file

cp ".env copy.example" .env

Open .env and paste the values from the previous step:

NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=<anon key>
SUPABASE_SERVICE_ROLE_KEY=<service_role key>
NEXT_PUBLIC_APP_URL=http://localhost:3000

Never commit .env to git. The service_role key bypasses all Row-Level Security policies.

4. Apply all migrations

This creates all 57 tables, RLS policies, triggers, and PostgreSQL functions:

supabase db push

5. (Optional) Load demo data

supabase db seed

The seed creates a Demo Company organization with contacts, deals, projects, forms, custom field definitions, automation triggers, and analytics-ready won deals.

6. Start the dev server

pnpm dev

Open http://localhost:3000. Sign up with any email — your personal workspace is created automatically and you land on the dashboard.

Email confirmation is disabled in local mode. Sign up completes immediately. In production, configure email confirmation in Supabase Dashboard → Authentication → Email.

Connecting to Demo Seed Data

If you ran supabase db seed, the Demo Company org exists but is not linked to your user. To browse it:

-- Run in Supabase Studio (http://127.0.0.1:54323 → SQL Editor)

-- 1. Find your user UUID
SELECT id, email FROM auth.users;

-- 2. Link yourself as owner of the demo org
INSERT INTO public.org_members (user_id, org_id, role)
VALUES ('<your-user-uuid>', '00000000-0000-0000-0000-000000000001', 'owner');

-- 3. Switch your current org to the demo org
UPDATE public.users
SET current_org_id = '00000000-0000-0000-0000-000000000001'
WHERE id = '<your-user-uuid>';

Refresh the browser — the org switcher now shows “Demo Company”.

Useful Local URLs

URLPurpose
http://localhost:3000The app
http://127.0.0.1:54323Supabase Studio — table editor, SQL editor, logs
http://127.0.0.1:54324Supabase email inbox (Inbucket) — captures all emails sent locally

Common Commands

# Stop local Supabase
supabase stop

# Reset database — wipes all data, re-applies all migrations + seed
supabase db reset

# Push only new migrations to existing database
supabase db push

# Generate TypeScript types from the local schema
supabase gen types typescript --local > packages/database/src/types/database.ts

# Build all packages in the monorepo
pnpm build

# Run unit tests
pnpm test

# Type-check without building
pnpm typecheck

How Signup Works (Under the Hood)

When a user signs up, the handle_new_user() PostgreSQL trigger fires automatically:

1
Creates public.users profile
2
Creates personal workspace (slug auto-generated)
3
Creates org_members row (user = owner)
4
Creates subscriptions row (plan = free)
5
Seeds default feature_flags for the org
6
Sets users.current_org_id = new org
7
Logs to audit_logs

No manual database inserts required — everything is automatic.

Next Steps