Skip to main content

Core Domain Map

@cona/core holds the business logic: 57 domains, 517 files, roughly 100,000 lines.
Core is not a monolith behind one entry point. All 674 consumer imports go through subpaths — 541 via @cona/core/domains/* across 53 domains, 133 via named subpaths like /redis and /logger. The barrel export @cona/core is imported by nothing.

Bounded contexts

Six business contexts sitting on a foundation layer. The foundation domains are imported by almost everything, so their edges are drawn once here and omitted everywhere else. actors having the second-highest in-degree is the structural proof of the actor-attribution rule — nearly every domain that writes must resolve an actor first.

Business-to-business edges

Foundation targets removed so the real coupling is visible. Edge labels are import counts.
These cycles are real. documents ↔ accounting, documents ↔ reconciliation, and general_ledger ↔ reconciliation each have edges in both directions. Do not read this as a clean layered architecture — it is not one, and forcing the diagram into layers would misrepresent the code.

The accounting hub

One file joins five domains: services/create-accounting-impact.ts imports documents, general_ledger, deferred-revenue, entities, and gl_memo. It is the convergence point of the accounting engine and the reason services has an in-degree of 13 despite holding only 11 files. See Accounting Engine.

Domain sizes

The five largest warrant their own diagrams:

Entry points

packages/core/package.json declares 13 export entries including a ./domains/* wildcard. The most-imported single domain is documents (48), followed by integrations (34) and subsidiaries (32).

Notes

The barrel is dead code. packages/core/src/index.ts is 182 lines with 54 outgoing imports — the largest fan-out in the package — and nothing imports it. It is still built and published via the . export. A deletion candidate, once external consumers are ruled out. finapi is isolated but not dead. Zero in-degree and zero out-degree within core, yet 12 imports via the @cona/core/finapi subpath. A self-contained bank-connection module. Domain folders use mixed casing. snake_case (general_ledger, line_items, number_ranges) and kebab-case (deferred-revenue, payment-matching, document-format) both appear. The webapp action folders mirror the same split.