System Model: Foundation Layer

Table of Contents

This page is part of the System Model. Foundation is the bedrock of the system — every component here could in principle be extracted as a standalone library because it has no ORE Studio domain dependency. The dependency chain is a single path: utility → platform → logging → telemetry → database; no component in this layer loops back. See Shared Library Symbol Visibility for how symbols are exported across Foundation shared libraries.

1. Detail

1.1. ores.utility

Primitive helpers with no internal dependencies: UUID v7 generation, Base64/Base32 encoding, string conversion, datetime helpers, faker utilities, and the wire codecs. The lowest point in the dependency graph — nothing in Foundation depends on anything below it.

Sub-component Role Dependencies
ores.utility Shared primitive helpers and reflectors —

1.2. ores.platform

Filesystem utilities, environment variables, network info (hostname, MAC, machine ID), and cross-platform time utilities. Wraps OS-specific behaviour so every component above it can target the same API.

Sub-component Role Dependencies
ores.platform OS abstraction — filesystem, env, network ores.utility

1.3. ores.logging

Core Boost.Log infrastructure — the make_logger() factory, severity levels, and a lifecycle manager for console and file sinks. Extracted from ores.telemetry to break the circular dependency that would otherwise form between logging and ores.database.

Sub-component Role Dependencies
ores.logging Boost.Log factory, sinks, lifecycle ores.platform

1.4. ores.telemetry

Extends logging with distributed tracing (trace_id, span_id), OpenTelemetry integration, JSON Lines log export, and service identity. The split into three sub-components reflects the layered dependency: .core extends the logger, .database persists spans to PostgreSQL, .service manages identity and lifecycle initialisation.

Sub-component Role Dependencies
ores.telemetry.core Tracing extensions, OTel integration ores.logging, ores.platform
ores.telemetry.database Span persistence to PostgreSQL ores.telemetry.core, ores.database
ores.telemetry.service Service identity, lifecycle manager ores.telemetry.core

1.5. ores.database

PostgreSQL access layer — connection pool, tenant/party context, bitemporal CRUD helpers, repository mapper helpers, a health monitor, and LISTEN/NOTIFY integration. All domain services build on this component to access their isolated tables. A simple component with no sub-parts. It is hand-written infrastructure with no codegen entity model, and it owns the bootstrap table ores_database_info_tbl that records the checkout which built the database.

Component Role Dependencies
ores.database PostgreSQL connection pool, bitemporal CRUD ores.logging, ores.platform

1.6. ores.variability

Feature flags and runtime configuration management, published via the variability.v1. ores.nats namespace. Consumers read flags without polling the database; the service propagates changes so flag updates are visible system-wide without a restart.

Sub-component Role Dependencies
ores.variability.api Shared flag types and NATS protocol —
ores.variability.core Flag evaluation and caching ores.variability.api, ores.database
ores.variability.service ores.nats flag publisher ores.variability.core, ores.nats

1.7. ores.geo

IP-to-country lookup using ip2country ranges stored in PostgreSQL. Answers a country code only; city and coordinate data are not available. ores.http calls it from its login route.

Sub-component Role Dependencies
ores.geo IP-to-country lookup via ip2country ores.database

1.8. ores.sql

PostgreSQL schema, migration scripts, role provisioning, and database lifecycle management for the entire system. Each service role holds DML only on its own ores_<service>_* tables — cross-service reads inside triggers use SECURITY DEFINER; cross-service writes go through ores.nats.

Sub-component Role Dependencies
ores.sql Schema, migrations, role provisioning —

Related documents:

1.9. ores.security

Shared cryptographic primitives — scrypt password hashing, AES-256-GCM encryption, JWT parsing and validation, OWASP password and email validators. Used by ores.iam for credential handling.

Sub-component Role Dependencies
ores.security Cryptographic primitives and validators ores.utility

1.10. ores.orgmode

Parses the subset of org-mode this project's docs use — frontmatter keywords, property drawers, headings, paragraphs, lists, tables, and id: links — into a C++ document structure, and resolves those links against the org-roam SQLite index that compass builds. A pure C++ library, consumed by ores.shell.

Sub-component Role Dependencies
ores.orgmode Org-mode parsing and org-roam link resolution —

1.11. ores.codegen

Code generation utility for domain types and documentation — driven by ores.codegen.json stencil files to produce boilerplate C++ and org-mode scaffolding. Also the engine behind the compass CLI tool.

Sub-component Role Dependencies
ores.codegen Stencil-driven C++ and org-mode code gen ores.utility
  • Tooling Layer — ores.codegen and ores.compass in their developer-tooling context.

2. See also

Emacs 29.3 (Org mode 9.6.15)