AT Protocol-native mutual aid platform with a web client, query API, ingestion/indexing pipeline, and moderation worker.
This monorepo is designed for fast local development with deterministic fixtures, strong type contracts, and CI quality gates.
apps/web— Vite + React + TypeScript + Tailwind frontendservices/api— HTTP API for query/chat/volunteer flowsservices/indexer— ingestion + indexing serviceservices/moderation-worker— moderation/trust-safety workerpackages/shared— shared contracts, config/env schemas, utilitiespackages/at-lexicons— AT lexicon schemas, fixtures, and validators
- Patchwork Web — client (
patchwork-web) - Patchwork API — query + auth (
patchwork-api) - Spool — ingestion + queueing (
patchwork-spool) - Quilt — indexing + search layer (network alias on
patchwork-spool:patchwork-quilt) - Stitch — chat service (network alias on
patchwork-api:patchwork-stitch) - Thimble — moderation worker (
patchwork-thimble)
- Node.js + TypeScript (monorepo workspaces)
- React + Vite + Tailwind (web)
- Vitest + Playwright (unit + browser E2E)
- Optional local Postgres for API datasource mode
- Node.js
>=20.19.0 - npm
- Docker (only needed for Postgres mode)
- Install dependencies:
npm ci - Create local env file: copy
.env.example→.env - Start the app surfaces you need:
- Web:
npm run dev:web - API:
npm run dev:api - Indexer:
npm run dev:indexer - Moderation worker:
npm run dev:moderation
- Web:
Default local URLs:
- Web:
http://localhost:5173 - API health:
http://localhost:4000/health - Indexer health:
http://localhost:4100/health - Moderation health:
http://localhost:4200/health
The API supports two datasource modes:
fixture(default): deterministic in-memory data for local developmentpostgres: local DB-backed mode for integration testing
- Start Postgres:
npm run db:up - Set in
.env:API_DATA_SOURCE=postgresAPI_DATABASE_URL=postgresql://patchwork:patchwork@localhost:5432/patchwork
- Seed deterministic data:
npm run db:seed - Start API in postgres mode:
npm run dev:api:postgres
The web client now calls API routes directly for discovery + posting surfaces:
GET /query/mapGET /query/feedGET /query/directoryGET /aid/post/create
Recommended local flow:
- Start Postgres:
npm run db:up - Seed Postgres:
npm run db:seed - Start API in postgres mode:
npm run dev:api:postgres - Start web:
npm run dev:web
In the UI, route headers show a data source badge:
- DB-backed API when remote query succeeds
- Fallback dataset when API is unavailable (network-safe local fallback)
Posting behavior in DB mode:
Publish requestcallsGET /aid/post/create- On success, the created post is inserted into Postgres and becomes immediately queryable via
/query/feedand/query/map
Additional seed scripts (API workspace):
- Append mode:
npm run db:seed:append -w @patchwork/api - Phase 3 fixtures only:
npm run db:seed:phase3 -w @patchwork/api
Stop Postgres when done: npm run db:down
- Lint:
npm run lint - Typecheck:
npm run typecheck - Unit tests:
npm run test - Moderation/privacy regression suite:
npm run test:phase7 - End-to-end contract flow:
npm run test:phase8-e2e - Browser E2E (web):
npm run test:e2e -w @patchwork/web - Build all workspaces:
npm run build - Combined local gate:
npm run check
The production compose stack is defined in docker-compose.yml.
- Caddy route host:
https://patchwork.subcult.tv - Shared Docker network:
web(external) - Internal service network:
internal
Services:
patchwork-web(nginx serving built Vite app)patchwork-apipatchwork-spool(also aliased aspatchwork-quilt)patchwork-thimblepatchwork-postgres
Monitoring:
- Prometheus scrapes
/metricsfrom API, Spool, and Thimble jobs via the shared network.
docs/architecture/domain-map.mddocs/architecture/service-boundaries.mddocs/architecture/adr/0001-v1-stack-and-domain-boundaries.mddocs/at-protocol/README.mddocs/at-protocol/identity-session.mddocs/at-protocol/lexicon-versioning.mddocs/at-protocol/tombstone-contract.mddocs/quality-gates.md
- Keep cross-service contracts in
packages/shared. - Prefer deterministic fixtures in tests.
- Treat geoprivacy/moderation regressions as release blockers.