# aswine2005/aksameet architecture

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

- Interactive diagram: https://gitdiagram.com/aswine2005/aksameet
- Repository: https://github.com/aswine2005/aksameet

## Overview

AksaMeet provides authenticated online classes with Stream-powered meetings, automatic attendance, and private on-device attention insights. The main flow is host creation, participant lobby and join, local camera analysis, periodic presence reports, host live monitoring, then history and meeting reports. MongoDB stores meeting and participant records; Stream carries video/chat. README documents capabilities not fully sampled, so those branches are represented at their documented routes or directories; edges without source or README evidence are omitted.

Main entry points: [`src/lib/store.ts`](https://github.com/aswine2005/aksameet/blob/main/src/lib/store.ts) (MongoDB records), [`src/app/api/meetings/route.ts`](https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/route.ts) (Meeting creation), [`src/hooks/useAttentionTracker.ts`](https://github.com/aswine2005/aksameet/blob/main/src/hooks/useAttentionTracker.ts) (Local attention tracker), [`src/app/api/meetings/[meetingId]/presence/route.ts`](https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/%5BmeetingId%5D/presence/route.ts) (Presence endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_meeting["Meetings"]
  node_web["Meeting web UI<br/>[page.tsx]"]
  node_provider["Meeting provider<br/>[MeetProvider.tsx]"]
  node_lobby["Lobby &amp; setup<br/>[MeetingPreview.tsx]"]
  node_meeting_api["Meeting creation<br/>[route.ts]"]
end

subgraph group_insights["Attendance &amp; Insights"]
  node_attention_hook["Local attention tracker"]
  node_face["Face analysis<br/>[faceAnalyzer.ts]"]
  node_classify["Attention scoring<br/>[attention.ts]"]
  node_presence_hook["Presence reporting<br/>[usePresence.ts]"]
  node_presence_api["Presence endpoint<br/>[route.ts]"]
  node_attendance["Attendance calculations<br/>[attendance.ts]"]
  node_host_live["Host live panel<br/>[InsightsPanel.tsx]"]
  node_live_hook["Live data polling<br/>[useHostLive.ts]"]
  node_live_api["Live endpoint<br/>[route.ts]"]
  node_check["Camera check<br/>[page.tsx]"]
end

subgraph group_history["History &amp; Reports"]
  node_history_ui["Meeting history<br/>[page.tsx]"]
  node_history_api["History endpoint<br/>[route.ts]"]
  node_report_ui["Meeting report<br/>[page.tsx]"]
  node_report_api["Report &amp; CSV<br/>[route.ts]"]
end

subgraph group_platform["Services &amp; persistence"]
  node_stream["Stream video &amp; chat"]
  node_token_api["Stream token<br/>[route.ts]"]
  node_database[("MongoDB records<br/>[store.ts]")]
  node_db_connection[("MongoDB connection<br/>[db.ts]")]
  node_server["Auth &amp; report services<br/>[server.ts]"]
  node_clerk["Clerk identity"]
  node_webhook["Profile sync webhook<br/>[route.ts]"]
end

node_host(("Host"))
node_student(("Participant"))

node_host -->|"creates"| node_meeting_api
node_meeting_api -->|"gets identity"| node_server
node_meeting_api -->|"creates call"| node_stream
node_meeting_api -->|"creates record"| node_database
node_student -->|"prepares devices"| node_lobby
node_web -->|"uses"| node_provider
node_provider -->|"requests token"| node_token_api
node_token_api -->|"issues token"| node_stream
node_provider -->|"connects clients"| node_stream
node_student -->|"analyzes locally"| node_attention_hook
node_attention_hook -->|"reads camera"| node_face
node_attention_hook -->|"scores frames"| node_classify
node_attention_hook -.->|"supplies state"| node_presence_hook
node_presence_hook -->|"posts heartbeat"| node_presence_api
node_presence_api -->|"authenticates"| node_server
node_presence_api -->|"records presence"| node_database
node_presence_api -->|"calculates summaries"| node_attendance
node_host -->|"monitors class"| node_host_live
node_host_live -->|"loads live data"| node_live_hook
node_live_hook -->|"polls"| node_live_api
node_live_api -.->|"reads records"| node_database
node_host -->|"opens history"| node_history_ui
node_student -->|"opens history"| node_history_ui
node_history_ui -->|"loads meetings"| node_history_api
node_history_api -->|"reads hosted and attended"| node_database
node_host -->|"views report"| node_report_ui
node_student -->|"views own record"| node_report_ui
node_report_ui -.->|"requests report"| node_report_api
node_report_api -->|"builds report"| node_server
node_report_api -->|"loads meeting data"| node_database
node_database -->|"gets collections"| node_db_connection
node_server -->|"checks identity"| node_clerk
node_check -.->|"previews analysis"| node_face
node_webhook -->|"syncs profiles"| node_stream
node_clerk -->|"sends user events"| node_webhook

click node_web "https://github.com/aswine2005/aksameet/blob/main/src/app/%5BmeetingId%5D/meeting/page.tsx"
click node_provider "https://github.com/aswine2005/aksameet/blob/main/src/contexts/MeetProvider.tsx"
click node_lobby "https://github.com/aswine2005/aksameet/blob/main/src/components/MeetingPreview.tsx"
click node_meeting_api "https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/route.ts"
click node_token_api "https://github.com/aswine2005/aksameet/blob/main/src/app/api/token/route.ts"
click node_attention_hook "https://github.com/aswine2005/aksameet/blob/main/src/hooks/useAttentionTracker.ts"
click node_face "https://github.com/aswine2005/aksameet/blob/main/src/lib/client/faceAnalyzer.ts"
click node_classify "https://github.com/aswine2005/aksameet/blob/main/src/lib/attention.ts"
click node_presence_hook "https://github.com/aswine2005/aksameet/blob/main/src/hooks/usePresence.ts"
click node_presence_api "https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/%5BmeetingId%5D/presence/route.ts"
click node_attendance "https://github.com/aswine2005/aksameet/blob/main/src/lib/attendance.ts"
click node_host_live "https://github.com/aswine2005/aksameet/blob/main/src/components/InsightsPanel.tsx"
click node_live_hook "https://github.com/aswine2005/aksameet/blob/main/src/hooks/useHostLive.ts"
click node_live_api "https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/%5BmeetingId%5D/live/route.ts"
click node_history_ui "https://github.com/aswine2005/aksameet/blob/main/src/app/history/page.tsx"
click node_history_api "https://github.com/aswine2005/aksameet/blob/main/src/app/api/history/route.ts"
click node_report_ui "https://github.com/aswine2005/aksameet/blob/main/src/app/history/%5BmeetingId%5D/page.tsx"
click node_report_api "https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/%5BmeetingId%5D/report/route.ts"
click node_database "https://github.com/aswine2005/aksameet/blob/main/src/lib/store.ts"
click node_db_connection "https://github.com/aswine2005/aksameet/blob/main/src/lib/db.ts"
click node_server "https://github.com/aswine2005/aksameet/blob/main/src/lib/server.ts"
click node_check "https://github.com/aswine2005/aksameet/blob/main/src/app/check/page.tsx"
click node_webhook "https://github.com/aswine2005/aksameet/blob/main/src/app/api/webhooks/route.ts"

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_web,node_provider,node_lobby,node_meeting_api toneBlue
class node_attention_hook,node_face,node_classify,node_presence_hook,node_presence_api,node_attendance,node_host_live,node_live_hook,node_live_api,node_check toneAmber
class node_history_ui,node_history_api,node_report_ui,node_report_api toneMint
class node_stream,node_token_api,node_database,node_db_connection,node_server,node_clerk,node_webhook toneRose
class node_host,node_student toneIndigo
```

## Components

### Meetings

- [Meeting web UI](https://github.com/aswine2005/aksameet/blob/main/src/app/%5BmeetingId%5D/meeting/page.tsx): `src/app/[meetingId]/meeting/page.tsx`
- [Meeting provider](https://github.com/aswine2005/aksameet/blob/main/src/contexts/MeetProvider.tsx): `src/contexts/MeetProvider.tsx`
- [Lobby & setup](https://github.com/aswine2005/aksameet/blob/main/src/components/MeetingPreview.tsx): `src/components/MeetingPreview.tsx`
- [Meeting creation](https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/route.ts): `src/app/api/meetings/route.ts`

### Attendance & Insights

- [Local attention tracker](https://github.com/aswine2005/aksameet/blob/main/src/hooks/useAttentionTracker.ts): `src/hooks/useAttentionTracker.ts`
- [Face analysis](https://github.com/aswine2005/aksameet/blob/main/src/lib/client/faceAnalyzer.ts): `src/lib/client/faceAnalyzer.ts`
- [Attention scoring](https://github.com/aswine2005/aksameet/blob/main/src/lib/attention.ts): `src/lib/attention.ts`
- [Presence reporting](https://github.com/aswine2005/aksameet/blob/main/src/hooks/usePresence.ts): `src/hooks/usePresence.ts`
- [Presence endpoint](https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/%5BmeetingId%5D/presence/route.ts): `src/app/api/meetings/[meetingId]/presence/route.ts`
- [Attendance calculations](https://github.com/aswine2005/aksameet/blob/main/src/lib/attendance.ts): `src/lib/attendance.ts`
- [Host live panel](https://github.com/aswine2005/aksameet/blob/main/src/components/InsightsPanel.tsx): `src/components/InsightsPanel.tsx`
- [Live data polling](https://github.com/aswine2005/aksameet/blob/main/src/hooks/useHostLive.ts): `src/hooks/useHostLive.ts`
- [Live endpoint](https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/%5BmeetingId%5D/live/route.ts): `src/app/api/meetings/[meetingId]/live/route.ts`
- [Camera check](https://github.com/aswine2005/aksameet/blob/main/src/app/check/page.tsx): `src/app/check/page.tsx`

### History & Reports

- [Meeting history](https://github.com/aswine2005/aksameet/blob/main/src/app/history/page.tsx): `src/app/history/page.tsx`
- [History endpoint](https://github.com/aswine2005/aksameet/blob/main/src/app/api/history/route.ts): `src/app/api/history/route.ts`
- [Meeting report](https://github.com/aswine2005/aksameet/blob/main/src/app/history/%5BmeetingId%5D/page.tsx): `src/app/history/[meetingId]/page.tsx`
- [Report & CSV](https://github.com/aswine2005/aksameet/blob/main/src/app/api/meetings/%5BmeetingId%5D/report/route.ts): `src/app/api/meetings/[meetingId]/report/route.ts`

### Services & persistence

- **Stream video & chat**
- [Stream token](https://github.com/aswine2005/aksameet/blob/main/src/app/api/token/route.ts): `src/app/api/token/route.ts`
- [MongoDB records](https://github.com/aswine2005/aksameet/blob/main/src/lib/store.ts): `src/lib/store.ts`
- [MongoDB connection](https://github.com/aswine2005/aksameet/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Auth & report services](https://github.com/aswine2005/aksameet/blob/main/src/lib/server.ts): `src/lib/server.ts`
- **Clerk identity**
- [Profile sync webhook](https://github.com/aswine2005/aksameet/blob/main/src/app/api/webhooks/route.ts): `src/app/api/webhooks/route.ts`

### Other components

- **Host**
- **Participant**

## Connections

- Host → Meeting creation: creates (evidence: `src/app/api/meetings/route.ts`)
- Meeting creation → Auth & report services: gets identity (evidence: `src/app/api/meetings/route.ts`)
- Meeting creation → Stream video & chat: creates call (evidence: `src/app/api/meetings/route.ts`)
- Meeting creation → MongoDB records: creates record (evidence: `src/app/api/meetings/route.ts`)
- Participant → Lobby & setup: prepares devices (evidence: `src/components/MeetingPreview.tsx`)
- Meeting web UI → Meeting provider: uses (evidence: `src/contexts/MeetProvider.tsx`)
- Meeting provider → Stream token: requests token (evidence: `src/contexts/MeetProvider.tsx`)
- Stream token → Stream video & chat: issues token (evidence: `src/app/api/token/route.ts`)
- Meeting provider → Stream video & chat: connects clients (evidence: `src/contexts/MeetProvider.tsx`)
- Participant → Local attention tracker: analyzes locally (evidence: `README.md`)
- Local attention tracker → Face analysis: reads camera (evidence: `src/hooks/useAttentionTracker.ts`)
- Local attention tracker → Attention scoring: scores frames (evidence: `src/hooks/useAttentionTracker.ts`)
- Local attention tracker → Presence reporting: supplies state
- Presence reporting → Presence endpoint: posts heartbeat (evidence: `README.md`)
- Presence endpoint → Auth & report services: authenticates (evidence: `src/app/api/meetings/[meetingId]/presence/route.ts`)
- Presence endpoint → MongoDB records: records presence (evidence: `src/app/api/meetings/[meetingId]/presence/route.ts`)
- Presence endpoint → Attendance calculations: calculates summaries (evidence: `src/app/api/meetings/[meetingId]/presence/route.ts`)
- Host → Host live panel: monitors class (evidence: `README.md`)
- Host live panel → Live data polling: loads live data (evidence: `src/components/InsightsPanel.tsx`)
- Live data polling → Live endpoint: polls (evidence: `src/hooks/useHostLive.ts`)
- Live endpoint → MongoDB records: reads records
- Host → Meeting history: opens history (evidence: `README.md`)
- Participant → Meeting history: opens history (evidence: `README.md`)
- Meeting history → History endpoint: loads meetings (evidence: `README.md`)
- History endpoint → MongoDB records: reads hosted and attended (evidence: `src/app/api/history/route.ts`)
- Host → Meeting report: views report (evidence: `README.md`)
- Participant → Meeting report: views own record (evidence: `README.md`)
- Meeting report → Report & CSV: requests report
- Report & CSV → Auth & report services: builds report (evidence: `src/app/api/meetings/[meetingId]/report/route.ts`)
- Report & CSV → MongoDB records: loads meeting data (evidence: `src/app/api/meetings/[meetingId]/report/route.ts`)
- MongoDB records → MongoDB connection: gets collections (evidence: `src/lib/store.ts`)
- Auth & report services → Clerk identity: checks identity (evidence: `src/lib/server.ts`)
- Camera check → Face analysis: previews analysis
- Profile sync webhook → Stream video & chat: syncs profiles (evidence: `src/app/api/webhooks/route.ts`)
- Clerk identity → Profile sync webhook: sends user events (evidence: `src/app/api/webhooks/route.ts`)
