Skip to main content

Schema Diagram

The ERD is generated from the backend Prisma schema and synced into this repo.

Run:

cd ../langwa-docs
npm run sync:backend

Diagram (SVG)

Schema diagram

Core entities (from Prisma schema)

  • Region has many Language and Locality
  • Language belongs to a Region and has many Session
  • Locality belongs to a Region
  • LocalityLanguage joins Locality and Language (many-to-many)
  • User is the root identity record (roles: LEARNER, TUTOR, ADMIN)
  • TutorProfile is 1:1 with User (tutor role)
  • LearnerPreferences is 1:1 with User (learner role)
  • TutorAvailability belongs to TutorProfile
  • Session belongs to TutorProfile, optional Language
  • SessionLearner joins Session and User (learners)
  • Payment belongs to Session and User (learner)
  • Review belongs to Session and references reviewer/reviewee User
  • Notification belongs to User, optional Session
  • Message belongs to Session and sender User
  • TutorVerificationDocument belongs to TutorProfile, optional reviewer User