Skip to content

Getting started

Clarity in every parcel.

Commitment Desk is an open-source platform for assessing practices. Commitment Desk Inbox is its first module: an office-side capture inbox for reviewing submitted records.

A capture client — a mobile app, a form, another vendor’s app, or a CLI — posts a structured inspection or permit record with photos. Commitment Desk Inbox validates the record, matches it to a town and parcel, puts it in a review queue, records who submitted and reviewed it, and exposes the audit trail and accepted records through an API or webhook.

It is the receiving, validation, and review layer. It is not a field capture app, and it is not a CAMA replacement. TRIO/CAMA remains the system of record for values and the tax roll.

Milestone 3 complete — hardening and self-host. The Inbox enforces fixed-window rate limits, validates upload content and MIME signatures, runs every upload through a malware-scan hook, records retention settings, supports administrative deletion and a scheduled retention pass, signs webhook deliveries with retries, and exports captures as JSON or CSV. A Node adapter runs the same API on SQLite or Postgres with S3-compatible (or local filesystem) attachments, and Docker packaging plus backup/restore and security documentation are included. The Cloudflare and Node adapters run the same API contract suite. M4 demo work is next; the repository remains private. See the project overview for the milestone plan.

  • Not a field capture app or a mobile app
  • Not a CAMA, billing, or tax-collection replacement
  • Not an AI decision system
  • Not a place for real taxpayer data in the repository, tests, or demo
  • Node.js 22.20 or newer (Node 24 is used in CI; see .nvmrc)
  • pnpm 11 (corepack enable will pick up the version pinned in package.json)
Terminal window
pnpm install
cp .env.example .env # optional local overrides
pnpm seed # apply D1 migrations and seed synthetic demo data
pnpm dev

In a second terminal, submit a synthetic capture through the real local API:

Terminal window
pnpm demo:capture

pnpm seed writes a local demo API key, reviewer email, and IDs to .local-demo.json (gitignored). The demo command reads that file, uploads a fresh synthetic PNG, submits a permit inspection, and prints the stored capture, status, attachment hash, and audit event.

pnpm dev runs both apps:

Service URL
Web http://localhost:5173
API http://localhost:8787/v1/health

Open http://localhost:5173 and sign in with the seeded reviewer:

reviewer@synthetic.test

For administration, sign in with:

admin@synthetic.test

The sidebar keeps Inbox available to reviewers and adds Towns, Parcels, API keys, and Members for administrators. On narrow screens, open Menu to reach navigation, appearance, and the account controls. Wide tables scroll within their own region. Keyboard users can press Escape to close the mobile menu and return to its trigger.

Use Appearance to choose Civic Modern, Land & Ledger, Digital Municipality, or Municipal Heritage with Light, Dark, or System mode. Preferences are saved in the current browser. Civic Modern with System mode is the default.

The magic link is printed in the API terminal and, outside production, returned to the login screen as a development link. No email provider is required locally. Production uses Cloudflare Email Service with a keyless Worker binding and a Node REST adapter for self-host.

The Vite dev server proxies /v1/* to the local API. pnpm seed applies the required migrations; use pnpm db:migrate:local if you only need the schema.

For the organization picker, sign in locally as multi-org@synthetic.test. This synthetic account can review captures in Synthetic Assessing (labeled Demo) and administer members in Synthetic Practice. Each organization has its own data and role. Self-hosters can provision their first administrator with the bootstrap command. The submitter membership is read-only in the web app: it can view the inbox but cannot review, resolve parcels, export, or administer the organization.

Command Purpose
pnpm dev Run the API (Wrangler) and web app (Vite) together
pnpm build Build the web app and bundle the Worker
pnpm typecheck Type-check every workspace package
pnpm test Run Vitest suites
pnpm lint Run ESLint
pnpm format Format with Prettier
pnpm format:check Verify formatting without writing
pnpm audit:prod Audit production dependencies for high advisories
pnpm licenses:check Check production dependency licenses
pnpm spec:validate Validate OpenSpec specs and changes
pnpm docs:dev Run the documentation site on port 4321
pnpm docs:check Check required pages, navigation, and links
pnpm docs:build Build the static documentation site
pnpm test:e2e:docs Run the documentation browser checks
pnpm db:migrate:local Apply D1 migrations to the local database
pnpm seed Apply migrations and seed synthetic demo data
pnpm demo:capture Submit a synthetic capture to the running local API
pnpm test:acceptance Run and print the M1 end-to-end acceptance check
pnpm test:e2e Seed, then run the Playwright reviewer happy path
pnpm test:selfhost Run the Node/SQLite self-host contract suite
pnpm dev:selfhost Run the Node self-host API with local SQLite
pnpm seed:selfhost Migrate and seed a local Node/SQLite database

pnpm seed writes a random local API key and the seeded IDs to .local-demo.json, which is gitignored. The data is synthetic only and can be reseeded at any time. pnpm demo:capture creates a fresh synthetic PNG per run, so it can be repeated without reusing a consumed upload.

pnpm test:e2e applies the seed, starts or reuses the local API and web servers, and runs Chromium against http://localhost:5173. The suite provisions its own uniquely named captures through the API, then signs in, searches the inbox, matches a new parcel, matches an existing parcel, accepts one capture, returns another with a reason, and asserts the audit timeline. It is local-only and uses synthetic data. Install the browser once with pnpm exec playwright install chromium.

CI also scans the full git history for secrets with gitleaks, audits production dependencies, checks dependency licenses, and runs the shared self-host contract suite against SQLite and Postgres. Run pnpm audit:prod, pnpm licenses:check, and pnpm test:selfhost locally after changing dependencies or runtime adapters.

The same API runs on Cloudflare Workers or on Node. The Node adapter supports SQLite or Postgres metadata and S3-compatible attachment storage; a local filesystem store is available for development. The hosted and self-host runtimes execute the same contract suite.

Run the Node adapter against local SQLite:

Terminal window
pnpm install
pnpm seed:selfhost
pnpm dev:selfhost

pnpm seed:selfhost applies the Node schema and writes synthetic demo data plus .local-demo.json. pnpm dev:selfhost serves the API on http://127.0.0.1:8787; start the web app separately with pnpm --filter @commitment-desk/web dev if needed.

For Docker with Postgres and MinIO:

Terminal window
cd infra/docker
cp .env.example .env
docker compose up --build

The web app is served at http://localhost:5173, the API at http://localhost:8787, and MinIO’s console at http://localhost:9001. See self-hosting, backup and restore, and the threat model before using real data.

  • Rate limits use a persisted fixed-window counter and return 429 with RateLimit-* and Retry-After headers. Defaults: 10 magic-link requests per 15 minutes per client/email, 120 captures per minute per API key, and 30 uploads per minute per API key.
  • Uploads are checked against their declared MIME type by magic bytes and then passed to the malware-scanner hook. Set MALWARE_SCANNER_URL (Node or Worker) to an HTTP scanner that returns { "verdict": "clean" | "infected" }; MALWARE_SCANNER_FAIL_CLOSED=false allows fail-open behavior.
  • Retention is configured per tenant at GET/PUT /v1/settings/retention. A retention pass soft-deletes expired terminal captures, destroys their evidence objects, and keeps audit events. Administrators can delete a capture explicitly with DELETE /v1/captures/:id.
  • Webhook endpoints are managed at /v1/webhooks; deliveries are signed with X-CommitmentDesk-Signature: t=<timestamp>,v1=<hmac> over ${timestamp}.${body} and retried with exponential backoff.
  • GET /v1/exports/captures?format=json|csv exports tenant captures with status, town, type, search, and submitted-time filters.

The hosted product uses one platform domain with the application on app. and Inbox as the first module:

Host Purpose
commitmentdesk.com Platform landing page, documentation, sign-in link
app.commitmentdesk.com Commitment Desk platform application; Inbox is the first module
inbox.commitmentdesk.com Permanent redirect to app.commitmentdesk.com
app.commitmentdesk.com/v1 API, same-origin with the application

Set WEB_BASE_URL=https://app.commitmentdesk.com and ENVIRONMENT=production on the deployed API, and keep VITE_API_BASE_URL=/v1 so browser requests stay same-origin. The Inbox remains the default module at the application root for now; add module routes when a second module exists. Self-hosted deployments use their own hostnames. See ADR 0011 for the naming and hostname decision.

Hosted delivery has three tiers: standard shared multi-tenant SaaS, dedicated managed instances, and self-host/BYO Cloudflare. The standard tier uses the single platform application host above; tenant identity comes from the session, not the hostname. See ADR 0012 for the isolation and deployment model.

Capture clients use:

Authorization: Bearer cd_live_...

Reviewers use the magic-link session cookie.

Method Path Purpose
GET /v1/health Public liveness check
POST /v1/auth/magic-link Request a reviewer magic link
GET /v1/auth/magic-link/verify Consume a link and set the session cookie
GET /v1/me Identity, active organization, and memberships
GET /v1/organizations List active memberships for the signed-in user
PUT /v1/organizations/active Select or switch the session organization
GET /v1/members List active and inactive members (admin session)
POST /v1/members Add an existing user by email (admin session)
PATCH /v1/members/:userId Change a membership role (admin session)
DELETE /v1/members/:userId Deactivate a membership (admin session)
POST /v1/auth/logout Revoke the reviewer session
GET /v1/towns List towns (session or API key)
POST /v1/towns Create a town (admin session)
GET /v1/parcels Search parcels (session or API key)
POST /v1/parcels Create a parcel (admin session)
POST /v1/parcels/import Import parcels from CSV (admin session)
GET /v1/api-keys List tenant API keys (admin session)
POST /v1/api-keys Create an API key; raw key returned once (admin session)
POST /v1/api-keys/:id/revoke Revoke an API key (admin session)
POST /v1/uploads Upload evidence (25 MB max, API key)
POST /v1/captures Submit a capture (API key; Idempotency-Key)
GET /v1/captures List captures (session or API key; repeat status)
GET /v1/captures/:id Capture detail (session or API key)
POST /v1/captures/:id/resolve-parcel Match or create a parcel for a needs_match capture (session)
POST /v1/captures/:id/review Accept, return, reject, or request information (session)
DELETE /v1/captures/:id Delete a capture and its evidence (admin session)
GET /v1/settings/retention Read retention settings (admin session)
PUT /v1/settings/retention Update retention settings (admin session)
POST /v1/maintenance/retention Run the retention pass now (admin session)
GET /v1/exports/captures Export captures as JSON or CSV (session)
GET /v1/webhooks List webhook endpoints (admin session)
POST /v1/webhooks Create a webhook endpoint (admin session; secret shown once)
POST /v1/webhooks/:id/deactivate Deactivate a webhook endpoint (admin session)
GET /v1/webhooks/deliveries List webhook delivery attempts (admin session)

Review actions accept:

{
"action": "accept | return | reject | request_information",
"reason": "required for return, reject, and request_information",
"expectedStatus": "in_review"
}

Accept moves a matched in_review capture to accepted. Return, reject, and request information move in_review or needs_match captures to returned or rejected; request information records a capture.information_requested event and reuses returned. Every action appends a reviewer-attributed event with the reason. expectedStatus prevents a stale reviewer view from overwriting a newer decision.

GET /v1/captures accepts status more than once and matches any supplied value. The optional q parameter searches submitted and matched map/lot, address, and permit number, plus the matched parcel’s owner, case-insensitively and within the tenant. The inbox uses status to fetch its Needs Attention and Other captures groups independently and applies q to both; paging controls for each table remain a follow-up.

Parcel resolution accepts exactly one of an existing parcel or new parcel fields:

{
"parcelId": "uuid"
}
{
"parcel": {
"mapLot": "014-022-003",
"address": "12 Elm Street",
"ownerName": "Synthetic Owner"
},
"expectedStatus": "needs_match"
}

Only needs_match captures can be resolved. Success assigns the parcel, moves the capture to in_review, and appends a capture.parcel_matched event. API keys cannot resolve parcels.

Admin management is session-only and requires the admin role. Towns use tenant-scoped unique slugs. Parcels use tenant/town-scoped unique map/lots. CSV import requires mapLot and address columns, accepts optional ownerName and externalId, and rejects the whole file if any row fails. API-key creation returns the raw cd_live_... value once; only a prefix and SHA-256 hash are stored. Revoked keys stop authenticating immediately.

The M1 read-path decision is documented in docs/adr/0002-m1-capture-api.md; reviewer sessions are in docs/adr/0003-m2-reviewer-sessions.md; the review transition matrix is in docs/adr/0004-m2-review-actions.md; parcel resolution is in docs/adr/0005-m2-parcel-resolution.md; admin reference data is in docs/adr/0006-m2-admin-reference-data.md; inbox search is in docs/adr/0007-m2-inbox-search.md; the browser happy path is in docs/adr/0008-m2-playwright.md.

The web inbox groups captures into a Needs Attention table (received, needs_match, in_review) and an Other captures table (accepted, returned, rejected). The status, town, type, and search filters apply to both; an empty group is hidden. Search covers map/lot, address, owner, and permit number and is debounced in the browser. Capture detail shows attachments, parcel resolution for needs_match captures, review controls, and audit events. Terminal captures show their disposition without further controls. Admin routes provide towns, parcels/CSV import, and API-key management.

The end-to-end acceptance check uploads a synthetic photo, submits a capture, lists and reads it back, confirms the audit event, and prints the stored identifiers:

Terminal window
pnpm test:acceptance

Planning uses OpenSpec, pinned as a root dev dependency. Project-scoped skills live in .agents/skills/ so OpenCode and other supported agents pick up the same workflows from the repository. The project configuration is in openspec/config.yaml.

The default loop is:

  1. Explore the idea: /openspec-explore
  2. Draft the plan: /openspec-propose <change-name>
  3. Review and correct the artifacts in openspec/changes/<change-name>/
  4. Implement: /openspec-apply-change <change-name>
  5. Archive: /openspec-archive-change <change-name>

The /openspec router accepts any of these requests in plain language. Specs for implemented behavior accumulate in openspec/specs/; active and archived changes live under openspec/changes/.

Use the pinned CLI so skills and validation match the repository:

Terminal window
pnpm exec openspec list
pnpm exec openspec update # refresh skills after a CLI upgrade

Restart or reload your agent session after openspec init/update so it discovers new skills. Contributors should commit refreshed skills with their changes.

apps/
api/ Hono API on Cloudflare Workers (adapter entry)
api-node/ Self-host Node adapter (SQLite/Postgres, S3-compatible storage)
docs/ Astro + Starlight public documentation site
web/ React + Vite reviewer inbox
packages/
api/ Runtime-neutral Hono routes and middleware
capture-schema/ Zod contracts shared by the API and web app
contract-tests/ Shared hosted/self-host API contract suite
core/ Portable domain use cases and repository ports
test-fixtures/ Synthetic tenants, towns, parcels, and images
.agents/skills/ Project-scoped OpenSpec workflow skills
openspec/
config.yaml Project context and artifact rules for OpenSpec
specs/ Implemented behavior contracts
changes/ Active and archived change plans
infra/
cloudflare/ D1/R2 provisioning notes and SQL migrations
docker/ Docker, compose, and self-host packaging
docs/
adr/ Architecture decision records
brand/ Commitment Desk identity and palette anchors
api/ Exported OpenAPI documentation (future)
operations/ Self-hosting, backup, and restore guides
security/ Threat model and data handling
scripts/ Seed and demo clients (M4)

The open-source core is licensed under the Apache License 2.0. See NOTICE for attribution and TRADEMARKS.md for the name and logo policy. Hosted services, integrations, support, and custom work are commercial offerings and live outside this repository.