← All decisions

pnpm monorepo with apps/* and packages/*

accepted

0001 — pnpm monorepo with apps/* and packages/*

Context

Ark is one codebase serving N tenants across three deployable surfaces (public site, admin portal, API). The codebase will share substantial logic between surfaces (auth, permissions, CMS reads, types, config schemas). Cross-cutting changes — most notably “add organization_id to every table and propagate through every layer” — must land atomically.

We’re also optimizing for AI agents to do non-trivial work. Agents are most productive when they can see the entire system in one tree without fetching from N remotes.

Decision

A single git repository with pnpm workspaces. Layout: apps/{api,admin,site} (deployable surfaces) + packages/* (shared libraries) + supabase/migrations (CLI-managed migrations, see ADR 0012) + tenants/* (per-tenant config) + docs/.

pnpm specifically: workspaces are first-class, install is fast, --filter semantics are clean for CI partitioning, and the lockfile reliably reflects what’s installed (npm’s lockfile drift has burned us before in internalize).

Consequences

Easier:

Harder:

Revisit if: install times exceed 90s on developer machines, or if the consulting agency wants to fork-and-modify ark for one of their clients (then we need a “ship a snapshot” story).

Alternatives considered