# pranay-dommati/thestudent architecture

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

- Interactive diagram: https://gitdiagram.com/pranay-dommati/thestudent
- Repository: https://github.com/pranay-dommati/thestudent

## Overview

1. **Repository shape**
   - This is a monorepo for an AI learning ecosystem with one shared Django backend and several independently deployed React frontends.
   - The frontends correspond to different product surfaces: the main marketing/product site, the courses platform, Scrib notes generator, and the code visualizer.

2. **Top-level boundary: UI layer vs backend layer**
   - The React apps handle routing, presentation, client-side state, local caching, and some offline behavior.
   - The Django backend is the system of record for authentication, courses, AI content generation, analytics/tracking, payments, feedback, and file/media storage.

3. **Backend core**
   - `backend/backend` is the Django project shell: settings, URL routing, WSGI/ASGI entrypoints, middleware, Celery setup, DB helpers, and security layers.
   - App-level routing is split by domain so each product area can evolve independently while still sharing the same runtime and database.

4. **Identity and user lifecycle**
   - `backend/authentication` owns the custom user model, OTP/email verification, login pipelines, rate limiting, and onboarding flags.
   - This auth layer is consumed by all frontends through shared API calls and context/state wrappers, so user identity is centralized even though the UI surfaces are separate.

5. **Courses domain**
   - `backend/courses` is the largest business domain: course models, chapters/sections/lessons, quizzes, resources, certifications, drafts, and admin tooling.
   - It supports both school-style and engineering-style course structures, which is why there are parallel serializers, views, validators, and multiple admin/edit forms on the frontend.
   - Media-heavy outputs such as certificates and lesson resources are stored under `backend/media`, while sample data and exports live in `backend/fixtures_export` and `data/`.

6. **AI content generation layer**
   - `backend/backend/ai` contains the content-generation services for reading, summaries, quizzes, topics, resources, videos, and YouTube-backed enrichment.
   - This layer also includes sanitization and rate limiting, indicating that model output is treated as untrusted and must be constrained before it reaches the UI.
   - The README’s Gemini/LLM integration is reflected here, and the architecture suggests AI calls are made server-side rather than directly from the browser.

7. **Scrib subsystem**
   - `backend/scrib` implements the AI notes-generation product: topic input, PDF/image generation, promo/coupon logic, payment hooks, cohort toggles, caching, and tasks.
   - The Scrib frontend is a separate web app that talks to this backend for generation workflows and user billing/access state.
   - Generated artifacts are persisted as files in media storage, and the app appears to use background processing for heavier generation steps.

8. **Code visualizer subsystem**
   - `backend/code_visualizer` is a distinct backend domain for execution tracing, sandboxed runs, narration, and “why” explanations.
   - The corresponding frontend contains a dedicated visualization engine with step parsing, timeline orchestration, rendering, and input generation, so most of the visualization logic lives client-side.
   - The backend side appears to store execution/session data and provide AI-assisted explanations rather than doing the full visualization itself.

9. **Learning assistant / chatbot retrieval**
   - `backend/chatbotcourse` adds a retrieval-based educational bot backed by a local `vector_store.index`.
   - This is a separate knowledge-serving path from the general LLM content generation stack: instead of generating from scratch, it retrieves from indexed course content.

10. **Operational and product-support subsystems**
   - `backend/tracking`, `backend/feedback`, `backend/newsletter`, and `backend/payments` are support domains around engagement, forms, subscriptions, and monetization.
   - These are smaller than courses/auth but important because they feed analytics, user feedback loops, and payment state back into the product surfaces.

11. **Shared frontend architecture**
   - The React frontends reuse many cross-cutting modules: auth context, API wrappers, axios clients, markdown rendering, offline handling, toast/notification utilities, and mobile layouts.
   - There is significant shared UI logic across apps, but each deployed frontend still has product-specific page trees and workflows.
   - The code visualizer frontend is the most specialized, with its own rendering engine; the other frontends are more content- and workflow-oriented.

12. **Data and infrastructure boundaries**
   - The primary persistence layer is MySQL per the README, with migration-heavy Django models and tooling for exports/imports and DB checks; some scripts indicate Postgres migration/export support in certain environments.
   - Files, certificates, PDFs, thumbnails, and generated artifacts live in the filesystem-backed media tree, while code-visualizer and chatbot subsystems also rely on local assets such as indexes and cached outputs.
   - Celery is present for asynchronous jobs, and the repo includes deployment scripts and platform-specific entrypoints for hosting on web infrastructure like Render/Hostinger.

13. **End-to-end request flow**
   - A typical flow is: browser UI → frontend service layer (`axios`/API helpers) → Django app route → model/DB and/or AI provider → media/file output or JSON response → frontend rendering and caching.
   - For generation-heavy features, the flow can extend into background tasks and then back to the UI via polling, refreshed state, or download links.

14. **How to draw the architecture**
   - Model this repo as a central Django platform with several domain apps, surrounded by multiple thin-to-medium React clients.
   - Show shared backend services for auth, courses, AI generation, payments, tracking, and feedback.
   - Show separate product-specific client surfaces for Courses, Scrib, Code Visualizer, and the main platform, each consuming the same core backend but with different local logic and UI complexity.

Main entry points: [`backend/backend`](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/backend) (Django shell), [`backend/start_server.sh`](https://github.com/pranay-dommati/thestudent/blob/dep-backend/backend/start_server.sh) (Deploy tooling), [`backend/authentication`](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/authentication) (Authentication), [`backend/courses`](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/courses) (Courses domain)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_frontends["React frontends"]
  node_node_frontend_main["Main site<br/>react app"]
  node_node_frontend_courses["Courses app<br/>react app"]
  node_node_frontend_scrib["Scrib app<br/>react app"]
  node_node_frontend_visualizer["Code visualizer<br/>react app"]
end

subgraph group_group_backend["Django platform"]
  node_node_backend_shell["Django shell<br/>django project"]
  node_node_auth["Authentication<br/>django app"]
  node_node_courses["Courses domain<br/>django app"]
  node_node_ai["AI services<br/>django ai module"]
  node_node_scrib["Scrib backend<br/>django app"]
  node_node_visualizer_backend["Visualizer backend<br/>django app"]
  node_node_chatbot["Chatbot retrieval<br/>django app"]
  node_node_support["Support domains<br/>django apps"]
  node_node_celery["Async jobs<br/>celery worker<br/>[celery.py]"]
end

subgraph group_group_data["Data and runtime assets"]
  node_node_media[("Media store<br/>filesystem assets")]
  node_node_exports["Fixture exports<br/>json exports"]
  node_node_seed_data["Sample data<br/>csv/json data"]
  node_node_vector_index[("Vector index<br/>retrieval index<br/>[vector_store.index]")]
end

subgraph group_group_ops["Deployment and tooling"]
  node_node_deploy["Deploy tooling<br/>ops scripts<br/>[start_server.sh]"]
end

node_node_frontend_main -->|"API calls"| node_node_backend_shell
node_node_frontend_courses -->|"API calls"| node_node_backend_shell
node_node_frontend_scrib -->|"API calls"| node_node_backend_shell
node_node_frontend_visualizer -->|"API calls"| node_node_backend_shell
node_node_backend_shell -->|"routes auth"| node_node_auth
node_node_backend_shell -->|"routes courses"| node_node_courses
node_node_backend_shell -->|"routes ai"| node_node_ai
node_node_backend_shell -->|"routes scrib"| node_node_scrib
node_node_backend_shell -->|"routes visualizer"| node_node_visualizer_backend
node_node_backend_shell -->|"routes chatbot"| node_node_chatbot
node_node_backend_shell -->|"routes support"| node_node_support
node_node_auth -.->|"shared identity"| node_node_frontend_main
node_node_auth -.->|"shared identity"| node_node_frontend_courses
node_node_auth -.->|"shared identity"| node_node_frontend_scrib
node_node_auth -.->|"shared identity"| node_node_frontend_visualizer
node_node_courses -->|"stores files"| node_node_media
node_node_scrib -->|"stores packs"| node_node_media
node_node_chatbot -->|"retrieves from"| node_node_vector_index
node_node_scrib -->|"background work"| node_node_celery
node_node_ai -.->|"background work"| node_node_celery
node_node_deploy -->|"starts"| node_node_backend_shell
node_node_deploy -.->|"builds"| node_node_frontend_main
node_node_deploy -.->|"builds"| node_node_frontend_courses
node_node_deploy -.->|"builds"| node_node_frontend_scrib
node_node_deploy -.->|"builds"| node_node_frontend_visualizer
node_node_courses -.->|"exports data"| node_node_exports
node_node_courses -.->|"imports samples"| node_node_seed_data

click node_node_frontend_main "https://github.com/pranay-dommati/thestudent/tree/dep-backend/frontend"
click node_node_frontend_courses "https://github.com/pranay-dommati/thestudent/tree/dep-backend/courses-frontend"
click node_node_frontend_scrib "https://github.com/pranay-dommati/thestudent/tree/dep-backend/scrib-frontend"
click node_node_frontend_visualizer "https://github.com/pranay-dommati/thestudent/tree/dep-backend/codevisualizer-frontend"
click node_node_backend_shell "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/backend"
click node_node_auth "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/authentication"
click node_node_courses "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/courses"
click node_node_ai "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/backend/ai"
click node_node_scrib "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/scrib"
click node_node_visualizer_backend "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/code_visualizer"
click node_node_chatbot "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/chatbotcourse"
click node_node_media "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/media"
click node_node_exports "https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/fixtures_export"
click node_node_seed_data "https://github.com/pranay-dommati/thestudent/tree/dep-backend/data"
click node_node_vector_index "https://github.com/pranay-dommati/thestudent/blob/dep-backend/backend/chatbotcourse/vector_store.index"
click node_node_celery "https://github.com/pranay-dommati/thestudent/blob/dep-backend/backend/backend/celery.py"
click node_node_deploy "https://github.com/pranay-dommati/thestudent/blob/dep-backend/backend/start_server.sh"

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_node_frontend_main,node_node_frontend_courses,node_node_frontend_scrib,node_node_frontend_visualizer toneBlue
class node_node_backend_shell,node_node_auth,node_node_courses,node_node_ai,node_node_scrib,node_node_visualizer_backend,node_node_chatbot,node_node_support,node_node_celery toneAmber
class node_node_media,node_node_exports,node_node_seed_data,node_node_vector_index toneMint
class node_node_deploy toneRose
```

## Components

### React frontends

Independent client surfaces that share backend APIs and cross-cutting UI services.

- [Main site](https://github.com/pranay-dommati/thestudent/tree/dep-backend/frontend): react app · Primary marketing and product surface with shared auth, courses, learning hub, and admin entry points. · `frontend`
- [Courses app](https://github.com/pranay-dommati/thestudent/tree/dep-backend/courses-frontend): react app · Dedicated courses and learning experience with AI-assisted learning workflows and course browsing. · `courses-frontend`
- [Scrib app](https://github.com/pranay-dommati/thestudent/tree/dep-backend/scrib-frontend): react app · Notes-generation product UI for topic input, previews, PDFs, billing, and user access state. · `scrib-frontend`
- [Code visualizer](https://github.com/pranay-dommati/thestudent/tree/dep-backend/codevisualizer-frontend): react app · Specialized visualization client with a rich client-side engine for step parsing and rendering. · `codevisualizer-frontend`

### Django platform

Shared backend runtime with domain apps, AI services, and request routing.

- [Django shell](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/backend): django project · Project-level settings, routing, middleware, Celery, WSGI/ASGI entrypoints, and DB utilities. · `backend/backend`
- [Authentication](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/authentication): django app · Custom users, OTP/email verification, login pipeline, onboarding flags, and rate limiting. · `backend/authentication`
- [Courses domain](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/courses): django app · Course content, chapters, lessons, quizzes, resources, certifications, drafts, validators, and admin workflows. · `backend/courses`
- [AI services](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/backend/ai): django ai module · Server-side generation for reading, summaries, quizzes, topics, resources, videos, YouTube enrichment, and sanitization. · `backend/backend/ai`
- [Scrib backend](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/scrib): django app · Notes generation, PDF/image output, promo/coupon logic, payments hooks, cohort toggles, caching, and tasks. · `backend/scrib`
- [Visualizer backend](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/code_visualizer): django app · Execution sessions, sandboxed runs, tracing, narration, and AI-assisted 'why' explanations. · `backend/code_visualizer`
- [Chatbot retrieval](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/chatbotcourse): django app · Course-aware retrieval bot backed by a local vector index for educational lookup. · `backend/chatbotcourse`
- **Support domains**: django apps · Tracking, feedback, newsletter, and payments domains that feed product engagement and monetization.
- [Async jobs](https://github.com/pranay-dommati/thestudent/blob/dep-backend/backend/backend/celery.py): celery worker · Background task execution for generation-heavy workflows and deferred processing. · `backend/backend/celery.py`

### Data and runtime assets

Persistent files, exports, and operational artifacts used by backend services.

- [Media store](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/media): filesystem assets · Certificates, lesson resources, Scrib packs, thumbnails, and other generated artifacts. · `backend/media`
- [Fixture exports](https://github.com/pranay-dommati/thestudent/tree/dep-backend/backend/fixtures_export): json exports · Exported datasets for auth, courses, feedback, tracking, and newsletter state. · `backend/fixtures_export`
- [Sample data](https://github.com/pranay-dommati/thestudent/tree/dep-backend/data): csv/json data · Engineering and school course samples plus importable seed datasets used by tooling. · `data`
- [Vector index](https://github.com/pranay-dommati/thestudent/blob/dep-backend/backend/chatbotcourse/vector_store.index): retrieval index · Local index used by the chatbot retrieval path. · `backend/chatbotcourse/vector_store.index`

### Deployment and tooling

Repository-level scripts and hosting glue for local and production environments.

- [Deploy tooling](https://github.com/pranay-dommati/thestudent/blob/dep-backend/backend/start_server.sh): ops scripts · Startup, migration, export/import, Render/Hostinger entrypoints, and server bootstrap scripts. · `backend/start_server.sh`

## Connections

- Main site → Django shell: API calls · Main site talks to shared backend routes for auth, courses, learning hub, and admin actions.
- Courses app → Django shell: API calls · Courses app consumes the shared backend for catalog, learning, progress, and profile data.
- Scrib app → Django shell: API calls · Scrib app uses the backend for generation workflows, billing, and access checks.
- Code visualizer → Django shell: API calls · Visualizer client uses backend services for sessions, tracing, and explanations.
- Django shell → Authentication: routes auth · Central project routes identity and session-related endpoints to the auth app.
- Django shell → Courses domain: routes courses · Course-related endpoints are split into the courses domain.
- Django shell → AI services: routes ai · AI generation endpoints are exposed through the shared AI module.
- Django shell → Scrib backend: routes scrib · Scrib-specific endpoints are mounted from the shared project shell.
- Django shell → Visualizer backend: routes visualizer · Execution and explanation endpoints are mounted for the code visualizer domain.
- Django shell → Chatbot retrieval: routes chatbot · Retrieval bot endpoints are exposed as a separate knowledge-serving path.
- Django shell → Support domains: routes support · Tracking, feedback, newsletter, and payments are exposed as shared support domains.
- Authentication → Main site: shared identity · All frontends rely on the centralized user model and auth flows.
- Authentication → Courses app: shared identity · Courses UI uses the same auth and onboarding state.
- Authentication → Scrib app: shared identity · Scrib UI shares the same account and OTP flows.
- Authentication → Code visualizer: shared identity · Visualizer UI uses centralized auth context and API wrappers.
- Courses domain → Media store: stores files · Course certificates and lesson resources are persisted to media storage.
- Scrib backend → Media store: stores packs · Generated PDFs and note packs are written to media storage.
- Chatbot retrieval → Vector index: retrieves from · The chatbot serves answers from the local vector index.
- Scrib backend → Async jobs: background work · Heavier Scrib generation tasks can be delegated to async workers.
- AI services → Async jobs: background work · Generation-heavy AI workflows can be deferred to background execution.
- Deploy tooling → Django shell: starts · Scripts and entrypoints launch the Django runtime in different environments.
- Deploy tooling → Main site: builds · Repository tooling also serves the main React app for deployment.
- Deploy tooling → Courses app: builds · Deployment scripts target the courses frontend as a separate client.
- Deploy tooling → Scrib app: builds · Deployment scripts target the Scrib frontend as a separate client.
- Deploy tooling → Code visualizer: builds · Deployment scripts target the visualizer frontend as a separate client.
- Courses domain → Fixture exports: exports data · Course and auth state are exported for seeding and migration support.
- Courses domain → Sample data: imports samples · Course admin and testing flows use sample school and engineering data.
