ADR-0002 — Monorepo for backend, clients, contracts, and ops

Context

BitVault spans Go services + CLI, a Next.js web app, a future RN app, protobuf contracts, SQL migrations, and deployment artifacts. These change together: a node-schema change touches the proto, the service, the event, the consumers, the REST mapping, the web client, and the docs. The team is small. Contract drift between API producer and consumers (R8) is a top risk.

Decision

Use a single monorepo containing backend (internal/, cmd/, pkg/), contracts (proto/, gen/), clients (apps/web, apps/mobile), ops (deploy/, migrations/), tests, and docs.

Tooling: Go workspaces (go.work) for Go modules; a JS monorepo tool (pnpm workspaces + Turborepo) for apps/*; buf for protobuf lint + codegen; a single task runner (Taskfile.yml); path-scoped CI so unaffected components don’t rebuild.

Consequences

Positive

Negative / costs

Alternatives considered