Skip to content
  • System
  • Light
  • Dark
  • High contrast

Database schema

organizations (workspaces — Better Auth)
└── projects
└── audits
└── reports
└── results
└── evidence
users (Better Auth)
└── user_profiles (is_staff flag)
audit_standards (e.g. WCAG 2.2, WCAG 3.0)
└── criteria (e.g. 1.4.3 Contrast Minimum)

All domain entities (projects, audits, reports) are scoped to an organization (workspace). Users access entities through workspace membership.

Managed by Better Auth. Do not modify directly.

  • users — core user record (id, email, name, emailVerified)
  • sessions — active sessions
  • accounts — OAuth provider links
  • verifications — email verification tokens

Extends the Better Auth users table. One row per user.

ColumnTypeNotes
user_idtextPK, FK → users.id
is_staffbooleanInternal team flag; default false. Staff can see beta/draft standards.
created_attimestamp
updated_attimestamp

Tier has moved to the workspace level (organizations.tier). Tier limits are enforced at the application layer via TIER_LIMITS (exported from @inntrig/db).

Versioned audit standards (e.g. WCAG 2.2, WCAG 3.0, EN 301 549). Generic naming to support non-WCAG standards.

ColumnTypeNotes
idtextPK, e.g. "wcag-2.2", "wcag-3.0"
nametexte.g. “WCAG 2.2”
versiontexte.g. “2.2” (nullable)
statusenumdraft, beta, published; default published
published_attimestampRequired when status is published (enforced by CHECK constraint)
is_globalbooleantrue = Inntrig-maintained; false = custom org standard (future)
configjsonbDefines criterionFields and resultFields for the standard

GET /standards returns only published standards unless the session user has is_staff = true, in which case all statuses are returned. Creating an audit with a non-published standard requires staff access.

The config column drives the UI. For example, WCAG 3.0 defines resultFields: { score: { type: "number", min: 0, max: 4 }, hasCriticalError: { type: "boolean" } } which renders score and critical error controls instead of the default pass/fail buttons.

Individual criteria within a standard. Supports hierarchical structures via parent_id.

ColumnTypeNotes
idtextPK, e.g. "wcag-2.2-1.4.3"
standard_idtextFK → audit_standards.id
reftexte.g. “1.4.3” for WCAG 2.x; outcome ID for WCAG 3
nametexte.g. “Contrast (Minimum)“
summarytextShort description
guidancetextFull guidance text
attributesjsonbStandard-specific data defined by config.criterionFields (nullable)
parent_idtextSelf-referencing FK for hierarchical standards (nullable = top-level)
sort_ordertextControls display order within the standard

For WCAG 2.x, attributes contains {"level": "AA"}. For WCAG 3.0, it contains {"guideline": "1", "guidelineName": "Perceivable"}.

Top-level grouping, typically one per client. Scoped to a workspace.

ColumnTypeNotes
iduuid
organization_idtextFK → organizations.id
created_bytextFK → users.id
nametext
descriptiontextnullable
created_attimestamp
updated_attimestamp

A scoped body of work within a project, tied to a specific standard.

ColumnTypeNotes
iduuid
organization_idtextFK → organizations.id
created_bytextFK → users.id
project_iduuidFK → projects.id
standard_idtextFK → audit_standards.id
titletext
descriptiontextnullable
created_attimestamp
updated_attimestamp

A point-in-time snapshot within an audit. The exportable deliverable.

ColumnTypeNotes
iduuid
organization_idtextFK → organizations.id
created_bytextFK → users.id
audit_iduuidFK → audits.id
titletext
descriptiontextnullable
reported_attimestampDate of the report
locked_attimestampnull = in progress (editable). Non-null = locked (read-only).
created_attimestamp
updated_attimestamp

When locked_at is set, the report is fully read-only: criteria links and status/notes editing are hidden in the UI. Use PATCH /reports/:id { locked: true } and PATCH /reports/:id { locked: false } to transition.

A result for one criterion within one report.

ColumnTypeNotes
iduuid
report_iduuidFK → reports.id
criterion_idtextFK → criteria.id
statustextpass, fail, na, todo
notestextnullable
attributesjsonbStandard-specific result data (nullable). e.g. WCAG 3: {"score": 3, "hasCriticalError": false}
created_attimestamp
updated_attimestamp

File attachments per result (for standards like GDPR, ISO that require supporting documentation).

ColumnTypeNotes
iduuid
result_iduuidFK → results.id
user_idtextFK → users.id
nametextDisplay name
typetextdocument, screenshot, policy, url
urltextR2 object key or external URL
notestextnullable

Organisational commitments per report (for WCAG 3.0 Silver/Gold conformance).

ColumnTypeNotes
iduuid
report_iduuidFK → reports.id
criterion_idtextFK → criteria.id (nullable)
statementtextThe assertion text
scopetextnullable
contact_infotextnullable
asserted_attimestamp
attributesjsonbnullable

Enforced at the application layer (not database constraints):

TierProjectsAudits/projectReports/audit
Free1310
ProUnlimitedUnlimitedUnlimited
OrgUnlimitedUnlimitedUnlimited