# moura-pedro/fit-schedule-planner architecture

> Architecture diagram of the GitHub repository moura-pedro/fit-schedule-planner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moura-pedro/fit-schedule-planner
- Repository: https://github.com/moura-pedro/fit-schedule-planner

## Overview

##### Project type and purpose
- This is a full-stack web application named “Fit Planner” (per the docs link).
- The frontend is a single-page application (SPA) built with React (in the `client/` folder).
- The backend is an Express/Node.js REST API (in the `server/` folder).
- MongoDB (via Mongoose models) is used for persistence, and OpenAI’s API is consumed for transcript parsing or other LLM tasks.

##### File structure
- Top-level:
- `client/` — React app (JSX components, pages, context, utility libraries)
- `server/` — Express app (controllers, routes, services, helpers, models)
- `client/src/components` & `client/src/pages` follow a component/page organization typical of React Router.
- `server/controllers` maps HTTP requests to business logic; `server/routes` wires controllers to endpoints.
- `server/services/openaiService.js` and `server/helpers/llm` encapsulate LLM interactions.
- Mongoose models (`user.js`, `course.js`, `transcript.js`) define data schemas.
- Authentication is handled via `authController.js` and `helpers/auth.js` (JWT or session).

##### Extracted insights from README
- The project’s user and developer documentation is hosted at the provided Vercel URL, implying additional architectural notes are available there.

##### Detail and comprehensiveness
- Error-handling or auth middleware hops if critical
- Notes on any realtime or polling behavior, if present

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Tier
    subgraph "Frontend (Browser)"
        direction TB
        Browser["User Browser"]:::frontend
        Browser -->|Loads SPA| ReactApp["React SPA"]:::frontend
    end

    subgraph "React SPA"
        direction TB
        App["App.jsx"]:::frontend
        ProtectedRoute["ProtectedRoute"]:::frontend
        Navbar["Navbar"]:::frontend
        FileUpload["FileUpload"]:::frontend
        TranscriptViewer["TranscriptViewer"]:::frontend
        UI_Card["card.jsx"]:::frontend
        UI_Tabs["tabs.jsx"]:::frontend
        UserContext["userContext.jsx"]:::frontend
        Utils["utils.js"]:::frontend
        subgraph "Pages"
            Home["Home.jsx"]:::frontend
            Login["Login.jsx"]:::frontend
            Register["Register.jsx"]:::frontend
            Dashboard["Dashboard.jsx"]:::frontend
            Prereq["PrerequisiteTree.jsx"]:::frontend
            Search["Search.jsx"]:::frontend
        end
        ReactApp --> App
        App --> ProtectedRoute
        App --> Navbar
        App --> Pages
        App --> UserContext
        App --> Utils
        ProtectedRoute --> Login
        ProtectedRoute --> Register
        ProtectedRoute --> Dashboard
        Dashboard --> FileUpload
        Dashboard --> TranscriptViewer
        Dashboard --> Prereq
        Dashboard --> Search
        FileUpload --> TranscriptViewer
    end

    %% Backend Tier
    subgraph "Backend (Express API)"
        direction TB
        API["Express API"]:::backend
        Entry["index.js"]:::backend
        subgraph "Routes"
            AuthRoutes["authRoutes.js"]:::backend
            CourseRoutes["courseRoutes.js"]:::backend
            FileRoutes["fileRoutes.js"]:::backend
            ProgramRoutes["programRoutes.js"]:::backend
            RmpRoutes["rmpRoutes.js"]:::backend
        end
        subgraph "Controllers"
            AuthCtrl["authController.js"]:::backend
            CourseCtrl["courseController.js"]:::backend
            FileCtrl["fileController.js"]:::backend
            ProgramCtrl["programController.js"]:::backend
            RmpCtrl["rmpController.js"]:::backend
        end
        subgraph "Services"
            OpenAIService["openaiService.js"]:::backend
            TranscriptParser["transcriptParser.js"]:::backend
        end
        HelpersAuth["helpers/auth.js"]:::backend
        HelpersLLM["helpers/llm/"]:::backend
        subgraph "Models"
            UserModel["user.js"]:::database
            CourseModel["course.js"]:::database
            TranscriptModel["transcript.js"]:::database
        end

        API --> Entry
        Entry -->|uses| Routes
        Routes --> Controllers
        Controllers --> Services
        Controllers --> Models
        Controllers --> HelpersAuth
        Services --> HelpersLLM
        Services --> OpenAIService
        TranscriptParser --> OpenAIService
        FileRoutes --> FileCtrl
        API -->|HTTP/JSON| ReactApp
    end

    %% Infrastructure
    DB["MongoDB"]:::database
    FileStorage["File Storage"]:::database
    External["OpenAI API"]:::external

    API -->|Query/Update| DB
    API -->|Upload/Download| FileStorage
    API -->|OpenAI /completions| External

    %% Click Events
    click ReactApp "https://github.com/moura-pedro/fit-schedule-planner/tree/main/client/"
    click App "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/App.jsx"
    click ProtectedRoute "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/components/ProtectedRoute/ProtectedRoute.jsx"
    click FileUpload "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/components/FileUpload/FileUpload.jsx"
    click TranscriptViewer "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/components/TranscriptViewer/TranscriptViewer.jsx"
    click Navbar "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/components/navbar/Navbar.jsx"
    click UI_Card "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/components/ui/card.jsx"
    click UI_Tabs "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/components/ui/tabs.jsx"
    click UserContext "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/context/userContext.jsx"
    click Utils "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/lib/utils.js"
    click Home "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/pages/Home/Home.jsx"
    click Login "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/pages/Login/Login.jsx"
    click Register "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/pages/Register/Register.jsx"
    click Dashboard "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/pages/Dashboard/Dashboard.jsx"
    click Prereq "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/pages/PrerequisiteTree/PrerequisiteTree.jsx"
    click Search "https://github.com/moura-pedro/fit-schedule-planner/blob/main/client/src/pages/Search/Search.jsx"
    click Entry "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/index.js"
    click AuthRoutes "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/routes/authRoutes.js"
    click CourseRoutes "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/routes/courseRoutes.js"
    click FileRoutes "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/routes/fileRoutes.js"
    click ProgramRoutes "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/routes/programRoutes.js"
    click RmpRoutes "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/routes/rmpRoutes.js"
    click AuthCtrl "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/controllers/authController.js"
    click CourseCtrl "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/controllers/courseController.js"
    click FileCtrl "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/controllers/fileController.js"
    click ProgramCtrl "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/controllers/programController.js"
    click RmpCtrl "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/controllers/rmpController.js"
    click HelpersAuth "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/helpers/auth.js"
    click HelpersLLM "https://github.com/moura-pedro/fit-schedule-planner/tree/main/server/helpers/llm/"
    click OpenAIService "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/services/openaiService.js"
    click TranscriptParser "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/services/transcriptParser.js"
    click UserModel "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/models/user.js"
    click CourseModel "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/models/course.js"
    click TranscriptModel "https://github.com/moura-pedro/fit-schedule-planner/blob/main/server/models/transcript.js"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#3498DB,color:#1B4F72
    classDef backend fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef database fill:#F2F3F4,stroke:#BFC9CA,color:#566573
    classDef external fill:#FEF9E7,stroke:#F1C40F,color:#7D6608
```
