# aura-web-app/frontend architecture

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

- Interactive diagram: https://gitdiagram.com/aura-web-app/frontend
- Repository: https://github.com/aura-web-app/frontend

## Overview

AURA is a student learning platform whose visible workflow spans account access, study tools, course learning, and AI tutoring. The sampled AI chat API authenticates users, applies usage limits, dispatches to a selected model, and returns a response; sampled pages also show a local study timer and course experience. Other protected learning areas are present in the route tree, but their implementation and wiring were not sampled, so they are represented without speculative connections.

Main entry points: [`app/api/ai/chat/route.ts`](https://github.com/aura-web-app/frontend/blob/main/app/api/ai/chat/route.ts) (Chat API), [`lib/supabase/createclient.tsx`](https://github.com/aura-web-app/frontend/blob/main/lib/supabase/createclient.tsx) (Supabase client), [`app/page.tsx`](https://github.com/aura-web-app/frontend/blob/main/app/page.tsx) (Landing page), [`app/signup/page.tsx`](https://github.com/aura-web-app/frontend/blob/main/app/signup/page.tsx) (Sign up)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Student experience"]
  node_landing["Landing page<br/>[page.tsx]"]
  node_ai_page["AI tutor page<br/>[page.tsx]"]
  node_pricing["AI pricing<br/>[page.tsx]"]
  node_demo["Product demo<br/>[page.tsx]"]
end

subgraph group_identity["Accounts and access"]
  node_signup["Sign up<br/>[page.tsx]"]
  node_login["Login<br/>[page.tsx]"]
  node_otp["Email verification<br/>[route.ts]"]
  node_email_check["Email existence check<br/>[route.ts]"]
  node_protected_routes["Protected access<br/>[middleware.tsx]"]
end

subgraph group_learning["Learning tools"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_courses["Courses and wallet<br/>[page.tsx]"]
  node_timer["Study timer<br/>[page.tsx]"]
  node_calendar["Study calendar<br/>[page.tsx]"]
  node_exam["Exam practice<br/>[page.tsx]"]
  node_mistakes["Mistake notebook<br/>[page.tsx]"]
  node_pyqs["Past questions<br/>[page.tsx]"]
  node_profile["Student profile<br/>[page.tsx]"]
end

subgraph group_ai["AI tutoring"]
  node_chat_api["Chat API<br/>[route.ts]"]
  node_usage_api["Usage API<br/>[route.ts]"]
  node_model_gateway["Model providers<br/>[model.ts]"]
  node_ai_types["AI message types<br/>[ai.ts]"]
end

subgraph group_platform["Platform services"]
  node_usage_helpers["Usage tracking<br/>[usage.tsx]"]
  node_supabase_client["Supabase client<br/>[createclient.tsx]"]
end

node_student(("Student"))
node_supabase[("Supabase")]

node_student -->|"opens"| node_landing
node_student -->|"signs in"| node_login
node_login -->|"authenticates with"| node_supabase_client
node_student -->|"registers"| node_signup
node_signup -->|"requests verification"| node_otp
node_otp -->|"verifies email"| node_supabase
node_email_check -->|"checks users"| node_supabase
node_landing -->|"links to"| node_login
node_landing -->|"routes to"| node_signup
node_student -->|"uses tutor"| node_ai_page
node_student -->|"tracks study"| node_timer
node_student -->|"views courses"| node_courses
node_courses -->|"reads session"| node_supabase_client
node_student -->|"views progress"| node_dashboard
node_student -->|"plans study"| node_calendar
node_student -->|"practices exams"| node_exam
node_student -->|"reviews mistakes"| node_mistakes
node_student -->|"practices questions"| node_pyqs
node_student -->|"manages profile"| node_profile
node_ai_page -->|"submits chat"| node_chat_api
node_chat_api -->|"validates token"| node_supabase_client
node_chat_api -->|"checks and increments"| node_usage_helpers
node_usage_api -->|"validates token"| node_supabase_client
node_usage_api -->|"reads usage"| node_usage_helpers
node_chat_api -->|"dispatches model call"| node_model_gateway
node_chat_api -->|"uses message types"| node_ai_types

click node_landing "https://github.com/aura-web-app/frontend/blob/main/app/page.tsx"
click node_ai_page "https://github.com/aura-web-app/frontend/blob/main/app/(common)/ai/page.tsx"
click node_pricing "https://github.com/aura-web-app/frontend/blob/main/app/(common)/ai/pricing/page.tsx"
click node_demo "https://github.com/aura-web-app/frontend/blob/main/app/(common)/demo/page.tsx"
click node_signup "https://github.com/aura-web-app/frontend/blob/main/app/signup/page.tsx"
click node_login "https://github.com/aura-web-app/frontend/blob/main/app/login/page.tsx"
click node_otp "https://github.com/aura-web-app/frontend/blob/main/app/api/email/route.ts"
click node_email_check "https://github.com/aura-web-app/frontend/blob/main/app/api/check/route.ts"
click node_protected_routes "https://github.com/aura-web-app/frontend/blob/main/app/middleware.tsx"
click node_dashboard "https://github.com/aura-web-app/frontend/blob/main/app/(protected)/dashboard/page.tsx"
click node_courses "https://github.com/aura-web-app/frontend/blob/main/app/(protected)/courses/page.tsx"
click node_timer "https://github.com/aura-web-app/frontend/blob/main/app/(common)/timer/page.tsx"
click node_calendar "https://github.com/aura-web-app/frontend/blob/main/app/(protected)/calendar/page.tsx"
click node_exam "https://github.com/aura-web-app/frontend/blob/main/app/(protected)/exam/page.tsx"
click node_mistakes "https://github.com/aura-web-app/frontend/blob/main/app/(protected)/mistake-nb/page.tsx"
click node_pyqs "https://github.com/aura-web-app/frontend/blob/main/app/(protected)/pyqs/page.tsx"
click node_profile "https://github.com/aura-web-app/frontend/blob/main/app/(protected)/profile/page.tsx"
click node_chat_api "https://github.com/aura-web-app/frontend/blob/main/app/api/ai/chat/route.ts"
click node_usage_api "https://github.com/aura-web-app/frontend/blob/main/app/api/ai/usage/route.ts"
click node_model_gateway "https://github.com/aura-web-app/frontend/blob/main/lib/ai/model.ts"
click node_ai_types "https://github.com/aura-web-app/frontend/blob/main/types/ai.ts"
click node_usage_helpers "https://github.com/aura-web-app/frontend/blob/main/lib/supabase/usage.tsx"
click node_supabase_client "https://github.com/aura-web-app/frontend/blob/main/lib/supabase/createclient.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_landing,node_ai_page,node_pricing,node_demo toneBlue
class node_signup,node_login,node_otp,node_email_check,node_protected_routes,node_supabase toneAmber
class node_dashboard,node_courses,node_timer,node_calendar,node_exam,node_mistakes,node_pyqs,node_profile toneMint
class node_chat_api,node_usage_api,node_model_gateway,node_ai_types toneRose
class node_usage_helpers,node_supabase_client,node_student toneIndigo
```

## Components

### Student experience

- [Landing page](https://github.com/aura-web-app/frontend/blob/main/app/page.tsx): `app/page.tsx`
- [AI tutor page](https://github.com/aura-web-app/frontend/blob/main/app/(common)/ai/page.tsx): `app/(common)/ai/page.tsx`
- [AI pricing](https://github.com/aura-web-app/frontend/blob/main/app/(common)/ai/pricing/page.tsx): `app/(common)/ai/pricing/page.tsx`
- [Product demo](https://github.com/aura-web-app/frontend/blob/main/app/(common)/demo/page.tsx): `app/(common)/demo/page.tsx`

### Accounts and access

- [Sign up](https://github.com/aura-web-app/frontend/blob/main/app/signup/page.tsx): `app/signup/page.tsx`
- [Login](https://github.com/aura-web-app/frontend/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Email verification](https://github.com/aura-web-app/frontend/blob/main/app/api/email/route.ts): `app/api/email/route.ts`
- [Email existence check](https://github.com/aura-web-app/frontend/blob/main/app/api/check/route.ts): `app/api/check/route.ts`
- [Protected access](https://github.com/aura-web-app/frontend/blob/main/app/middleware.tsx): `app/middleware.tsx`

### Learning tools

- [Dashboard](https://github.com/aura-web-app/frontend/blob/main/app/(protected)/dashboard/page.tsx): `app/(protected)/dashboard/page.tsx`
- [Courses and wallet](https://github.com/aura-web-app/frontend/blob/main/app/(protected)/courses/page.tsx): `app/(protected)/courses/page.tsx`
- [Study timer](https://github.com/aura-web-app/frontend/blob/main/app/(common)/timer/page.tsx): `app/(common)/timer/page.tsx`
- [Study calendar](https://github.com/aura-web-app/frontend/blob/main/app/(protected)/calendar/page.tsx): `app/(protected)/calendar/page.tsx`
- [Exam practice](https://github.com/aura-web-app/frontend/blob/main/app/(protected)/exam/page.tsx): `app/(protected)/exam/page.tsx`
- [Mistake notebook](https://github.com/aura-web-app/frontend/blob/main/app/(protected)/mistake-nb/page.tsx): `app/(protected)/mistake-nb/page.tsx`
- [Past questions](https://github.com/aura-web-app/frontend/blob/main/app/(protected)/pyqs/page.tsx): `app/(protected)/pyqs/page.tsx`
- [Student profile](https://github.com/aura-web-app/frontend/blob/main/app/(protected)/profile/page.tsx): `app/(protected)/profile/page.tsx`

### AI tutoring

- [Chat API](https://github.com/aura-web-app/frontend/blob/main/app/api/ai/chat/route.ts): `app/api/ai/chat/route.ts`
- [Usage API](https://github.com/aura-web-app/frontend/blob/main/app/api/ai/usage/route.ts): `app/api/ai/usage/route.ts`
- [Model providers](https://github.com/aura-web-app/frontend/blob/main/lib/ai/model.ts): `lib/ai/model.ts`
- [AI message types](https://github.com/aura-web-app/frontend/blob/main/types/ai.ts): `types/ai.ts`

### Platform services

- [Usage tracking](https://github.com/aura-web-app/frontend/blob/main/lib/supabase/usage.tsx): `lib/supabase/usage.tsx`
- [Supabase client](https://github.com/aura-web-app/frontend/blob/main/lib/supabase/createclient.tsx): `lib/supabase/createclient.tsx`

### Other components

- **Student**
- **Supabase**

## Connections

- Student → Landing page: opens (evidence: `app/page.tsx`)
- Student → Login: signs in (evidence: `app/login/page.tsx`)
- Login → Supabase client: authenticates with (evidence: `app/login/page.tsx`)
- Student → Sign up: registers
- Sign up → Email verification: requests verification
- Email verification → Supabase: verifies email (evidence: `app/api/email/route.ts`)
- Email existence check → Supabase: checks users (evidence: `app/api/check/route.ts`)
- Landing page → Login: links to (evidence: `app/page.tsx`)
- Landing page → Sign up: routes to (evidence: `app/page.tsx`)
- Student → AI tutor page: uses tutor
- Student → Study timer: tracks study
- Student → Courses and wallet: views courses
- Courses and wallet → Supabase client: reads session (evidence: `app/(protected)/courses/page.tsx`)
- Student → Dashboard: views progress
- Student → Study calendar: plans study
- Student → Exam practice: practices exams
- Student → Mistake notebook: reviews mistakes
- Student → Past questions: practices questions
- Student → Student profile: manages profile
- AI tutor page → Chat API: submits chat
- Chat API → Supabase client: validates token (evidence: `app/api/ai/chat/route.ts`)
- Chat API → Usage tracking: checks and increments (evidence: `app/api/ai/chat/route.ts`)
- Usage API → Supabase client: validates token (evidence: `app/api/ai/usage/route.ts`)
- Usage API → Usage tracking: reads usage (evidence: `app/api/ai/usage/route.ts`)
- Chat API → Model providers: dispatches model call (evidence: `app/api/ai/chat/route.ts`)
- Chat API → AI message types: uses message types (evidence: `app/api/ai/chat/route.ts`)
