# theebajber/maymanah architecture

> Architecture diagram of the GitHub repository theebajber/maymanah, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/theebajber/maymanah
- Repository: https://github.com/theebajber/maymanah

## Overview

Maymanah is a Quran-learning nonprofit platform connecting students with volunteer teachers, with administrators and donors supporting the service. The principal workflow is account creation and verification, course-based learning and assessment, then teacher pairing, scheduling, live lessons, and progress tracking. The graph also preserves the Mushaf, messaging, administration, and donation branches. Evidence is limited to the README, source index references, and sampled excerpts; unsampled subsystem links are omitted where their callers are not shown.

Main entry points: [`lib/db.ts`](https://github.com/theebajber/maymanah/blob/main/lib/db.ts) (PostgreSQL database), [`app/(home)/page.tsx`](https://github.com/theebajber/maymanah/blob/main/app/(home)/page.tsx) (Public site), [`app/api/appointments/[id]/route.ts`](https://github.com/theebajber/maymanah/blob/main/app/api/appointments/%5Bid%5D/route.ts) (Lesson sessions), [`app/api/messages/route.ts`](https://github.com/theebajber/maymanah/blob/main/app/api/messages/route.ts) (Messages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public and identity"]
  node_marketing["Public site<br/>[page.tsx]"]
  node_account["Authentication<br/>[page.tsx]"]
  node_account_api["Account security API<br/>[route.ts]"]
  node_donations["Donations<br/>[page.tsx]"]
end

subgraph group_learning["Student learning"]
  node_portal["Student portal<br/>[page.tsx]"]
  node_courses["Courses and lessons"]
  node_assessments["Assessments and certificates"]
  node_mushaf["Mushaf reader"]
  node_quran_api["Quran content API"]
end

subgraph group_teaching["Teaching and scheduling"]
  node_teacher_portal["Teacher portal"]
  node_availability["Availability<br/>[route.ts]"]
  node_sessions["Lesson sessions<br/>[route.ts]"]
  node_live_session["Live session services<br/>[live-session.ts]"]
  node_meetings["Meeting integrations<br/>[meetings.ts]"]
  node_messages["Messages<br/>[route.ts]"]
end

subgraph group_operations["Administration and support"]
  node_admin_portal["Admin portal"]
  node_reports["Reports and analytics"]
end

subgraph group_core["Platform services"]
  node_auth_service["Authentication service<br/>[auth.ts]"]
  node_session_service["Session resolution<br/>[session.ts]"]
  node_database[("PostgreSQL database<br/>[db.ts]")]
  node_notifications["Notifications<br/>[notifications.ts]"]
  node_mailer["Transactional email<br/>[mailer.ts]"]
  node_text["Text utilities<br/>[text.ts]"]
  node_validation["Validation<br/>[validation.ts]"]
  node_ui_button["Button UI<br/>[button.tsx]"]
  node_ui_fonts["Typography<br/>[fonts.ts]"]
  node_ui_girih["Girih decoration<br/>[girih.tsx]"]
  node_ui_glass["Glass UI<br/>[glass.tsx]"]
  node_ui_input["Input UI<br/>[input.tsx]"]
end

node_visitor(("Visitor"))
node_student(("Student"))
node_teacher(("Volunteer teacher"))
node_donor(("Donor"))
node_admin(("Administrator"))

node_visitor -->|"explores"| node_marketing
node_marketing -->|"starts enrollment"| node_account
node_student -->|"registers"| node_account
node_account -.->|"authenticates"| node_auth_service
node_auth_service -->|"reads and writes"| node_database
node_auth_service -->|"sends codes"| node_mailer
node_account_api -->|"checks identity"| node_auth_service
node_account_api -->|"resolves user"| node_session_service
node_session_service -->|"loads user"| node_database
node_student -->|"uses"| node_portal
node_portal -->|"opens learning"| node_courses
node_courses -.->|"takes assessments"| node_assessments
node_student -->|"reads Quran"| node_mushaf
node_mushaf -.->|"requests content"| node_quran_api
node_teacher -->|"manages students"| node_teacher_portal
node_teacher_portal -->|"sets availability"| node_availability
node_availability -->|"stores slots"| node_database
node_teacher -->|"manages lessons"| node_sessions
node_sessions -->|"reads and updates"| node_database
node_sessions -->|"invalidates room"| node_meetings
node_sessions -->|"notifies student"| node_notifications
node_sessions -.->|"supports lesson room"| node_live_session
node_student -->|"communicates"| node_messages
node_messages -->|"reads and writes"| node_database
node_messages -->|"notifies recipient"| node_notifications
node_admin -->|"administers platform"| node_admin_portal
node_admin_portal -->|"reviews analytics"| node_reports
node_donor -->|"supports service"| node_donations
node_donations -.->|"records donations"| node_database
node_ui_glass -->|"uses"| node_ui_girih
node_portal -->|"loads dashboard data"| node_database
node_messages -->|"formats content"| node_text
node_marketing -->|"renders"| node_ui_button
node_marketing -->|"uses typography"| node_ui_fonts
node_marketing -->|"renders decoration"| node_ui_girih
node_account -->|"renders fields"| node_ui_input

click node_marketing "https://github.com/theebajber/maymanah/blob/main/app/(home)/page.tsx"
click node_account "https://github.com/theebajber/maymanah/blob/main/app/(auth)/register/page.tsx"
click node_account_api "https://github.com/theebajber/maymanah/blob/main/app/api/account/route.ts"
click node_donations "https://github.com/theebajber/maymanah/blob/main/app/(home)/donate/page.tsx"
click node_portal "https://github.com/theebajber/maymanah/blob/main/app/(portal)/dashboard/page.tsx"
click node_courses "https://github.com/theebajber/maymanah/tree/main/app/(portal)/courses"
click node_assessments "https://github.com/theebajber/maymanah/tree/main/app/api/exams"
click node_mushaf "https://github.com/theebajber/maymanah/tree/main/app/(portal)/mushaf"
click node_quran_api "https://github.com/theebajber/maymanah/tree/main/app/api/quran"
click node_teacher_portal "https://github.com/theebajber/maymanah/tree/main/app/(portal)/students"
click node_availability "https://github.com/theebajber/maymanah/blob/main/app/api/availability/route.ts"
click node_sessions "https://github.com/theebajber/maymanah/blob/main/app/api/appointments/%5Bid%5D/route.ts"
click node_live_session "https://github.com/theebajber/maymanah/blob/main/lib/live-session.ts"
click node_meetings "https://github.com/theebajber/maymanah/blob/main/lib/meetings.ts"
click node_messages "https://github.com/theebajber/maymanah/blob/main/app/api/messages/route.ts"
click node_admin_portal "https://github.com/theebajber/maymanah/tree/main/app/admin"
click node_reports "https://github.com/theebajber/maymanah/blob/main/app/admin/analytics/AnalyticsDashboard.tsx"
click node_auth_service "https://github.com/theebajber/maymanah/blob/main/lib/auth.ts"
click node_session_service "https://github.com/theebajber/maymanah/blob/main/lib/session.ts"
click node_database "https://github.com/theebajber/maymanah/blob/main/lib/db.ts"
click node_notifications "https://github.com/theebajber/maymanah/blob/main/lib/notifications.ts"
click node_mailer "https://github.com/theebajber/maymanah/blob/main/lib/mailer.ts"
click node_text "https://github.com/theebajber/maymanah/blob/main/lib/text.ts"
click node_validation "https://github.com/theebajber/maymanah/blob/main/lib/validation.ts"
click node_ui_button "https://github.com/theebajber/maymanah/blob/main/app/ui/button.tsx"
click node_ui_fonts "https://github.com/theebajber/maymanah/blob/main/app/ui/fonts.ts"
click node_ui_girih "https://github.com/theebajber/maymanah/blob/main/app/ui/girih.tsx"
click node_ui_glass "https://github.com/theebajber/maymanah/blob/main/app/ui/glass.tsx"
click node_ui_input "https://github.com/theebajber/maymanah/blob/main/app/ui/input.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_marketing,node_account,node_account_api,node_donations toneBlue
class node_portal,node_courses,node_assessments,node_mushaf,node_quran_api toneAmber
class node_teacher_portal,node_availability,node_sessions,node_live_session,node_meetings,node_messages toneMint
class node_admin_portal,node_reports toneRose
class node_auth_service,node_session_service,node_database,node_notifications,node_mailer,node_text,node_validation,node_ui_button,node_ui_fonts,node_ui_girih,node_ui_glass,node_ui_input,node_visitor,node_student,node_teacher,node_donor,node_admin toneIndigo
```

## Components

### Public and identity

- [Public site](https://github.com/theebajber/maymanah/blob/main/app/(home)/page.tsx): `app/(home)/page.tsx`
- [Authentication](https://github.com/theebajber/maymanah/blob/main/app/(auth)/register/page.tsx): `app/(auth)/register/page.tsx`
- [Account security API](https://github.com/theebajber/maymanah/blob/main/app/api/account/route.ts): `app/api/account/route.ts`
- [Donations](https://github.com/theebajber/maymanah/blob/main/app/(home)/donate/page.tsx): `app/(home)/donate/page.tsx`

### Student learning

- [Student portal](https://github.com/theebajber/maymanah/blob/main/app/(portal)/dashboard/page.tsx): `app/(portal)/dashboard/page.tsx`
- [Courses and lessons](https://github.com/theebajber/maymanah/tree/main/app/(portal)/courses): `app/(portal)/courses`
- [Assessments and certificates](https://github.com/theebajber/maymanah/tree/main/app/api/exams): `app/api/exams`
- [Mushaf reader](https://github.com/theebajber/maymanah/tree/main/app/(portal)/mushaf): `app/(portal)/mushaf`
- [Quran content API](https://github.com/theebajber/maymanah/tree/main/app/api/quran): `app/api/quran`

### Teaching and scheduling

- [Teacher portal](https://github.com/theebajber/maymanah/tree/main/app/(portal)/students): `app/(portal)/students`
- [Availability](https://github.com/theebajber/maymanah/blob/main/app/api/availability/route.ts): `app/api/availability/route.ts`
- [Lesson sessions](https://github.com/theebajber/maymanah/blob/main/app/api/appointments/%5Bid%5D/route.ts): `app/api/appointments/[id]/route.ts`
- [Live session services](https://github.com/theebajber/maymanah/blob/main/lib/live-session.ts): `lib/live-session.ts`
- [Meeting integrations](https://github.com/theebajber/maymanah/blob/main/lib/meetings.ts): `lib/meetings.ts`
- [Messages](https://github.com/theebajber/maymanah/blob/main/app/api/messages/route.ts): `app/api/messages/route.ts`

### Administration and support

- [Admin portal](https://github.com/theebajber/maymanah/tree/main/app/admin): `app/admin`
- [Reports and analytics](https://github.com/theebajber/maymanah/blob/main/app/admin/analytics/AnalyticsDashboard.tsx): `app/admin/analytics/AnalyticsDashboard.tsx`

### Platform services

- [Authentication service](https://github.com/theebajber/maymanah/blob/main/lib/auth.ts): `lib/auth.ts`
- [Session resolution](https://github.com/theebajber/maymanah/blob/main/lib/session.ts): `lib/session.ts`
- [PostgreSQL database](https://github.com/theebajber/maymanah/blob/main/lib/db.ts): `lib/db.ts`
- [Notifications](https://github.com/theebajber/maymanah/blob/main/lib/notifications.ts): `lib/notifications.ts`
- [Transactional email](https://github.com/theebajber/maymanah/blob/main/lib/mailer.ts): `lib/mailer.ts`
- [Text utilities](https://github.com/theebajber/maymanah/blob/main/lib/text.ts): `lib/text.ts`
- [Validation](https://github.com/theebajber/maymanah/blob/main/lib/validation.ts): `lib/validation.ts`
- [Button UI](https://github.com/theebajber/maymanah/blob/main/app/ui/button.tsx): `app/ui/button.tsx`
- [Typography](https://github.com/theebajber/maymanah/blob/main/app/ui/fonts.ts): `app/ui/fonts.ts`
- [Girih decoration](https://github.com/theebajber/maymanah/blob/main/app/ui/girih.tsx): `app/ui/girih.tsx`
- [Glass UI](https://github.com/theebajber/maymanah/blob/main/app/ui/glass.tsx): `app/ui/glass.tsx`
- [Input UI](https://github.com/theebajber/maymanah/blob/main/app/ui/input.tsx): `app/ui/input.tsx`

### Other components

- **Visitor**
- **Student**
- **Volunteer teacher**
- **Donor**
- **Administrator**

## Connections

- Visitor → Public site: explores
- Public site → Authentication: starts enrollment (evidence: `app/(home)/page.tsx`)
- Student → Authentication: registers
- Authentication → Authentication service: authenticates
- Authentication service → PostgreSQL database: reads and writes (evidence: `lib/auth.ts`)
- Authentication service → Transactional email: sends codes (evidence: `lib/auth.ts`)
- Account security API → Authentication service: checks identity (evidence: `app/api/account/route.ts`)
- Account security API → Session resolution: resolves user (evidence: `app/api/account/route.ts`)
- Session resolution → PostgreSQL database: loads user (evidence: `lib/session.ts`)
- Student → Student portal: uses
- Student portal → Courses and lessons: opens learning
- Courses and lessons → Assessments and certificates: takes assessments
- Student → Mushaf reader: reads Quran
- Mushaf reader → Quran content API: requests content
- Volunteer teacher → Teacher portal: manages students
- Teacher portal → Availability: sets availability
- Availability → PostgreSQL database: stores slots (evidence: `app/api/availability/route.ts`)
- Volunteer teacher → Lesson sessions: manages lessons
- Lesson sessions → PostgreSQL database: reads and updates (evidence: `app/api/appointments/[id]/route.ts`)
- Lesson sessions → Meeting integrations: invalidates room (evidence: `app/api/appointments/[id]/route.ts`)
- Lesson sessions → Notifications: notifies student (evidence: `app/api/appointments/[id]/route.ts`)
- Lesson sessions → Live session services: supports lesson room
- Student → Messages: communicates
- Messages → PostgreSQL database: reads and writes (evidence: `app/api/messages/route.ts`)
- Messages → Notifications: notifies recipient (evidence: `app/api/messages/route.ts`)
- Administrator → Admin portal: administers platform
- Admin portal → Reports and analytics: reviews analytics
- Donor → Donations: supports service
- Donations → PostgreSQL database: records donations
- Glass UI → Girih decoration: uses (evidence: `app/ui/glass.tsx`)
- Student portal → PostgreSQL database: loads dashboard data (evidence: `app/(portal)/dashboard/page.tsx`)
- Messages → Text utilities: formats content (evidence: `app/api/messages/route.ts`)
- Public site → Button UI: renders (evidence: `app/(home)/page.tsx`)
- Public site → Typography: uses typography (evidence: `app/(home)/page.tsx`)
- Public site → Girih decoration: renders decoration (evidence: `app/(home)/page.tsx`)
- Authentication → Input UI: renders fields (evidence: `app/(auth)/register/page.tsx`)
