Skip to main content

Data architecture

PostgreSQL. Prisma schema directory: prisma/schema. There is no single schema.prisma.

FactObserved
Models135
Enums126
Primary keys@default(uuid(7)) on operational models that were read
TimestampsTimestamptz(3) where declared
Tenant keytenantId plus @@unique([id, tenantId]) on tenant-owned models so child relations can include the tenant
Extensionspgvector in the Compose image. An Embedding model exists

Status values are Postgres enums. Whether a transition is legal is application code. No trigger definition was found in the schema files that were scanned.

Platform tables that cut across domains​

File, AuditLog, OutboxEvent, ProcessedEvent, IdempotencyRecord, SupportTicket, Notification, WebhookEndpoint, Device, Task, Embedding.

Soft delete​

Many aggregates have deletedAt. docs/AI_CONTEXT.md says queries must filter deletedAt: null where the column exists. That is a written rule. This documentation does not certify every query.

Idempotency tables​

MechanismWhat it does
ProcessedEventOpt-in record written by IdempotentEventHandlerService
IdempotencyRecordApplication idempotency model. A global HTTP idempotency interceptor was not found
StockMovement@@unique([tenantId, idempotencyKey, createdAt]). Including createdAt means the same key can exist at another timestamp
Outbox claimFOR UPDATE SKIP LOCKED

Global models​

No tenant filter: IntegrationRegistry, Permission, PlatformRolePermission, Currency, FxRate. Everything else that is classified is direct-tenant or indirect-tenant. See Tenancy and Entity map.

Relationships​

The operational spine is tenant, seller, channel, order, fulfillment, shipment, and stock by product and warehouse. The diagram is on Relationships.