# kaithwasaditya/ai-learning-management-system-saas- architecture

> Architecture diagram of the GitHub repository kaithwasaditya/ai-learning-management-system-saas-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kaithwasaditya/ai-learning-management-system-saas-
- Repository: https://github.com/kaithwasaditya/ai-learning-management-system-saas-

## Overview

This is a Next.js LMS for building AI voice tutors, discovering them, and tracking tutoring sessions. The main workflow is to define a companion, save it, start a voice session, and record the session for later review. Supabase backs companion and session-history data; Clerk provides identity and subscription checks; Vapi powers voice sessions. The graph follows sampled calls and imports plus README-documented integrations; some listed capabilities, including real-time database sync and billing, are documented but not visible in sampled implementation.

Main entry points: [`lib/actions/companion.actions.ts`](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/actions/companion.actions.ts) (Companion data actions), [`app/companions/page.tsx`](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/companions/page.tsx) (Tutor library), [`components/CompanionComponent.tsx`](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionComponent.tsx) (Voice session UI), [`app/my-journey/page.tsx`](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/my-journey/page.tsx) (Learning history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tutor["Tutor discovery &amp; creation"]
  node_home["Home dashboard<br/>[page.tsx]"]
  node_library["Tutor library<br/>[page.tsx]"]
  node_search["Search input<br/>[SearchInput.tsx]"]
  node_subjectfilter["Subject filter<br/>[SubjectFilter.tsx]"]
  node_cards["Tutor cards<br/>[CompanionCard.tsx]"]
  node_builder["Tutor builder<br/>[CompanionForm.tsx]"]
  node_newpage["New tutor page<br/>[page.tsx]"]
end

subgraph group_sessions["Tutoring sessions"]
  node_sessionpage["Session page<br/>[page.tsx]"]
  node_voiceui["Voice session UI"]
  node_assistantconfig["Assistant configuration<br/>[utils.ts]"]
  node_vapisdk["Vapi client<br/>[vapi.sdk.ts]"]
end

subgraph group_platform["User platform"]
  node_journey["Learning history<br/>[page.tsx]"]
  node_sessionlist["Session and tutor lists<br/>[CompanionsList.tsx]"]
  node_signin["Sign-in page"]
  node_subscription["Subscription page<br/>[page.tsx]"]
  node_ui["Reusable UI primitives"]
end

subgraph group_data["Data &amp; integrations"]
  node_actions["Companion data actions"]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
  node_supabase[("Supabase")]
  node_clerk["Clerk identity and billing"]
  node_constants["Tutor options and colors<br/>[index.ts]"]
end

node_learner(("Learner"))

node_learner -->|"opens"| node_home
node_home -->|"loads tutors and sessions"| node_actions
node_home -->|"renders"| node_cards
node_learner -->|"browses"| node_library
node_library -->|"loads filtered tutors"| node_actions
node_library -->|"renders"| node_search
node_library -->|"renders"| node_subjectfilter
node_search -->|"updates query"| node_library
node_library -->|"renders"| node_cards
node_learner -->|"creates tutor"| node_newpage
node_newpage -->|"renders"| node_builder
node_builder -->|"creates tutor"| node_actions
node_learner -->|"starts session"| node_sessionpage
node_sessionpage -->|"loads tutor"| node_actions
node_sessionpage -->|"renders"| node_voiceui
node_voiceui -->|"configures assistant"| node_assistantconfig
node_voiceui -->|"controls voice call"| node_vapisdk
node_voiceui -->|"records completed session"| node_actions
node_learner -->|"reviews progress"| node_journey
node_journey -->|"gets current user"| node_clerk
node_journey -->|"loads history and tutors"| node_actions
node_journey -->|"renders history"| node_sessionlist
node_actions -->|"uses client"| node_supabaseclient
node_supabaseclient -->|"accesses database"| node_supabase
node_actions -->|"checks identity and plan"| node_clerk
node_learner -->|"authenticates"| node_signin
node_signin -->|"provides sign-in"| node_clerk
node_learner -->|"manages plan"| node_subscription
node_subscription -.->|"uses billing"| node_clerk
node_assistantconfig -->|"reads voice options"| node_constants
node_builder -->|"uses form controls"| node_ui
node_subjectfilter -->|"uses select controls"| node_ui

click node_home "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/page.tsx"
click node_library "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/companions/page.tsx"
click node_search "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/SearchInput.tsx"
click node_subjectfilter "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/SubjectFilter.tsx"
click node_cards "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionCard.tsx"
click node_builder "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionForm.tsx"
click node_newpage "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/companions/new/page.tsx"
click node_sessionpage "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/companions/%5Bid%5D/page.tsx"
click node_voiceui "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionComponent.tsx"
click node_assistantconfig "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/utils.ts"
click node_vapisdk "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/vapi.sdk.ts"
click node_journey "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/my-journey/page.tsx"
click node_sessionlist "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionsList.tsx"
click node_subscription "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/subscription/page.tsx"
click node_actions "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/actions/companion.actions.ts"
click node_supabaseclient "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/supabase.ts"
click node_ui "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/tree/main/components/ui"
click node_constants "https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/constants/index.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_home,node_library,node_search,node_subjectfilter,node_cards,node_builder,node_newpage toneBlue
class node_sessionpage,node_voiceui,node_assistantconfig,node_vapisdk toneAmber
class node_journey,node_sessionlist,node_signin,node_subscription,node_ui toneMint
class node_actions,node_supabaseclient,node_supabase,node_clerk,node_constants toneRose
class node_learner toneIndigo
```

## Components

### Tutor discovery & creation

- [Home dashboard](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/page.tsx): `app/page.tsx`
- [Tutor library](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/companions/page.tsx): `app/companions/page.tsx`
- [Search input](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/SearchInput.tsx): `components/SearchInput.tsx`
- [Subject filter](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/SubjectFilter.tsx): `components/SubjectFilter.tsx`
- [Tutor cards](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionCard.tsx): `components/CompanionCard.tsx`
- [Tutor builder](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionForm.tsx): `components/CompanionForm.tsx`
- [New tutor page](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/companions/new/page.tsx): `app/companions/new/page.tsx`

### Tutoring sessions

- [Session page](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/companions/%5Bid%5D/page.tsx): `app/companions/[id]/page.tsx`
- [Voice session UI](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionComponent.tsx): `components/CompanionComponent.tsx`
- [Assistant configuration](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/utils.ts): `lib/utils.ts`
- [Vapi client](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/vapi.sdk.ts): `lib/vapi.sdk.ts`

### User platform

- [Learning history](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/my-journey/page.tsx): `app/my-journey/page.tsx`
- [Session and tutor lists](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/components/CompanionsList.tsx): `components/CompanionsList.tsx`
- **Sign-in page**
- [Subscription page](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/app/subscription/page.tsx): `app/subscription/page.tsx`
- [Reusable UI primitives](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/tree/main/components/ui): `components/ui`

### Data & integrations

- [Companion data actions](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/actions/companion.actions.ts): `lib/actions/companion.actions.ts`
- [Supabase client](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/lib/supabase.ts): `lib/supabase.ts`
- **Supabase**
- **Clerk identity and billing**
- [Tutor options and colors](https://github.com/kaithwasaditya/ai-learning-management-system-saas-/blob/main/constants/index.ts): `constants/index.ts`

### Other components

- **Learner**

## Connections

- Learner → Home dashboard: opens
- Home dashboard → Companion data actions: loads tutors and sessions (evidence: `app/page.tsx`)
- Home dashboard → Tutor cards: renders (evidence: `app/page.tsx`)
- Learner → Tutor library: browses
- Tutor library → Companion data actions: loads filtered tutors (evidence: `app/companions/page.tsx`)
- Tutor library → Search input: renders (evidence: `app/companions/page.tsx`)
- Tutor library → Subject filter: renders (evidence: `app/companions/page.tsx`)
- Search input → Tutor library: updates query (evidence: `components/SearchInput.tsx`)
- Tutor library → Tutor cards: renders (evidence: `app/companions/page.tsx`)
- Learner → New tutor page: creates tutor
- New tutor page → Tutor builder: renders (evidence: `app/companions/new/page.tsx`)
- Tutor builder → Companion data actions: creates tutor (evidence: `components/CompanionForm.tsx`)
- Learner → Session page: starts session
- Session page → Companion data actions: loads tutor (evidence: `app/companions/[id]/page.tsx`)
- Session page → Voice session UI: renders (evidence: `app/companions/[id]/page.tsx`)
- Voice session UI → Assistant configuration: configures assistant (evidence: `components/CompanionComponent.tsx`)
- Voice session UI → Vapi client: controls voice call (evidence: `components/CompanionComponent.tsx`)
- Voice session UI → Companion data actions: records completed session (evidence: `components/CompanionComponent.tsx`)
- Learner → Learning history: reviews progress
- Learning history → Clerk identity and billing: gets current user (evidence: `app/my-journey/page.tsx`)
- Learning history → Companion data actions: loads history and tutors (evidence: `app/my-journey/page.tsx`)
- Learning history → Session and tutor lists: renders history (evidence: `app/my-journey/page.tsx`)
- Companion data actions → Supabase client: uses client (evidence: `lib/actions/companion.actions.ts`)
- Supabase client → Supabase: accesses database (evidence: `README.md`)
- Companion data actions → Clerk identity and billing: checks identity and plan (evidence: `lib/actions/companion.actions.ts`)
- Learner → Sign-in page: authenticates
- Sign-in page → Clerk identity and billing: provides sign-in (evidence: `README.md`)
- Learner → Subscription page: manages plan
- Subscription page → Clerk identity and billing: uses billing (evidence: `README.md`)
- Assistant configuration → Tutor options and colors: reads voice options (evidence: `lib/utils.ts`)
- Tutor builder → Reusable UI primitives: uses form controls (evidence: `components/CompanionForm.tsx`)
- Subject filter → Reusable UI primitives: uses select controls (evidence: `components/SubjectFilter.tsx`)
