# williamjaackson/tanda-hackathon-learning architecture

> Architecture diagram of the GitHub repository williamjaackson/tanda-hackathon-learning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/williamjaackson/tanda-hackathon-learning
- Repository: https://github.com/williamjaackson/tanda-hackathon-learning

## Overview

#### Purpose and deployment shape
This is an AI-assisted learning-platform monorepo: a React frontend lets users authenticate, create and consume courses/modules, take tests, view leaderboards, and interact with an AI coach. A Python backend exposes the application API and content-generation pipeline, backed by PostgreSQL. Dockerized services are coordinated through `docker-compose.yaml`, with images defined in `backend/Dockerfile` and `frontend/Dockerfile`.

#### Application entry points
- Backend process entry point: `backend/main.py`; shared database integration is centralized in `backend/database.py`.
- Frontend browser entry point: `frontend/src/main.tsx`, mounting the application defined in `frontend/src/App.tsx`.
- Environment-supplied runtime settings are expected through `.env.example`; PostgreSQL persistence is represented by `postgres/`.

#### Frontend application shell and access boundary
The SPA owns routing, page composition, and authenticated user state. `frontend/src/contexts/AuthContext.tsx` provides authentication state, while `frontend/src/components/ProtectedRoute.tsx` gates private course and learner workflows. `frontend/src/components/Layout.tsx` provides the shared authenticated application layout.

Primary user journeys are implemented as pages: course discovery/creation in `frontend/src/pages/Courses.tsx` and `frontend/src/pages/CoursesCreate.tsx`; course/module consumption in `frontend/src/pages/CourseDetail.tsx`, `frontend/src/pages/ModuleView.tsx`, and `frontend/src/pages/ModuleLesson.tsx`.

#### API boundary and domain routes
The backend is organized as route modules rather than a separate domain-service layer:
- Identity and session operations: `backend/api/auth.py`.
- Course/module lifecycle: `backend/api/course.py`.
- Assessment delivery and results: `backend/api/test.py`.
- AI conversation: `backend/api/chat.py`.
- Ranking/progress-facing leaderboard endpoint: `backend/api/leaderboard.py`.

The frontend crosses this HTTP boundary through typed/domain-oriented service modules, including `frontend/src/services/auth.ts`, `frontend/src/services/course.ts`, `frontend/src/services/test.ts`, and `frontend/src/services/leaderboard.ts`.

#### AI course-generation pipeline
Course authoring is materially AI-driven. Backend utilities indicate a staged pipeline: source PDF ingestion/summarization (`backend/utils/pdf_summarizer.py`), learning-module creation (`backend/utils/module_generator.py`), question/test generation (`backend/utils/question_generator.py`), and Manim-based visual/animation generation (`backend/utils/manim_generator.py`). These utilities are likely invoked behind course APIs in `backend/api/course.py`; generated content then feeds learner pages and assessment routes.

#### Learning, assessment, and learner feedback flow
A typical control flow is: authenticated learner uses the SPA → frontend services call backend course/test endpoints → backend reads or persists state via `backend/database.py` and PostgreSQL → course/module/test data returns to the relevant pages. Assessment-specific screens are separated into `frontend/src/pages/CourseTest.tsx` and `frontend/src/pages/ModuleTest.tsx`. AI coaching is a distinct interactive UI component, `frontend/src/components/AICoach.tsx`, backed by `backend/api/chat.py`.

#### Completion and ranking outputs
Course completion is surfaced through certificate UI components (`frontend/src/components/Certificate.tsx`, `frontend/src/components/CertificateDialog.tsx`, `frontend/src/components/QRCodeDialog.tsx`) and comparative learner results through `frontend/src/pages/Leaderboard.tsx`. These are presentation boundaries over backend-owned progress, test, and ranking data rather than independent persistence systems.

Main entry points: [`backend/main.py`](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/main.py) (API process), [`frontend/src/components/Layout.tsx`](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/components/Layout.tsx) (Authenticated layout), [`frontend/src/services/auth.ts`](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/services/auth.ts) (Typed API services), [`backend/database.py`](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/database.py) (Database integration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend SPA"]
  node_fe_entry(("Browser entry<br/>React entry<br/>[main.tsx]"))
  node_fe_app["App shell &amp; routing<br/>React app<br/>[App.tsx]"]
  node_fe_auth["Auth state<br/>context<br/>[AuthContext.tsx]"]
  node_fe_guard["Protected routes<br/>route guard<br/>[ProtectedRoute.tsx]"]
  node_fe_layout["Authenticated layout<br/>[Layout.tsx]"]
  node_fe_courses["Course learning UI<br/>pages<br/>[Courses.tsx]"]
  node_fe_assessment["Assessment UI<br/>pages<br/>[CourseTest.tsx]"]
  node_fe_leaderboard["Leaderboard UI<br/>page<br/>[Leaderboard.tsx]"]
  node_fe_coach["AI Coach<br/>[AICoach.tsx]"]
  node_fe_services["Typed API services<br/>HTTP client<br/>[auth.ts]"]
end

subgraph group_backend["Backend API"]
  node_api_entry(("API process<br/>Python entry<br/>[main.py]"))
  node_api_auth["Identity routes<br/>API routes<br/>[auth.py]"]
  node_api_course["Course routes<br/>API routes<br/>[course.py]"]
  node_api_assessment["Assessment routes<br/>API routes<br/>[test.py]"]
  node_api_feedback["Coach &amp; rankings<br/>API routes<br/>[chat.py]"]
  node_database[("Database integration<br/>data access<br/>[database.py]")]
end

subgraph group_ai["AI Content Pipeline"]
  node_ai_pipeline{{"Content generation<br/>pipeline<br/>[pdf_summarizer.py]"}}
end

subgraph group_runtime["Deployment"]
  node_postgres[("PostgreSQL<br/>database")]
  node_compose["Docker Compose<br/>orchestrator"]
end

node_fe_entry -->|"mounts"| node_fe_app
node_fe_app -->|"provides state"| node_fe_auth
node_fe_app -->|"routes through"| node_fe_guard
node_fe_guard -->|"admits users to"| node_fe_layout
node_fe_layout -->|"hosts"| node_fe_courses
node_fe_layout -->|"hosts"| node_fe_assessment
node_fe_layout -->|"hosts"| node_fe_leaderboard
node_fe_layout -->|"hosts"| node_fe_coach
node_fe_auth -->|"authenticates calls"| node_fe_services
node_fe_courses -->|"loads and creates"| node_fe_services
node_fe_assessment -->|"delivers tests"| node_fe_services
node_fe_leaderboard -->|"loads rankings"| node_fe_services
node_fe_coach -->|"chat HTTP"| node_api_feedback
node_fe_services -->|"HTTP API"| node_api_entry
node_api_entry -->|"routes"| node_api_auth
node_api_entry -->|"routes"| node_api_course
node_api_entry -->|"routes"| node_api_assessment
node_api_entry -->|"routes"| node_api_feedback
node_api_course -->|"generates content"| node_ai_pipeline
node_api_course -->|"persists courses"| node_database
node_api_assessment -->|"stores results"| node_database
node_api_feedback -->|"reads learner data"| node_database
node_api_auth -->|"manages identity"| node_database
node_database -->|"connects to"| node_postgres
node_compose -->|"runs backend"| node_api_entry
node_compose -->|"runs database"| node_postgres

click node_fe_entry "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/main.tsx"
click node_fe_app "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/App.tsx"
click node_fe_auth "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/contexts/AuthContext.tsx"
click node_fe_guard "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/components/ProtectedRoute.tsx"
click node_fe_layout "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/components/Layout.tsx"
click node_fe_courses "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/pages/Courses.tsx"
click node_fe_assessment "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/pages/CourseTest.tsx"
click node_fe_leaderboard "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/pages/Leaderboard.tsx"
click node_fe_coach "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/components/AICoach.tsx"
click node_fe_services "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/services/auth.ts"
click node_api_entry "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/main.py"
click node_api_auth "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/auth.py"
click node_api_course "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/course.py"
click node_api_assessment "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/test.py"
click node_api_feedback "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/chat.py"
click node_ai_pipeline "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/utils/pdf_summarizer.py"
click node_database "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/database.py"
click node_compose "https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/docker-compose.yaml"

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_fe_entry,node_fe_app,node_fe_auth,node_fe_guard,node_fe_layout,node_fe_courses,node_fe_assessment,node_fe_leaderboard,node_fe_coach,node_fe_services toneBlue
class node_api_entry,node_api_auth,node_api_course,node_api_assessment,node_api_feedback,node_database toneAmber
class node_ai_pipeline toneMint
class node_postgres,node_compose toneRose
```

## Components

### Frontend SPA

Browser application and learner workflows.

- [Browser entry](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/main.tsx): React entry · `frontend/src/main.tsx`
- [App shell & routing](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/App.tsx): React app · `frontend/src/App.tsx`
- [Auth state](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/contexts/AuthContext.tsx): context · `frontend/src/contexts/AuthContext.tsx`
- [Protected routes](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/components/ProtectedRoute.tsx): route guard · `frontend/src/components/ProtectedRoute.tsx`
- [Authenticated layout](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/components/Layout.tsx): layout · `frontend/src/components/Layout.tsx`
- [Course learning UI](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/pages/Courses.tsx): pages · Discovery, authoring, course, module, and lesson pages. · `frontend/src/pages/Courses.tsx`
- [Assessment UI](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/pages/CourseTest.tsx): pages · Course and module test screens. · `frontend/src/pages/CourseTest.tsx`
- [Leaderboard UI](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/pages/Leaderboard.tsx): page · `frontend/src/pages/Leaderboard.tsx`
- [AI Coach](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/components/AICoach.tsx): `frontend/src/components/AICoach.tsx`
- [Typed API services](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/frontend/src/services/auth.ts): HTTP client · Domain clients for auth, courses, tests, and rankings. · `frontend/src/services/auth.ts`

### Backend API

Python HTTP routes and persistence boundary.

- [API process](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/main.py): Python entry · `backend/main.py`
- [Identity routes](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/auth.py): API routes · `backend/api/auth.py`
- [Course routes](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/course.py): API routes · Course and module lifecycle, including generation. · `backend/api/course.py`
- [Assessment routes](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/test.py): API routes · `backend/api/test.py`
- [Coach & rankings](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/api/chat.py): API routes · Chat and leaderboard endpoints. · `backend/api/chat.py`
- [Database integration](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/database.py): data access · `backend/database.py`

### AI Content Pipeline

Staged course-generation utilities.

- [Content generation](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/backend/utils/pdf_summarizer.py): pipeline · PDF summarization, module, question, and Manim generation. · `backend/utils/pdf_summarizer.py`

### Deployment

Containerized runtime and database.

- **PostgreSQL**: database · Persistent application data.
- [Docker Compose](https://github.com/williamjaackson/tanda-hackathon-learning/blob/main/docker-compose.yaml): orchestrator · `docker-compose.yaml`

## Connections

- Browser entry → App shell & routing: mounts
- App shell & routing → Auth state: provides state
- App shell & routing → Protected routes: routes through
- Protected routes → Authenticated layout: admits users to
- Authenticated layout → Course learning UI: hosts
- Authenticated layout → Assessment UI: hosts
- Authenticated layout → Leaderboard UI: hosts
- Authenticated layout → AI Coach: hosts
- Auth state → Typed API services: authenticates calls
- Course learning UI → Typed API services: loads and creates
- Assessment UI → Typed API services: delivers tests
- Leaderboard UI → Typed API services: loads rankings
- AI Coach → Coach & rankings: chat HTTP
- Typed API services → API process: HTTP API
- API process → Identity routes: routes
- API process → Course routes: routes
- API process → Assessment routes: routes
- API process → Coach & rankings: routes
- Course routes → Content generation: generates content
- Course routes → Database integration: persists courses
- Assessment routes → Database integration: stores results
- Coach & rankings → Database integration: reads learner data
- Identity routes → Database integration: manages identity
- Database integration → PostgreSQL: connects to
- Docker Compose → API process: runs backend
- Docker Compose → PostgreSQL: runs database
