Skip to main content

Data Model

Cronozen manages 200+ tables across its hub-and-spoke ecosystem. This page documents the core entities that define the platform’s multi-tenant architecture.

Entity Relationship


Core Entities

unified_actors

The identity layer. Every person in the system is a unified_actor.
One person can have multiple actors (e.g., parent at Center A and instructor at Center B). These are linked via actor familyfindActorFamilyIds() groups actors by shared email or phone.

centers

The tenant entity. Each center is an isolated organization. Tenant types:

center_memberships

The access control layer. Actors access centers through memberships. Lifecycle:
Security guarantees:
  • No center access without active membership
  • No center_id fallback — always explicit membership check
  • All transitions are audited
Never query center data by center_id directly. Always verify membership status first via requireCenterScope() or getCenterScopeOrError().

center_tenant_mapping

Cross-service linking between OPS hub and spoke services.

whitelabel_agreements

Partner/white-label contract and branding configuration.

partner_memberships

Partner organization access control.
Partner Admin ≠ Tenant Admin. Partner admins manage centers (create, configure, monitor). Tenant admins manage data within a specific center.

DPU Entities

dpu_records

Decision Proof Unit — tamper-evident audit trail. Hash computation:
Evidence level transitions:
Once AUDIT_READY, the record is sealed. Any modification breaks the chain.

LMS Entities (learn.cronozen.com)

Key Models

Tenant Configuration (JSON)


Data Isolation Pattern

Scoped Prisma

All center-specific queries go through scoped Prisma, which automatically filters by center_id:

Row-Level Isolation

Every data table includes center_id as a foreign key. The scoped Prisma middleware injects WHERE center_id = ? on every query automatically.
basePrisma bypasses tenant isolation. It must only be used for:
  • Admin cross-center reporting
  • Actor family lookups
  • Partner platform aggregation
  • System-level operations (cron, migration)