Property PrismDev Hub

Getting Started

Developer setup guide for running all Prism services locally.

Updated Apr 3, 2026

Prerequisites

ToolVersionPurpose
Node.js20+Frontend dev server and tooling
npm10+Frontend package management
Go1.22+Backend API compilation
PostgreSQL15+ (with PostGIS)Database (or use Supabase/Docker)
Redis7+Cache (or use Upstash/Docker)
Docker + ComposeLatestFull-stack local development
Git2.40+Version control

Optional:

  • k6 — for load testing (make load-smoke)
  • swag CLI — for regenerating Swagger docs (make api-docs)

Repository Structure

project-prism/
├── frontend/           # Vite + React + TypeScript SPA
├── go-backend/         # Go REST API service
│   ├── cmd/api/        # API entry point
│   ├── cmd/import_worker/  # Async import worker
│   ├── internal/       # Application code (handler/service/repo/domain)
│   ├── pkg/            # Shared packages (apierror, response)
│   ├── ops/            # Docker Compose + monitoring configs
│   ├── perf/           # k6 load test scripts
│   └── docs/           # Generated Swagger/OpenAPI specs
├── database/           # Canonical SQL schema + migrations
├── docs/               # Developer documentation (this site)
├── docs-site/          # User-facing documentation (Fumadocs/Next.js)
├── marketing/          # Public marketing site (Next.js)
├── supabase/           # Legacy Supabase artifacts
└── test-data/          # Sample data for development

Quick Start: Frontend

cd frontend
cp .env.example .env
npm install
npm run dev

The dev server starts at http://localhost:5173.

Required Environment Variables

VariableDescription
VITE_API_BASE_URLBackend API URL (e.g., http://localhost:8080)
VITE_CLERK_PUBLISHABLE_KEYClerk publishable key for auth

Optional Environment Variables

VariableDescription
VITE_CLERK_PROXY_URLClerk proxy URL (production only)
VITE_MAP_3D_STYLE_URLMapLibre 3D style URL for 3D map toggle
VITE_SENTRY_DSNSentry DSN for error tracking

Frontend Commands

CommandPurpose
npm run devStart dev server
npm run buildProduction build
npm run typecheckTypeScript type checking
npm run lintESLint
npm run testVitest unit/component tests
npm run test:e2ePlaywright end-to-end tests

Quick Start: Backend

cd go-backend
cp .env.example .env
go mod download
make run

The API server starts at http://localhost:8080.

Required Environment Variables

VariableDescription
DATABASE_URLPostgreSQL connection string
REDIS_URLRedis connection string
CLERK_SECRET_KEYClerk secret key for JWT validation
CLERK_JWKS_URLClerk JWKS endpoint URL
CLERK_ISSUERExpected JWT issuer

Optional Environment Variables

VariableDefaultDescription
PORT8080HTTP listen port
ENVdevelopmentEnvironment (development, staging, production)
LOG_LEVELinfoLog level (debug, info, warn, error)
ALLOWED_ORIGINS*CORS allowed origins (comma-separated)
CLERK_AUDIENCEExpected JWT audience
STRICT_CLERK_SCOPESfalseStrict scope enforcement (must be true in production)
TRUST_CLOUDFLARE_HEADERSfalseTrust Cloudflare real-IP headers
RATE_LIMIT_PER_SECONDRate limit requests per second
RATE_LIMIT_BURSTRate limit burst size
METRICS_SCRAPE_TOKENBearer token for /metrics endpoint protection
SENTRY_DSNSentry DSN for error tracking

Backend Make Commands

CommandPurpose
make runStart API server
make devStart with hot reload
make testRun all tests
make test-coverageRun tests with coverage report
make buildCompile binary
make fmtFormat Go code
make lintRun Go linter
make api-docsRegenerate Swagger/OpenAPI specs
make api-docs-checkCheck Swagger docs are up-to-date (CI)
make load-smokeRun k6 smoke test
make cleanRemove build artifacts

Quick Start: Full Stack (Docker)

Run backend + Postgres + Redis + monitoring stack:

cd go-backend/ops
cp .env.example .env
# Edit .env with your Slack webhook URLs for alerting
docker compose up --build -d

Local Service Endpoints

ServiceURL
Backend APIhttp://localhost:8080
Health Checkhttp://localhost:8080/health
Readiness Checkhttp://localhost:8080/ready
Metricshttp://localhost:8080/metrics
Swagger UIhttp://localhost:8080/swagger/index.html
Prometheushttp://localhost:9090
Alertmanagerhttp://localhost:9093
Grafanahttp://localhost:3000

Database Setup

Option A: Use Managed Supabase

Point DATABASE_URL at your Supabase Postgres instance. PostGIS is pre-installed.

Option B: Local Docker (via Compose)

The go-backend/ops/docker-compose.yml includes a Postgres + PostGIS container.

Option C: Local PostgreSQL

# Create database
createdb prism

# Enable PostGIS
psql prism -c "CREATE EXTENSION IF NOT EXISTS postgis;"

# Apply schema
psql prism < database/PRISM_vNext_FINAL.sql

Schema Files

FilePurpose
database/PRISM_vNext_FINAL.sqlFull rebuild script (canonical schema)
database/PRISM vNext.sqlHistorical duplicate (kept identical)
database/migrations/Incremental migration files for existing databases

Clerk Authentication Setup

  1. Create a Clerk application at clerk.com
  2. Create an organization and configure org permissions
  3. Set VITE_CLERK_PUBLISHABLE_KEY in frontend/.env
  4. Set CLERK_SECRET_KEY, CLERK_JWKS_URL, CLERK_ISSUER in go-backend/.env
  5. Configure org permissions to match Prism's scope model (see docs/backend/account-profile-onboarding-guide.md)

Permission Scopes

The backend requires these Clerk org permissions (prefixed with org: in Clerk, normalized to plain form by backend):

Read scopes: buildings:read, comps:read, tims:read (tim:read in Clerk), tenants:read, owners:read, contacts:read, brokerage_firms:read, reports:read, building_parks:read, key_points:read

Write scopes: All read scopes plus *:write variants and export

Admin scopes: All write scopes plus api_keys:manage, audit:read, export:admin


CI/CD

GitHub Actions workflow: .github/workflows/go-backend-ci.yml

Triggers on PRs and pushes to qa + main branches (for backend/ops paths).

CI Checks

CheckCommand
Go testsgo test ./...
Race detectiongo test -race ./internal/...
Go vetgo vet ./...
Swagger driftmake api-docs-check
Docker composedocker compose config

Branch Strategy

feature → qa → main (production)
  • Feature branches merge into qa
  • qa is validated, then promoted to main via PR
  • main deploys to production