Skip to content

Database

MongoDB with Mongoose 9. Single shared database, multi-tenant via organizationId. 9 collections.

erDiagram
  Organization ||--o{ User : organizationId
  Organization ||--o{ Position : organizationId
  Organization ||--o{ Candidate : organizationId
  Organization ||--o{ Interview : organizationId
  Organization ||--o{ InterviewReport : organizationId
  Organization ||--o{ CreditLot : organizationId
  Organization ||--o{ CreditLedger : organizationId
  Organization ||--o{ Note : organizationId
  Position ||--o{ Interview : positionId
  Candidate ||--o{ Interview : candidateId
  Interview ||--|| InterviewReport : interviewId
  CreditLedger ||--o{ CreditLot : purchaseLedgerEntryId
  CreditLot ||--o{ CreditLedger : lotId
  Candidate ||--o{ Note : target
  Interview ||--o{ Note : target

Every tenant-scoped document carries organizationId. The API enforces isolation in queries; a few global unique keys exist for login and join links (users.email, organizations.slug, interviews.joinTokenHash).

Collections

CollectionPurpose
organizationsTenant root — settings, branding, cached credit balances
usersTeam members, roles, invites, Firebase auth linkage
positionsJob templates — skills, AI context, duration
candidatesPeople records, resume metadata, recruiter profile fields
interviewsScheduled sessions — frozen snapshot, room/runtime, credits
interviewreportsPost-interview AI report — scores, transcript (1:1 with interview)
creditlotsPurchasable or granted credit pools with expiry
creditledgersAppend-only credit movements and balance snapshots
notesRecruiter notes on a candidate or interview

View complete schema → DBML

Sophia AI Interview Platform — Internal Documentation