# invokeil/student.web architecture

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

- Interactive diagram: https://gitdiagram.com/invokeil/student.web
- Repository: https://github.com/invokeil/student.web

## Overview

Invokeil is the student-facing web application for an online academy. The main student journey is discovering courses, inspecting course content and reviews, purchasing through cart/checkout, then accessing lessons and tracking progress; account, notices, shop, and bilingual/theme features support that journey. Pages compose reusable containers, while API routes handle server operations and shared libraries provide persistence, authentication, caching, payments, and media storage. Edges are limited to relationships shown in excerpts, the source index, or README; unsampled feature routes are represented by their supported directory paths.

Main entry points: [`src/app/api`](https://github.com/invokeil/student.web/tree/main/src/app/api) (Content API routes), [`src/app/api/checkout`](https://github.com/invokeil/student.web/tree/main/src/app/api/checkout) (Checkout routes), [`src/lib/db.ts`](https://github.com/invokeil/student.web/blob/main/src/lib/db.ts) (Prisma database), [`src/lib/auth.ts`](https://github.com/invokeil/student.web/blob/main/src/lib/auth.ts) (Session and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Student experience"]
  node_home["Home and browse"]
  node_course_discovery["Course discovery"]
  node_course_detail["Course detail"]
  node_reviews_ui["Review form"]
  node_account["Account and orders"]
  node_auth_ui["Sign-in and signup"]
end

subgraph group_commerce["Commerce"]
  node_shop_ui["Shop and cart"]
  node_checkout_ui["Checkout flow"]
  node_checkout_api["Checkout routes"]
  node_piprapay["PipraPay gateway<br/>[piprapay.ts]"]
  node_payment_services["Payment operations<br/>[payments.ts]"]
  node_fulfillment["Pricing and fulfillment<br/>[fulfill.ts]"]
end

subgraph group_learning["Learning"]
  node_watch_ui["Streaming room"]
  node_learning_api["Learning routes<br/>[route.ts]"]
  node_study["Study summaries<br/>[study.ts]"]
  node_stream_api["Media streaming<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth["Session and roles<br/>[auth.ts]"]
  node_api_routes["Content API routes"]
  node_cache["Response cache<br/>[cache.ts]"]
  node_i18n["English and Bangla<br/>[en.ts]"]
end

subgraph group_persistence["Persistence and integrations"]
  node_db[("Prisma database<br/>[db.ts]")]
  node_storage["Avatar storage<br/>[storage.ts]"]
  node_email["Email delivery<br/>[email.ts]"]
end

node_student(("Student"))
node_supabase["Supabase Storage"]
node_r2["Cloudflare R2"]
node_kv[("Cloudflare KV")]

node_student -->|"browses"| node_home
node_student -->|"searches"| node_course_discovery
node_student -->|"inspects"| node_course_detail
node_student -->|"shops"| node_shop_ui
node_student -->|"checks out"| node_checkout_ui
node_student -->|"studies"| node_watch_ui
node_student -->|"manages account"| node_account
node_reviews_ui -->|"submits review"| node_api_routes
node_home -.->|"loads home data"| node_api_routes
node_course_discovery -.->|"searches courses"| node_api_routes
node_course_detail -.->|"loads course"| node_api_routes
node_checkout_ui -.->|"starts payment"| node_checkout_api
node_checkout_api -->|"checks session"| node_auth
node_checkout_api -->|"prices cart"| node_fulfillment
node_checkout_api -->|"checks eligibility"| node_payment_services
node_checkout_api -->|"creates payment"| node_piprapay
node_checkout_api -->|"writes order"| node_db
node_payment_services -->|"fulfills orders"| node_fulfillment
node_payment_services -->|"sends notices"| node_email
node_learning_api -->|"checks session"| node_auth
node_learning_api -->|"reads enrollment"| node_db
node_learning_api -->|"summarizes activity"| node_study
node_study -->|"reads progress"| node_db
node_stream_api -->|"checks access"| node_db
node_api_routes -.->|"serves records"| node_db
node_api_routes -.->|"caches hot data"| node_cache
node_api_routes -.->|"authenticates requests"| node_auth
node_cache -->|"reads and writes"| node_kv
node_auth_ui -.->|"authenticates"| node_api_routes
node_auth -->|"loads user"| node_db
node_auth_ui -.->|"uploads avatar"| node_storage
node_storage -->|"uploads image"| node_supabase
node_storage -->|"fallback upload"| node_r2
node_home -.->|"displays translations"| node_i18n

click node_home "https://github.com/invokeil/student.web/tree/main/src/containers/home"
click node_course_discovery "https://github.com/invokeil/student.web/tree/main/src/containers/courses"
click node_course_detail "https://github.com/invokeil/student.web/tree/main/src/containers/course-detail"
click node_reviews_ui "https://github.com/invokeil/student.web/blob/main/src/containers/course-detail/reviews-container.tsx"
click node_account "https://github.com/invokeil/student.web/tree/main/src/containers/account"
click node_auth_ui "https://github.com/invokeil/student.web/tree/main/src/containers/auth"
click node_shop_ui "https://github.com/invokeil/student.web/tree/main/src/containers/shop"
click node_checkout_ui "https://github.com/invokeil/student.web/tree/main/src/containers/checkout"
click node_checkout_api "https://github.com/invokeil/student.web/tree/main/src/app/api/checkout"
click node_piprapay "https://github.com/invokeil/student.web/blob/main/src/lib/piprapay.ts"
click node_payment_services "https://github.com/invokeil/student.web/blob/main/src/lib/payments.ts"
click node_fulfillment "https://github.com/invokeil/student.web/blob/main/src/lib/fulfill.ts"
click node_watch_ui "https://github.com/invokeil/student.web/tree/main/src/containers/watch"
click node_learning_api "https://github.com/invokeil/student.web/blob/main/src/app/api/enrollments/route.ts"
click node_study "https://github.com/invokeil/student.web/blob/main/src/lib/study.ts"
click node_stream_api "https://github.com/invokeil/student.web/blob/main/src/app/api/stream/%5B...key%5D/route.ts"
click node_auth "https://github.com/invokeil/student.web/blob/main/src/lib/auth.ts"
click node_api_routes "https://github.com/invokeil/student.web/tree/main/src/app/api"
click node_cache "https://github.com/invokeil/student.web/blob/main/src/lib/cache.ts"
click node_db "https://github.com/invokeil/student.web/blob/main/src/lib/db.ts"
click node_storage "https://github.com/invokeil/student.web/blob/main/src/lib/storage.ts"
click node_email "https://github.com/invokeil/student.web/blob/main/src/lib/email.ts"
click node_i18n "https://github.com/invokeil/student.web/blob/main/src/i18n/en.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_course_discovery,node_course_detail,node_reviews_ui,node_account,node_auth_ui toneBlue
class node_shop_ui,node_checkout_ui,node_checkout_api,node_piprapay,node_payment_services,node_fulfillment,node_supabase,node_kv toneAmber
class node_watch_ui,node_learning_api,node_study,node_stream_api toneMint
class node_auth,node_api_routes,node_cache,node_i18n toneRose
class node_db,node_storage,node_email,node_student,node_r2 toneIndigo
```

## Components

### Student experience

- [Home and browse](https://github.com/invokeil/student.web/tree/main/src/containers/home): `src/containers/home`
- [Course discovery](https://github.com/invokeil/student.web/tree/main/src/containers/courses): `src/containers/courses`
- [Course detail](https://github.com/invokeil/student.web/tree/main/src/containers/course-detail): `src/containers/course-detail`
- [Review form](https://github.com/invokeil/student.web/blob/main/src/containers/course-detail/reviews-container.tsx): `src/containers/course-detail/reviews-container.tsx`
- [Account and orders](https://github.com/invokeil/student.web/tree/main/src/containers/account): `src/containers/account`
- [Sign-in and signup](https://github.com/invokeil/student.web/tree/main/src/containers/auth): `src/containers/auth`

### Commerce

- [Shop and cart](https://github.com/invokeil/student.web/tree/main/src/containers/shop): `src/containers/shop`
- [Checkout flow](https://github.com/invokeil/student.web/tree/main/src/containers/checkout): `src/containers/checkout`
- [Checkout routes](https://github.com/invokeil/student.web/tree/main/src/app/api/checkout): `src/app/api/checkout`
- [PipraPay gateway](https://github.com/invokeil/student.web/blob/main/src/lib/piprapay.ts): `src/lib/piprapay.ts`
- [Payment operations](https://github.com/invokeil/student.web/blob/main/src/lib/payments.ts): `src/lib/payments.ts`
- [Pricing and fulfillment](https://github.com/invokeil/student.web/blob/main/src/lib/fulfill.ts): `src/lib/fulfill.ts`

### Learning

- [Streaming room](https://github.com/invokeil/student.web/tree/main/src/containers/watch): `src/containers/watch`
- [Learning routes](https://github.com/invokeil/student.web/blob/main/src/app/api/enrollments/route.ts): `src/app/api/enrollments/route.ts`
- [Study summaries](https://github.com/invokeil/student.web/blob/main/src/lib/study.ts): `src/lib/study.ts`
- [Media streaming](https://github.com/invokeil/student.web/blob/main/src/app/api/stream/%5B...key%5D/route.ts): `src/app/api/stream/[...key]/route.ts`

### Platform services

- [Session and roles](https://github.com/invokeil/student.web/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Content API routes](https://github.com/invokeil/student.web/tree/main/src/app/api): `src/app/api`
- [Response cache](https://github.com/invokeil/student.web/blob/main/src/lib/cache.ts): `src/lib/cache.ts`
- [English and Bangla](https://github.com/invokeil/student.web/blob/main/src/i18n/en.ts): `src/i18n/en.ts`

### Persistence and integrations

- [Prisma database](https://github.com/invokeil/student.web/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Avatar storage](https://github.com/invokeil/student.web/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [Email delivery](https://github.com/invokeil/student.web/blob/main/src/lib/email.ts): `src/lib/email.ts`

### Other components

- **Student**
- **Supabase Storage**
- **Cloudflare R2**
- **Cloudflare KV**

## Connections

- Student → Home and browse: browses
- Student → Course discovery: searches
- Student → Course detail: inspects
- Student → Shop and cart: shops
- Student → Checkout flow: checks out
- Student → Streaming room: studies
- Student → Account and orders: manages account
- Review form → Content API routes: submits review (evidence: `src/containers/course-detail/reviews-container.tsx`)
- Home and browse → Content API routes: loads home data
- Course discovery → Content API routes: searches courses
- Course detail → Content API routes: loads course
- Checkout flow → Checkout routes: starts payment
- Checkout routes → Session and roles: checks session (evidence: `src/app/api/checkout/piprapay/route.ts`)
- Checkout routes → Pricing and fulfillment: prices cart (evidence: `src/app/api/checkout/piprapay/route.ts`)
- Checkout routes → Payment operations: checks eligibility (evidence: `src/app/api/checkout/piprapay/route.ts`)
- Checkout routes → PipraPay gateway: creates payment (evidence: `src/app/api/checkout/piprapay/route.ts`)
- Checkout routes → Prisma database: writes order (evidence: `src/app/api/checkout/piprapay/route.ts`)
- Payment operations → Pricing and fulfillment: fulfills orders (evidence: `src/lib/payments.ts`)
- Payment operations → Email delivery: sends notices (evidence: `src/lib/payments.ts`)
- Learning routes → Session and roles: checks session (evidence: `src/app/api/enrollments/route.ts`)
- Learning routes → Prisma database: reads enrollment (evidence: `src/app/api/enrollments/route.ts`)
- Learning routes → Study summaries: summarizes activity (evidence: `src/app/api/enrollments/route.ts`)
- Study summaries → Prisma database: reads progress (evidence: `src/lib/study.ts`)
- Media streaming → Prisma database: checks access (evidence: `src/app/api/stream/[...key]/route.ts`)
- Content API routes → Prisma database: serves records (evidence: `src/app/api/home/route.ts`)
- Content API routes → Response cache: caches hot data (evidence: `src/app/api/home/route.ts`)
- Content API routes → Session and roles: authenticates requests (evidence: `src/app/api/home/route.ts`)
- Response cache → Cloudflare KV: reads and writes (evidence: `src/lib/cache.ts`)
- Sign-in and signup → Content API routes: authenticates
- Session and roles → Prisma database: loads user (evidence: `src/lib/auth.ts`)
- Sign-in and signup → Avatar storage: uploads avatar
- Avatar storage → Supabase Storage: uploads image (evidence: `src/lib/storage.ts`)
- Avatar storage → Cloudflare R2: fallback upload (evidence: `src/lib/storage.ts`)
- Home and browse → English and Bangla: displays translations
