Architecture
Service topology and ports: Service Catalog; database
topology (isolated vs --shared-db) and deployment profiles:
Deployment Guide; the event bus and outbox:
ADR-018; shared crates:
Shared Crates Reference. This page is a bounded
architecture overview — it must not re-accrete the full catalog.
For a new contributor, maintainer or agent orienting in the codebase: this page is the short architecture narrative plus the ADR number-to-topic index; each row links the record that owns the detail.
Canopy is a Rust workspace — the services under services/ and the shared crates under crates/ ([workspace] members in Cargo.toml) — implementing an integrated eligibility system for Georgia DHS (SNAP, TANF, Medicaid/CHIP, CAPS, WIC). Four founding decisions shape everything else: each program service owns its PostgreSQL database and never reads another’s (ADR-001); program services answer only with signed determinations, never raw eligibility data (ADR-002); eligibility logic is data in versioned JDM rulesets, not Rust (ADR-003); legally restricted data classes stay inside the services authorized to hold them (ADR-004). Services talk over HTTP, each call carrying a token canopy-identity minted for its receiver (ADR-049), and publish events through a per-service transactional outbox to the RabbitMQ topic exchange canopy.events (canopy_mq::EVENTS_EXCHANGE). ADRs live at docs/modules/ROOT/pages/adrs/adr-{NNN}-*.adoc; an Accepted Decision is immutable — later change is a dated amendment or a superseding ADR.
ADR index (number → topic)
-
ADR-001 — Program service isolation: one PostgreSQL database per program service, no cross-program reads (Amendment 1: the sanctioned bulk-read contracts).
-
ADR-002 — Black-box determination contract: program services return signed JWS determinations, never raw data (Amendment 1: the async/bulk variant).
-
ADR-003 — Ruleset-as-data: eligibility logic in versioned JDM files evaluated by canopy-rules.
-
ADR-004 — Legally-scoped data tenancy: FTI / IEVS / SSA / FDSH data isolated to authorized services (amended by ADR-014 and ADR-041).
-
ADR-005 — Modular deployment profiles: a Compose profile selects the program subset.
-
ADR-006 — Jurisdiction-agnostic rulesets: federal parameters + per-jurisdiction rules +
jurisdiction.toml. -
ADR-007 — CLI/API/UI parity: every API operation has a
canopyCLI subcommand (Amendment 4: canopy-cli signs in with canopy-identity’s device flow). -
ADR-008 — Applicant portal architecture: a Dioxus fullstack BFF.
-
ADR-009 / ADR-026 — PostgreSQL-backed sessions for canopy-web, in its own tables written one named statement at a time, so a sign-out is final (Amendment 2, #2518); the applicant portal is Postgres-free, with Redis-primary sessions and client-encrypted drafts.
-
ADR-010 / ADR-029 — Typst document generation; the general signed-document renderer.
-
ADR-011 — Policy-to-rules traceability:
citations.tomlfrom every ruleset value to its source. -
ADR-012 / ADR-017 — Layered YAML configuration; SOPS + age-encrypted secrets at rest (ADR-017 Amendment 3: canopy-identity client keys are reserved secrets).
-
ADR-013 — Plan lifecycle and Status vocabulary (
cargo xtask plan-lint). -
ADR-014 — FTI audit hash-chain integrity (amends ADR-004); superseded by ADR-041 (Amendment 12) — the chain-v2 lineage of Amendments 5–11 retires behind #1304.
-
ADR-015 — Containerized integration tests: the in-network runner behind
cargo xtask test --integration. -
ADR-016 — Forward-only schema migrations.
-
ADR-018 / ADR-039 — Persistent per-service event outbox; the single-source outbox schema and first-class event hold.
-
ADR-019 / ADR-037 — the identity-service contract for workers and services, now canopy-identity’s system tokens and onward delegation (ADR-019 Amendment 3); service-token acquisition, now the sender’s bounded cache and one resend after a receiver refuses the bearer (ADR-037 Amendment 2).
-
ADR-020 — Cross-process chaos observability via in-process production fixtures (
canopy_test_lib::chaos). -
ADR-021 / ADR-022 / ADR-024 — Worker-portal composability: plugin model, override storage layering, user-layer delta schema.
-
ADR-023 / ADR-043 — token validation at every service and citizen-upload isolation; the program amendments (citizen-path credential, the frozen 401/403 contract). Both hold on canopy-identity (ADR-023 Amendment 1, ADR-043 Amendment 3).
-
ADR-025 — Cross-service referential integrity at the HTTP boundary (
cargo xtask seed-verify). -
ADR-027 / ADR-028 — Worker fact authoring with provenance and valid-time versioning; the determination input snapshot.
-
ADR-030 — Code-quality gating: the enforced lint posture and the
quality-budgetsdebt ratchet. -
ADR-031 / ADR-032 — Policy coverage assurance; the two-tier scenario corpus.
-
ADR-033 / ADR-034 / ADR-035 — Generative seed harness; per-program and per-subject determination context mapping.
-
ADR-036 — Crypto-shred redaction and signing-key retention (
canopy-crypto-shred). -
ADR-038 — Concurrency-safe, recoverable applicant finalization (the finalize saga).
-
ADR-040 — Build-once, gate-complete artifact promotion.
-
ADR-041 — Configurable structured logging + jurisdiction-owned field redaction (supersedes ADR-014’s chain; amends ADR-004).
-
ADR-042 — Upload scan quarantine: clamd backend, async promotion, content-identity-bound verdicts.
-
ADR-044 — Worker program scope is a required IdP claim (
primary_programs), projected at federation (Amendment 2). -
ADR-045 — Blind-broker exchange partner-evidence architecture (consumes the Gateway partner catalog).
-
ADR-046 — Worker directory: canopy-security host, JIT population from observed sign-ins, keyed on canopy subjects (Addendum 3).
-
ADR-047 — Devstack image build strategy: BuildKit cache mounts as the terminal state.
-
ADR-048 — OIDC-only identity: SAML and LDAP brokered upstream; its one-issuer rule restated per layer, one upstream at the edge and canopy-identity inside, with the claim contract at federation (Amendment 1); Kanidm, Keycloak and ZITADEL the supported set (Amendment 2).
-
ADR-049 — Identity plane split, effective 2026-10-12: canopy-identity (hosted in canopy-security) issues every internal token — per-hop user delegation and purpose-scoped system tokens; the IdP only signs workers in (Amendment 25: the switch, as built; Amendment 26: Keycloak and ZITADEL as alternative upstreams, as built).
-
ADR-050 — Kanidm is the default upstream identity provider (ZITADEL and Keycloak tested alternatives); IdP profiles are deployment configuration (Amendment 1: Kanidm’s code reuse and whole-second refresh-replay rule, exercised; Amendment 2: the TLS trust-anchor bundle replaces the built-in roots; Amendment 3: the
kanidmprofile verified through canopy-identity’s upstream path; Amendment 4: the web-session rules run on the lane’s real tokens; Amendments 5 and 6: thekeycloakandzitadelprofiles verified, ZITADEL’s ignoredmax_ageon record; Amendment 7: the three upstreams verified again at Kanidm 1.12.2, Keycloak 26.8.2 and ZITADEL v4.21.0). -
ADR-051 — configuration is a git source: a deployment’s federal, jurisdiction and deployment layers come from signed config repos, which canopy’s own fetcher verifies and publishes; every service loads one snapshot at boot and every determination carries its layer SHAs (plan config-git-source, #3254).
-
ADR-052 — jurisdiction extension modules: a state whose approved waiver needs machinery a pack cannot express ships one sandboxed WebAssembly bundle in its configuration layer; the service it extends calls it at named extension points and records it on every determination it affects (ADR-052).
-
ADR-053 — database degradation posture: every service bounds its statements (30 s by default, set per transaction by long jobs), and a pool timeout (503 with
Retry-After), a statement timeout (504) and a commit whose outcome is unknown (a coded 500) each get a distinct typed answer. -
ADR-054 — a TANF determination is the pack's: canopy-tanf supplies per-person facts and the joins between members, and four decisions the pack carries decide the assistance unit, the counted income, eligibility and the grant against standards and values the pack names.
-
ADR-055 — a counted TANF month is a ledger row: a daily job in canopy-tanf counts each ended month from the approved determination in force at its end, for the unit's head and spouse when federal funds pay the grant (45 CFR 264.1), and a worker records the months that do not count (ADR-055).
The complete list, with titles, is in the site navigation under Reference › ADRs.
Service topology at a glance
-
Infrastructure services share the
postgrescontainer (container port 5432): rules, persons, applications, eligibility, verification, enrollment, renewals, notices, exchange, appeals, reporting, security, plus thecanopy_webBFF database — the thirteendevstack/postgres/init.sqlcreates. The applicant portal is Postgres-free (ADR-026) and has no database. -
Program services (ADR-001) each run their own
postgres-<program>container — snap, tanf, medicaid, caps, wic — on container port 5432; the compose fallback host ports are 5433–5437 (PORT_MAPPINGSinxtask/src/docker.rs).--shared-dbcollapses them onto the shared instance (Deployment Guide › data tier). -
BFFs: canopy-web (worker portal, Axum + Askama) and canopy-portal (applicant portal, Dioxus per ADR-008).
-
Container ports are fixed per service; under
cargo xtask devevery host port is OS-ephemeral and published in.ports.env—cargo xtask dev statusprints the live table (Service Catalog).