Skip to content

Entities

Entity modules live in packages/db/src/entities/<domain>/<entity>/.

This is the main architectural unit of @life-manager/db. Each entity owns its types, schema, query hooks, actions, raw mutations, mutation hooks, guards, and workflows.

query state
-> build operation input
-> workflow resolution
-> mutation enforcement
-> raw mutation
-> local DB write

That pipeline is what the rest of this section explains.

  • appointment
  • folder
  • project
  • time-entry
  • time-tracker
  • bank-account
  • contact
  • finance-project
  • payout
  • project-adjustment
  • recurring-cashflow
  • single-cashflow
  • tag
  • notification
  • profile
  • settings

Every entity is expected to follow the same conceptual shape, even if the logic is trivial.

  • guards define domain truth
  • workflows convert that truth into typed UI next steps
  • actions build live inputs from query state and orchestrate interactions
  • use-*-mutations enforce hard invariants before writing
  • raw mutations stay low-level and transaction-oriented

Simple entities do not get a different architecture. They get a simpler implementation of the same architecture.

The strongest current examples are:

  • finance/single-cashflow
  • finance/recurring-cashflow
  • work/time-entry
  • work/project

See Reference Entities for what each one demonstrates.