Skip to content

Data model

Nine Mongoose models in one shared MongoDB. Tenant data is scoped with organizationId except Organization, which is the tenant root.

Organization

Workspace — billing settings, cached credits, branding. Parent of all tenant collections (createdBy → User).

User

Organization members — auth, invites, admin vs member roles. Belongs to Organization; optional invitedBy → User.

Position

Interview template — skills, description, AI context, duration. Belongs to Organization; referenced by Interview.

Candidate

Person per tenant — contact, resume on S3, parsed profile fields. Unique email per org; phone encrypted at rest.

Interview

Scheduled AI interview — immutable snapshot for the bot, join auth, runtime and recording. Links Organization, Position, Candidate; optional one InterviewReport.

InterviewReport

Post-interview AI output — recommendation, scores, transcript. 1:1 with Interview; no soft delete.

CreditLot

Purchased, trial, or manual credit pool with expiry and remaining balance. Tied to Organization and purchase ledger row.

CreditLedger

Append-only credit movements (purchase, reserve, settle, release, expiry). Immutable audit trail per organization.

Note

Recruiter notes on a candidate or interview (polymorphic target). Soft-deletable.

For field-level types, indexes, and constraints, see the DBML schema.

Sophia AI Interview Platform — Internal Documentation