Entity model overview
The five registry types that constitute the Fabric ontology, and how they relate.
Fabric's "entities" are typed identifiers in registries, and a database row is a different thing entirely. Five registries make up the ontology surface:
| Registry | Holds | Source |
|---|---|---|
| Object types | PascalCase names (Order) | packages/platform/objects/index.ts |
| Subject types | Strings used by event subjectType | packages/platform/events/index.ts |
| Event types | PascalCase past-tense names | packages/platform/events/index.ts |
| Action IDs | <namespace>.<verb> strings | packages/platform/actions/index.ts |
| Policy IDs | <id>.v<version> strings | packages/platform/policies/index.ts |
A FabricModule populates these registries at app startup. Nothing else is allowed to write to them at runtime.
How they relate
Object types
A registered object type is a string the platform recognizes as a kind of entity, validated as PascalCase alphanumeric (/^[A-Z][a-zA-Z0-9]*$/). Every event's subjectType must reference a registered subject type (which usually equals an object type).
The platform pre-registers a small set of cross-industry governance types and zero industry types. See built-ins.
Action IDs
Format
<namespace>.<snake_case_verb>, e.g.orders.submit- Validation regex:
/^[a-z][a-z0-9-]*\.[a-z][a-z0-9_]*$/.
Two stability rules:
- An action ID is permanent. Renaming it breaks every audit log row, every policy reference, every projection that filtered on it.
- The action's
versionfield is for implementation changes (handler logic, schema). The ID itself is immutable.
Event types
Format
- PascalCase past-tense fact (
PlanAccepted,LeadIngested) - Registered via
FabricModule.eventTypes. Schema versioning is per-event-type with an integereventSchemaVersionon each envelope.
Policy IDs
Format
<id>.v<integer>, e.g.orders.payment_consent.v1, with the version part of the ID
A new version is a new policy. Old invocations remain bound to whichever version evaluated them.
State machines
Registered per entityType. A state machine is a graph of (from, to, causedByAction) transitions plus an optional guard predicate. The runtime calls validateTransition before atomic action handlers run.
States carry a StateClass:
type StateClass =
| "initial"
| "active"
| "action_required"
| "waiting"
| "terminal"
| "exception";public enum StateClass
{
Initial,
Active,
ActionRequired,
Waiting,
Terminal,
Exception
}Used by UI to render badges and by reporting to compute funnel/conversion metrics.
See also
- Built-in entities: the fixed set the platform pre-registers.
- Extending with vertical types: adding your own.
- Invariants: state-machine and registry constraints.