OpenFief Give your AI agents a fief, not the kingdom.

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.

cmd

demo

identity

ingest

jurisdiction/pl

kernel

ledger

plugins

portfolio

sdk

valuation

views

cmd

demo

identity

ingest

jurisdiction/pl

kernel

ledger

plugins

portfolio

sdk

valuation

views

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/kube imports sdk/go/openfief: a context imports another context’s tool package
  • internal/ingest/connectrpc imports sdk/go/gen/openfief/connector/v1/connectorv1connect: a context imports another context’s tool package
  • internal/ingest/connectrpc imports sdk/go/gen/openfief/connector/v1: a context imports another context’s tool package
  • internal/ingest/delivery imports sdk/go/gen/openfief/connector/v1: a context imports another context’s tool package
  • internal/valuation/postgres imports internal/ledger/app: a context imports another context’s app package
  • internal/views/app imports internal/ledger/app: a context imports another context’s app package
  • internal/views/app imports internal/valuation/app: a context imports another context’s app package
  • internal/views/connectapi imports internal/ledger/app: a context imports another context’s app package
  • internal/views/connectapi imports internal/valuation/app: a context imports another context’s app package
  • internal/views/connectapi imports sdk/go/gen/openfief/views/v1/viewsv1connect: a context imports another context’s tool package
  • internal/views/connectapi imports sdk/go/gen/openfief/views/v1: a context imports another context’s tool package

Packages#

cmd#

PackageLayerFilesTest filesSummary
cmd/corebinary63Command core is OpenFief’s core service (docs/DESIGN.md D-2): the system of record.
cmd/demo-seedbinary52Command 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-proxybinary10Command 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/operatorbinary11Command 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-rootbinary10Command 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#

PackageLayerFilesTest filesSummary
internal/demodomain150Package 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#

PackageLayerFilesTest filesSummary
internal/identitydomain20Package identity is the identity bounded context: who may use OpenFief.
internal/identity/appapp20Package app holds the identity context’s use cases: issuing, verifying, revoking and listing script tokens (docs/DESIGN.md D-27).
internal/identity/kubeadapter10Package kube is the identity context’s Kubernetes adapter.
internal/identity/postgresadapter30Package 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#

PackageLayerFilesTest filesSummary
internal/ingestdomain70Package 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/appapp40Package 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/connectrpcadapter21Package 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/deliveryadapter10Package 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/ibkrflexadapter90Package 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/kubeadapter10Package 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/postgresadapter30Package 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#

PackageLayerFilesTest filesSummary
internal/jurisdiction/pldomain60Package 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#

PackageLayerFilesTest filesSummary
internal/kerneldomain70Package kernel is the shared kernel of the bounded contexts: exact decimal numbers, currencies, money, quantities and calendar dates.

ledger#

PackageLayerFilesTest filesSummary
internal/ledgerdomain100Package 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/appapp80Package 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/postgresadapter71Package 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#

PackageLayerFilesTest filesSummary
internal/pluginsdomain160Package 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/appapp20Package app holds the plugins context’s use cases and the ports they consume.
internal/plugins/catalogadapter10Package 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/cosignadapter42Package 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/egressadapter10Package egress holds the egress proxy’s destination checks that need net/netip, which the domain packages may not import.
internal/plugins/kubeadapter20Package 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/operatoradapter100Package 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/v1alpha1adapter30Package v1alpha1 is the openfief.io/v1alpha1 API of the plugin operator: the Plugin and PluginGrant custom resources (D-13, D-16).
internal/plugins/smokescreenadapter10Package 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-flextool21Command 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-fxtool22Command 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#

PackageLayerFilesTest filesSummary
internal/portfoliodomain30Package portfolio is the portfolio bounded context.

tools#

PackageLayerFilesTest filesSummary
tools/docgentool93Command 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#

PackageLayerFilesTest filesSummary
internal/valuationdomain50Package valuation holds prices, FX rates to PLN and valuations of holdings, as pure values and functions.
internal/valuation/appapp60Package app holds valuation’s use cases and the ports they consume.
internal/valuation/nbpadapter10Package 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/postgresadapter70Package 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#

PackageLayerFilesTest filesSummary
internal/viewsdomain40Package 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/appapp40Package 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/connectapiadapter60Package 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.

Generated from the repository at build time; it cannot go stale.