> ## Documentation Index
> Fetch the complete documentation index at: https://cona.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture Overview

> Map of CONA's architecture diagrams, organised as C4 levels from system context down to component detail

# Architecture Overview

This section is the visual reference for how CONA is built. Diagrams are organised
as [C4 levels](https://c4model.com/): each level zooms in one step, so you can stop
at the depth you need.

<Note>
  Every diagram in this section is derived from the code, not from intent. Edges are verified
  against actual imports and call sites. If a diagram disagrees with the code, the diagram is the
  bug — see [Conventions](/architecture/conventions).
</Note>

The set is complete: **20 diagram pages, 43 diagrams**, every one validated against
Mermaid's parser, measured for legibility at the docs column width, and traced back to
source files.

## How to read this section

| Level               | Question it answers                                    | Audience                   |
| ------------------- | ------------------------------------------------------ | -------------------------- |
| **L1 — Context**    | What is CONA, who uses it, what does it talk to?       | Everyone                   |
| **L2 — Containers** | What are the deployable units and how do they connect? | Engineers, infra, auditors |
| **L3 — Components** | What is inside each unit and how does it work?         | Engineers                  |

## L1 — Context

<CardGroup cols={2}>
  <Card title="System Context" icon="globe" href="/architecture/system-context">
    The single high-level picture: users, applications, infrastructure, and external providers.
  </Card>

  <Card title="Data Flows & Trust Boundaries" icon="shield" href="/architecture/data-flows-trust-boundaries">
    Where customer and financial data travels, which boundaries it crosses, and which subprocessors
    touch it.
  </Card>
</CardGroup>

## L2 — Containers

<CardGroup cols={2}>
  <Card title="Deployment Topology" icon="server" href="/architecture/deployment-topology">
    Vercel, Fly.io, Temporal Cloud, Supabase, and Redis — what runs where.
  </Card>

  <Card title="Package Graph" icon="boxes" href="/architecture/package-graph">
    The monorepo's applications and packages, their real dependency edges, and the layering rules.
  </Card>
</CardGroup>

## L3 — Applications

<CardGroup cols={2}>
  <Card title="Webapp" icon="layout-dashboard" href="/architecture/webapp-architecture">
    Route groups, server actions, library layers, and API ingress.
  </Card>

  <Card title="Portal" icon="external-link" href="/architecture/portal-architecture">
    The customer-facing document portal.
  </Card>

  <Card title="Console" icon="settings" href="/architecture/console-architecture">
    The superadmin console.
  </Card>

  <Card title="Temporal Workers" icon="cpu" href="/architecture/temporal-workers-architecture">
    Worker bootstrap, task queues, and activity registration.
  </Card>
</CardGroup>

## L3 — Business domains

<CardGroup cols={2}>
  <Card title="Core Domain Map" icon="package" href="/architecture/core-domain-map">
    The domains inside `@cona/core`, grouped into bounded contexts.
  </Card>

  <Card title="Accounting Engine" icon="calculator" href="/architecture/accounting-engine">
    Posting matrix, rules engine, general ledger, job queue, and periods.
  </Card>

  <Card title="Document Lifecycle" icon="file-text" href="/architecture/document-lifecycle">
    From creation through formats and delivery to the customer portal.
  </Card>

  <Card title="Reconciliation & Payments" icon="scale" href="/architecture/reconciliation-payments">
    Payment matching, bank handoffs, and the reconciliation agent.
  </Card>

  <Card title="Data Model" icon="database" href="/architecture/data-model">
    The Prisma schema as domain clusters rather than one diagram.
  </Card>
</CardGroup>

## L3 — Cross-cutting concerns

<CardGroup cols={2}>
  <Card title="Integrations & Adapters" icon="plug" href="/architecture/integrations-adapters">
    The adapter registry and every external provider CONA syncs from.
  </Card>

  <Card title="Ingress: OAuth & Webhooks" icon="webhook" href="/architecture/ingress-oauth-webhooks">
    How external systems get in — callbacks, webhooks, and the public API.
  </Card>

  <Card title="Temporal Orchestration" icon="workflow" href="/architecture/temporal-orchestration">
    Workflow to activity to core call chains, retries, and schedules.
  </Card>

  <Card title="Auth, Tenancy & Actors" icon="lock" href="/architecture/auth-tenancy-actors">
    Auth0, organisation isolation, and mutation attribution.
  </Card>

  <Card title="Observability" icon="activity" href="/architecture/observability">
    Axiom pipelines, OpenTelemetry, Sentry, and sampling.
  </Card>

  <Card title="Redis Caching" icon="zap" href="/architecture/redis-caching">
    Cache key model, version prefixing, counters, and locks.
  </Card>

  <Card title="Copilot Agents" icon="bot" href="/architecture/copilot-agents">
    Mastra, the CopilotKit runtime, and agent tooling.
  </Card>
</CardGroup>

## Related reading

* `CODEBASE_MAP.md` at the repository root — text-first navigation of the same territory
* [Temporal Workflow Architecture](/core-cona-logic/temporal-workflow-architecture) — deeper narrative on the ingestion and accounting phases
* [Core Principles](/development-setup/core-principles) — the rules these diagrams should reflect
