Skip to content

Exposed

Exposed is the SQL framework used by every Arda backend service for PostgreSQL persistence. It is chosen for its idiomatic Kotlin DSL, type safety, and explicit transaction scoping — properties that align with Arda’s bitemporal persistence model and AppError contract.

  • Version: 0.60.0.
  • Database: PostgreSQL (production); ContainerizedPostgres test fixture for unit/integration tests.
  • Repositories: operations/, accounts-component/, common-module/ (shared Table definitions and converters).
  • DAO layer is not used. Exposed’s “DSL” API is the only API in use. Per-table Table objects describe schema; queries use select, insert, update against those.
  • Transactions are explicit. Every database access is wrapped in a transaction(database) { ... } block at a well-defined boundary (typically a use case or service method). No implicit “request transaction”.
  • Bitemporal columns (valid_from, valid_to, tx_from, tx_to) are part of every business-state table. See Bitemporal Persistence.
  • Schema migrations are owned by Flyway, not Exposed. Exposed describes the current schema; Flyway migrations under db/migration/ evolve it.
  • Error handling: SQL errors are caught at the boundary and mapped to the AppError sealed hierarchy. See Exception Handling.
  • The kotlin-coding skill — Result handling and AppError patterns applied at every Exposed boundary.
  • The unit-tests-infra skill — ContainerizedPostgres and the Harness pattern for database-backed tests.
  • Data Authority Pattern — module boundary rules around shared tables.