Code map
Every Go package as built, grouped by bounded context, with the dependencies between contexts drawn from the imports.
Generated from go list on every build. Compare the diagram with the designed context map in code-organization.md: an arrow there that is missing here is not built yet, and an arrow here that is missing there needs a decision.
Contexts#
An arrow means at least one package of the first context imports a package of the second. Arrows into the shared kernel are dashed.
Layering check#
The rules of code-organization.md: domain packages import only domain packages, app packages never import adapters, and no context imports another context’s app or adapters. Only cmd wires adapters together.
internal/identity/kubeimportssdk/go/openfief: a context imports another context’s tool packageinternal/ingest/connectrpcimportssdk/go/gen/openfief/connector/v1/connectorv1connect: a context imports another context’s tool packageinternal/ingest/connectrpcimportssdk/go/gen/openfief/connector/v1: a context imports another context’s tool packageinternal/ingest/deliveryimportssdk/go/gen/openfief/connector/v1: a context imports another context’s tool packageinternal/valuation/postgresimportsinternal/ledger/app: a context imports another context’s app packageinternal/views/appimportsinternal/ledger/app: a context imports another context’s app packageinternal/views/appimportsinternal/valuation/app: a context imports another context’s app packageinternal/views/connectapiimportsinternal/ledger/app: a context imports another context’s app packageinternal/views/connectapiimportsinternal/valuation/app: a context imports another context’s app packageinternal/views/connectapiimportssdk/go/gen/openfief/views/v1/viewsv1connect: a context imports another context’s tool packageinternal/views/connectapiimportssdk/go/gen/openfief/views/v1: a context imports another context’s tool package
Packages#
cmd#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
cmd/core | binary | 6 | 3 | Command core is OpenFief’s core service (docs/DESIGN.md D-2): the system of record. |
cmd/demo-seed | binary | 5 | 2 | Command demo-seed loads the demo dataset (internal/demo) into an OpenFief database, through the same paths real data takes: the IBKR history through the ibkrflex connector and the ingest service, the other accounts through the ledger’s API, prices, FX rates, CPI and bond terms through valuation’s input recorder, and the stored valuations through the River revaluation queue (D-36). |
cmd/egress-proxy | binary | 1 | 0 | Command egress-proxy is OpenFief’s egress proxy (D-32, D-63): Smokescreen, embedded in OpenFief’s own HTTP server, with plugin identity from projected ServiceAccount tokens (audience openfief-egress) checked by TokenReview and cached, and per-plugin egress allow-lists from the operator’s ConfigMap. |
cmd/operator | binary | 1 | 1 | Command operator runs OpenFief’s plugin operator (D-13): it reconciles the Plugin and PluginGrant resources of the openfief namespace, and only that namespace (D-15), into running, isolated plugins. |
cmd/sigstore-trusted-root | binary | 1 | 0 | Command sigstore-trusted-root fetches the Sigstore public-good trusted root (trusted_root.json) through TUF and writes it where the operator embeds it (D-56). |
demo#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/demo | domain | 15 | 0 | Package demo generates the demo dataset: a synthetic portfolio, about a year of its history and its valuation inputs, for showing OpenFief’s real pipelines working on fake data (GR-12). |
identity#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/identity | domain | 2 | 0 | Package identity is the identity bounded context: who may use OpenFief. |
internal/identity/app | app | 2 | 0 | Package app holds the identity context’s use cases: issuing, verifying, revoking and listing script tokens (docs/DESIGN.md D-27). |
internal/identity/kube | adapter | 1 | 0 | Package kube is the identity context’s Kubernetes adapter. |
internal/identity/postgres | adapter | 3 | 0 | Package postgres is the identity context’s store in PostgreSQL (docs/DESIGN.md D-14): an app.Store for script tokens (D-27) over a pgx pool, and Migrate, which creates and upgrades the identity schema from the SQL files embedded in migrations/. |
ingest#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/ingest | domain | 7 | 0 | Package ingest is the ingest bounded context: institutions, import batches, and the mapping of what a connector reads from an institution into ledger transactions, balance assertions and ingest problems (docs/DESIGN.md D-7, D-18, D-23). |
internal/ingest/app | app | 4 | 0 | Package app holds the ingest context’s use cases: running a connector’s ingest path, from a file or a pull, through its mapper into the ledger (D-7, D-18, D-23). |
internal/ingest/connectrpc | adapter | 2 | 1 | Package connectrpc calls connector plugins’ connector contract, openfief.connector.v1.ConnectorService, over Connect RPC (D-11, D-49): the core’s side of a plugin connector’s ingest path (D-7). |
internal/ingest/delivery | adapter | 1 | 0 | Package delivery is the connector side of the connector contract (D-49): it writes a connector’s mapping, FX rates and ingest mode as openfief.connector.v1 messages, the reverse of what the core’s internal/ingest/connectrpc reads. |
internal/ingest/ibkrflex | adapter | 9 | 0 | Package ibkrflex is the Interactive Brokers Flex Query connector’s adapter and anti-corruption layer: it parses a Flex Query XML statement (FlexQueryResponse > FlexStatements > FlexStatement) and translates IBKR’s sections into ledger transactions, balance assertions and ingest problems. |
internal/ingest/kube | adapter | 1 | 0 | Package kube is the ingest context’s Kubernetes adapter: Discovery finds the connector instances that run in the cluster (docs/DESIGN.md D-48, D-49) and the address of each one’s Service, by watching the operator’s Plugin resources and the Services it creates for them. |
internal/ingest/postgres | adapter | 3 | 0 | Package postgres is the ingest context’s store in PostgreSQL (docs/DESIGN.md D-14): the app.SyncStore that keeps each connector instance’s watermark, sync state and import batch history (D-49), and the app.BindingStore of connector bindings, over a pgx pool. |
jurisdiction/pl#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/jurisdiction/pl | domain | 6 | 0 | Package pl holds Polish jurisdiction rules as pure functions: retail treasury bond series and their statutory valuation, tax wrappers (IKE, IKZE), Belka tax on bond interest, and which NBP rate tax uses. |
kernel#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/kernel | domain | 7 | 0 | Package kernel is the shared kernel of the bounded contexts: exact decimal numbers, currencies, money, quantities and calendar dates. |
ledger#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/ledger | domain | 10 | 0 | Package ledger is the ledger bounded context: accounts, ledger accounts, transactions and their postings, instruments, holdings, lots and balance assertions (docs/DESIGN.md D-18, D-19, D-20, D-23). |
internal/ledger/app | app | 8 | 0 | Package app holds the ledger context’s use cases: registering sleeves and accounts, importing transactions and balance assertions into the append-only, versioned transaction log (docs/DESIGN.md D-18), and the queries the read API answers from it. |
internal/ledger/postgres | adapter | 7 | 1 | Package postgres is the ledger’s store in PostgreSQL (docs/DESIGN.md D-14): an app.Store over a pgx pool, and Migrate, which creates and upgrades the ledger schema from the SQL files embedded in migrations/. |
plugins#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/plugins | domain | 16 | 0 | Package plugins is the plugins bounded context: what a plugin requests (Plugin, Manifest), what the owner approved (Grant), what is enforced (EffectivePermissions, D-16), and how that compiles into a Workload: the domain description of a plugin’s NetworkPolicy, Secret mounts, RBAC, projected token and egress allow-list (D-11, D-27, D-32). |
internal/plugins/app | app | 2 | 0 | Package app holds the plugins context’s use cases and the ports they consume. |
internal/plugins/catalog | adapter | 1 | 0 | Package catalog is OpenFief’s plugin catalog (D-43): plugins.json, a file in this repository released with the product and embedded in the operator. |
internal/plugins/cosign | adapter | 4 | 2 | Package cosign checks plugin images in their registry (D-17, D-42, D-56): it finds an image’s cosign signatures, verifies them with sigstore-go against the bundled Sigstore trust root and the trust policy’s signers, and reads the image’s manifest label. |
internal/plugins/egress | adapter | 1 | 0 | Package egress holds the egress proxy’s destination checks that need net/netip, which the domain packages may not import. |
internal/plugins/kube | adapter | 2 | 0 | Package kube is the egress proxy’s Kubernetes adapter: it verifies plugin tokens with the TokenReview API (D-63) and follows the egress allow-list ConfigMap the operator writes (D-32). |
internal/plugins/operator | adapter | 10 | 0 | Package operator is the plugin operator’s Kubernetes adapter (D-13): it reconciles Plugin and PluginGrant resources in the openfief namespace (D-15) into each plugin’s ServiceAccount, config ConfigMap, Service, NetworkPolicy and Deployment, and publishes every running plugin’s egress allow-list in the plugins.EgressAllowListConfigMap ConfigMap for the egress proxy (D-32). |
internal/plugins/operator/v1alpha1 | adapter | 3 | 0 | Package v1alpha1 is the openfief.io/v1alpha1 API of the plugin operator: the Plugin and PluginGrant custom resources (D-13, D-16). |
internal/plugins/smokescreen | adapter | 1 | 0 | Package smokescreen is the egress proxy adapter: Stripe’s Smokescreen, embedded as a library through BuildProxy inside OpenFief’s own HTTP server (D-32, D-63). |
plugins/ibkr-flex | tool | 2 | 1 | Command ibkr-flex is OpenFief’s first-party Interactive Brokers Flex Query connector plugin (D-49): the core calls its Sync to pull the statement of the owner’s Flex Query from IBKR’s Flex Web Service, and its ImportFile to map an uploaded Flex statement, in the opening or transactions mode the call names (D-23). |
plugins/nbp-fx | tool | 2 | 2 | Command nbp-fx is OpenFief’s first-party NBP FX connector plugin (D-20, D-49): the core calls its Sync for the National Bank of Poland’s table A exchange rates to PLN since the previous sync. |
portfolio#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/portfolio | domain | 3 | 0 | Package portfolio is the portfolio bounded context. |
tools#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
tools/docgen | tool | 9 | 3 | Command docgen generates the docs site’s reference pages and checks that hand-written pages keep up with the code they cover (docs/dev/docs.md). |
valuation#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/valuation | domain | 5 | 0 | Package valuation holds prices, FX rates to PLN and valuations of holdings, as pure values and functions. |
internal/valuation/app | app | 6 | 0 | Package app holds valuation’s use cases and the ports they consume. |
internal/valuation/nbp | adapter | 1 | 0 | Package nbp is the default FX rate provider (D-20): an HTTP adapter for the National Bank of Poland’s public Web API that fetches table A, the daily average exchange rates, and maps it to valuation.FXRate. |
internal/valuation/postgres | adapter | 7 | 0 | Package postgres is the valuation context’s store and job queue in PostgreSQL (docs/DESIGN.md D-14, D-36): prices, FX rates, period index readings, bond series terms and tax wrappers; the stored valuations and each account’s valued-through date; and the River queue that revalues accounts. |
views#
| Package | Layer | Files | Test files | Summary |
|---|---|---|---|---|
internal/views | domain | 4 | 0 | Package views holds the pure rules behind the read API (docs/DESIGN.md D-6): paging transactions, totalling valuations per date, and the allocation the built-in UI charts (D-30), grouped by asset class, currency, institution or sleeve. |
internal/views/app | app | 4 | 0 | Package app holds the views context’s use cases: the queries the read-only /v1 API answers (docs/DESIGN.md D-6), composed from the ledger’s queries, the stored valuations and their status (D-36), and FX rates (D-20). |
internal/views/connectapi | adapter | 6 | 0 | Package connectapi serves the read API (docs/DESIGN.md D-6, D-50): the openfief.views.v1.ReadService defined in proto/openfief/views/v1, as Connect (and gRPC, gRPC-Web) for generated clients and, transcoded by Vanguard from the same handlers, as REST under /v1. |