# apoorv7791/dsaapp architecture

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

- Interactive diagram: https://gitdiagram.com/apoorv7791/dsaapp
- Repository: https://github.com/apoorv7791/dsaapp

## Overview

AlgoTrainer is a mobile app for learning data structures and algorithms, with topic lessons, visualizations, and learning settings. Its backend provides authenticated APIs for progress, profiles, goals, streaks, and difficulty, backed by Supabase. The tree and excerpts establish the backend route/controller flow and local progress-storage helpers; most app-screen wiring and the app-to-backend connection were not shown, so those relationships are omitted.

Main entry points: [`backend/db/supabase.js`](https://github.com/apoorv7791/dsaapp/blob/main/backend/db/supabase.js) (Supabase Client), [`backend/server.js`](https://github.com/apoorv7791/dsaapp/blob/main/backend/server.js) (API Server), [`backend/routes/user.js`](https://github.com/apoorv7791/dsaapp/blob/main/backend/routes/user.js) (User Routes), [`AlgoTrainer/lib/learningProgressStorage.ts`](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/learningProgressStorage.ts) (Progress Storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning Content"]
  node_topic_catalog["Topic Catalog<br/>[learningTopics.ts]"]
  node_lesson_registry["Lesson Registry<br/>[lessonRegistry.ts]"]
  node_structures["Data Structures"]
  node_algorithms["Algorithms"]
  node_advanced["Advanced Topics"]
  node_visualizations["Visualizations"]
  node_algorithm_visuals["Algorithm Visuals"]
  node_advanced_visuals["Advanced Visuals"]
  node_lesson_screen["Lesson Screen<br/>[LessonScreen.tsx]"]
end

subgraph group_app["Mobile Experience"]
  node_home["Home<br/>[index.tsx]"]
  node_progress_screen["Progress View<br/>[progress.tsx]"]
  node_settings["Settings<br/>[settings.tsx]"]
  node_auth_ui["Sign In and Signup"]
  node_app_api["Backend API Client<br/>[backendApi.ts]"]
end

subgraph group_backend["API Backend"]
  node_server["API Server<br/>[server.js]"]
  node_auth_middleware["Authentication<br/>[authenticate.js]"]
  node_progress_routes["Progress Routes<br/>[progress.js]"]
  node_user_routes["User Routes<br/>[user.js]"]
  node_progress_controller["Progress Controller"]
  node_user_controller["User Controller<br/>[userController.js]"]
  node_difficulty_controller["Difficulty Controller"]
  node_streak_controller["Streak Controller"]
end

subgraph group_data["Persistence"]
  node_learning_storage["Progress Storage"]
  node_device_storage[("Device Storage<br/>[storage.ts]")]
  node_supabase_client["Supabase Client<br/>[supabase.js]"]
end

node_learner(("Learner"))
node_api_client(("API Consumer"))

node_learner -.->|"opens app"| node_home
node_lesson_registry -->|"uses topic IDs"| node_topic_catalog
node_learning_storage -->|"normalizes topics"| node_topic_catalog
node_learning_storage -->|"reads and writes"| node_device_storage
node_api_client -.->|"sends API requests"| node_server
node_server -->|"authenticates API"| node_auth_middleware
node_server -->|"mounts routes"| node_progress_routes
node_server -->|"mounts routes"| node_user_routes
node_server -->|"checks database"| node_supabase_client
node_auth_middleware -->|"verifies token"| node_supabase_client
node_progress_routes -->|"dispatches requests"| node_progress_controller
node_user_routes -->|"dispatches requests"| node_user_controller
node_user_routes -->|"dispatches requests"| node_difficulty_controller
node_user_routes -->|"dispatches requests"| node_streak_controller
node_progress_controller -->|"reads and writes"| node_supabase_client
node_user_controller -->|"reads and writes"| node_supabase_client
node_difficulty_controller -->|"reads and writes"| node_supabase_client
node_streak_controller -->|"reads and writes"| node_supabase_client

click node_home "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/app/(tabs)/index.tsx"
click node_topic_catalog "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/learningTopics.ts"
click node_lesson_registry "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/lessonRegistry.ts"
click node_structures "https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/DataStructures"
click node_algorithms "https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/Algorithms"
click node_advanced "https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/Advanced"
click node_visualizations "https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/DataVisual"
click node_algorithm_visuals "https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/AlgoVisual"
click node_advanced_visuals "https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/AdvanceVisual"
click node_lesson_screen "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/components/LessonScreen/LessonScreen.tsx"
click node_learning_storage "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/learningProgressStorage.ts"
click node_device_storage "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/storage.ts"
click node_progress_screen "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/app/Learning/progress.tsx"
click node_settings "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/app/(tabs)/settings.tsx"
click node_auth_ui "https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/Registration"
click node_app_api "https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/backendApi.ts"
click node_server "https://github.com/apoorv7791/dsaapp/blob/main/backend/server.js"
click node_auth_middleware "https://github.com/apoorv7791/dsaapp/blob/main/backend/middleware/authenticate.js"
click node_progress_routes "https://github.com/apoorv7791/dsaapp/blob/main/backend/routes/progress.js"
click node_user_routes "https://github.com/apoorv7791/dsaapp/blob/main/backend/routes/user.js"
click node_progress_controller "https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/progressController.js"
click node_user_controller "https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/userController.js"
click node_difficulty_controller "https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/difficultyController.js"
click node_streak_controller "https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/streakController.js"
click node_supabase_client "https://github.com/apoorv7791/dsaapp/blob/main/backend/db/supabase.js"

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_topic_catalog,node_lesson_registry,node_structures,node_algorithms,node_advanced,node_visualizations,node_algorithm_visuals,node_advanced_visuals,node_lesson_screen toneBlue
class node_home,node_progress_screen,node_settings,node_auth_ui,node_app_api toneAmber
class node_server,node_auth_middleware,node_progress_routes,node_user_routes,node_progress_controller,node_user_controller,node_difficulty_controller,node_streak_controller,node_api_client toneMint
class node_learning_storage,node_device_storage,node_supabase_client toneRose
class node_learner toneIndigo
```

## Components

### Learning Content

- [Topic Catalog](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/learningTopics.ts): `AlgoTrainer/lib/learningTopics.ts`
- [Lesson Registry](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/lessonRegistry.ts): `AlgoTrainer/lib/lessonRegistry.ts`
- [Data Structures](https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/DataStructures): `AlgoTrainer/app/DataStructures`
- [Algorithms](https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/Algorithms): `AlgoTrainer/app/Algorithms`
- [Advanced Topics](https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/Advanced): `AlgoTrainer/app/Advanced`
- [Visualizations](https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/DataVisual): `AlgoTrainer/app/DataVisual`
- [Algorithm Visuals](https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/AlgoVisual): `AlgoTrainer/app/AlgoVisual`
- [Advanced Visuals](https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/AdvanceVisual): `AlgoTrainer/app/AdvanceVisual`
- [Lesson Screen](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/components/LessonScreen/LessonScreen.tsx): `AlgoTrainer/components/LessonScreen/LessonScreen.tsx`

### Mobile Experience

- [Home](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/app/(tabs)/index.tsx): `AlgoTrainer/app/(tabs)/index.tsx`
- [Progress View](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/app/Learning/progress.tsx): `AlgoTrainer/app/Learning/progress.tsx`
- [Settings](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/app/(tabs)/settings.tsx): `AlgoTrainer/app/(tabs)/settings.tsx`
- [Sign In and Signup](https://github.com/apoorv7791/dsaapp/tree/main/AlgoTrainer/app/Registration): `AlgoTrainer/app/Registration`
- [Backend API Client](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/backendApi.ts): `AlgoTrainer/lib/backendApi.ts`

### API Backend

- [API Server](https://github.com/apoorv7791/dsaapp/blob/main/backend/server.js): `backend/server.js`
- [Authentication](https://github.com/apoorv7791/dsaapp/blob/main/backend/middleware/authenticate.js): `backend/middleware/authenticate.js`
- [Progress Routes](https://github.com/apoorv7791/dsaapp/blob/main/backend/routes/progress.js): `backend/routes/progress.js`
- [User Routes](https://github.com/apoorv7791/dsaapp/blob/main/backend/routes/user.js): `backend/routes/user.js`
- [Progress Controller](https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/progressController.js): `backend/controller/progressController.js`
- [User Controller](https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/userController.js): `backend/controller/userController.js`
- [Difficulty Controller](https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/difficultyController.js): `backend/controller/difficultyController.js`
- [Streak Controller](https://github.com/apoorv7791/dsaapp/blob/main/backend/controller/streakController.js): `backend/controller/streakController.js`

### Persistence

- [Progress Storage](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/learningProgressStorage.ts): `AlgoTrainer/lib/learningProgressStorage.ts`
- [Device Storage](https://github.com/apoorv7791/dsaapp/blob/main/AlgoTrainer/lib/storage.ts): `AlgoTrainer/lib/storage.ts`
- [Supabase Client](https://github.com/apoorv7791/dsaapp/blob/main/backend/db/supabase.js): `backend/db/supabase.js`

### Other components

- **Learner**
- **API Consumer**

## Connections

- Learner → Home: opens app
- Lesson Registry → Topic Catalog: uses topic IDs (evidence: `AlgoTrainer/lib/lessonRegistry.ts`)
- Progress Storage → Topic Catalog: normalizes topics (evidence: `AlgoTrainer/lib/learningProgressStorage.ts`)
- Progress Storage → Device Storage: reads and writes (evidence: `AlgoTrainer/lib/learningProgressStorage.ts`)
- API Consumer → API Server: sends API requests
- API Server → Authentication: authenticates API (evidence: `backend/server.js`)
- API Server → Progress Routes: mounts routes (evidence: `backend/server.js`)
- API Server → User Routes: mounts routes (evidence: `backend/server.js`)
- API Server → Supabase Client: checks database (evidence: `backend/server.js`)
- Authentication → Supabase Client: verifies token (evidence: `backend/middleware/authenticate.js`)
- Progress Routes → Progress Controller: dispatches requests (evidence: `backend/routes/progress.js`)
- User Routes → User Controller: dispatches requests (evidence: `backend/routes/user.js`)
- User Routes → Difficulty Controller: dispatches requests (evidence: `backend/routes/user.js`)
- User Routes → Streak Controller: dispatches requests (evidence: `backend/routes/user.js`)
- Progress Controller → Supabase Client: reads and writes (evidence: `backend/controller/progressController.js`)
- User Controller → Supabase Client: reads and writes (evidence: `backend/controller/userController.js`)
- Difficulty Controller → Supabase Client: reads and writes (evidence: `backend/controller/difficultyController.js`)
- Streak Controller → Supabase Client: reads and writes (evidence: `backend/controller/streakController.js`)
