Skip to main content

Quickstart

What the app does

Pcnaid Legal Hub is a full-stack, multi-tenant legal operations application. It provides law-firm back-office workflows (clients, matters, documents, billing, communications), a client portal, AI-assisted knowledge workflows, and Pcnaid staff administration tools. Stack: Cloudflare Workers (Hono API + React 19 SPA), Azure Postgres via Cloudflare Hyperdrive, Auth0 authentication, Resend (email), Twilio (SMS), Stripe (billing), Cal.com (scheduling), OpenAI (AI), Cloudflare R2 (documents).

Sign-in model

Authentication uses Auth0 Universal Login with PKCE. After sign-in, the Worker mints an HS256 app-session JWT stored in an HttpOnly, Secure, SameSite=Lax pcnaid_access_token cookie. No Auth0 refresh token is stored on the client.
  • Firm staff see the firm dashboard after sign-in.
  • Client-only users are routed to the client portal at /portal/*.
  • Pcnaid staff see /admin/*.
Multi-organization users must set their active organization in Settings and send X-Organization-Id with API requests.

Local development setup

Prerequisites: Node.js 22.12.0+ (use .nvmrc), npm 10+, Cloudflare account with Wrangler, Azure Postgres database, Auth0 tenant.
Configure DATABASE_URL in .dev.vars with your Azure Postgres connection string (sslmode=require). Run the migration and seed:
Start the local Worker and SPA:

Available commands

Public integration points

The API is served under /api/. Public endpoints include health check (GET /api/health), contact form (POST /api/contact), Auth0 callback (POST /api/auth/callback), and brand resolution (GET /api/brand-for-host). Provider webhooks are mounted at /api/webhooks/stripe, /api/webhooks/twilio, /api/webhooks/cal, and /api/webhooks/auth0. Authenticated resource routes are listed in the API Reference.

Next steps