# amandeep-a11y-oss/timetable architecture

> Architecture diagram of the GitHub repository amandeep-a11y-oss/timetable, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amandeep-a11y-oss/timetable
- Repository: https://github.com/amandeep-a11y-oss/timetable

## Overview

##### Project type and purpose
- This is a full-stack web application for managing and viewing semester schedules (timetable generator).
- Backend is a Node.js/Express service with Passport.js authentication, MongoDB persistence.
- Frontend is a React SPA built with Vite, Tailwind CSS, and local state stores for auth and timetable data.

##### File structure
- Top-level:
– backend/ (Express API, models, controllers, routes, middleware, config)
– frontend/ (Vite + React app, components, pages, store, utils, public assets)
– package.json files at root and frontend for separate dependency management.
- Backend follows an MVC pattern:
– config/ (passport.js)
– models/ (Mongoose schemas: user, schedule, utils)
– controllers/ (auth logic, schedule utilities)
– routes/ (auth endpoints)
– middleware/ (JWT guard)
- Frontend organizes by:
– pages/ (route targets: Login, SignUp, Dashboard, Timetable, etc.)
– components/ (reusable UI pieces)
– store/ (Pinia-like or Zustand for auth and timetable state)
– utils/ (date formatting)
- Key config/deployment files:
– backend/index.js (Express server entrypoint, DB connect)
– backend/db/connectDB.js (MongoDB connection)
– frontend/vite.config.js, tailwind.config.js

##### Gather insights from README
- README is empty (“hii”), so rely on directory conventions and naming.

a. Main components
– Frontend SPA (React + Vite)
– Backend API service (Express.js)
– Database (MongoDB)
– Authentication layer (Passport.js + JWT)
– State management (authStore, timetableStore)
– External dependencies (e.g., npm registry, hosting/CDN)
b. Relationships and interactions
– User browser ↔ Frontend: HTTP(S) GET/POST to load SPA and interact.
– Frontend ↔ Backend API: fetch/POST JSON via /auth, /utils, schedule endpoints.
– Backend middleware authenticates JWT on protected routes.
– Controllers handle business logic, use Mongoose models to CRUD data in MongoDB.
– DB responds with data, controllers format and send JSON back to frontend.
c. Architectural patterns
– Backend: MVC with clear separation of routes → controllers → models.
– Frontend: Component-based UI plus centralized state stores.
– Stateless JWT authentication, middleware pipeline.
d. Key technologies
– Node.js, Express.js
– Passport.js (JWT strategy)
– Mongoose (MongoDB ODM)
– React, Vite, Tailwind CSS
– JavaScript (ESModules)

## Diagram (Mermaid)

```mermaid
graph TB
  Browser["User Browser"]:::external
  NPM["npm Registry/CDN"]:::external

  subgraph "Frontend"
    SPA["SPA (Vite + React)"]:::frontend
    main["main.jsx"]:::frontend
    App["App.jsx"]:::frontend
    subgraph "Pages"
      Login["LoginPage.jsx"]:::frontend
      SignUp["SignUpPage.jsx"]:::frontend
      Dashboard["DashboardPage.jsx"]:::frontend
      Timetable["Timetable.jsx"]:::frontend
      Delete["DeletePage.jsx"]:::frontend
      DepartmentData["DepartmentData.jsx"]:::frontend
      PeriodTime1["PeriodTime1.jsx"]:::frontend
    end
    subgraph "Components"
      Course["Course.jsx"]:::frontend
      CreateDepartment["CreateDepartment.jsx"]:::frontend
      Header["Header.jsx"]:::frontend
      Footer["Footer.jsx"]:::frontend
      Input["Input.jsx"]:::frontend
      Loader["Loader.jsx"]:::frontend
      LoadingSpinner["LoadingSpinner.jsx"]:::frontend
      MultipleSelect["MultipleSelect.jsx"]:::frontend
      PasswordStrengthMeter["PasswordStrengthMeter.jsx"]:::frontend
      PeriodLecture["PeriodLecture.jsx"]:::frontend
      Room["Room.jsx"]:::frontend
      SemesterScheduler["SemesterScheduler.jsx"]:::frontend
      SemesterSelector["SemesterSelector.jsx"]:::frontend
      Teacher["Teacher.jsx"]:::frontend
      TodayPeriod["TodayPeriod.jsx"]:::frontend
      Update["Update.jsx"]:::frontend
      UpdateLecture["UpdateLecture.jsx"]:::frontend
      UpdatePeriod["UpdatePeriod.jsx"]:::frontend
      UpdateSchedule["UpdateSchedule.jsx"]:::frontend
      UpdateSemester["UpdateSemester.jsx"]:::frontend
      UpdateSemesterSchedule["UpdateSemesterSchedule.jsx"]:::frontend
      FloatingShape["FloatingShape.jsx"]:::frontend
      Group["Group.jsx"]:::frontend
    end
    subgraph "Stores"
      AuthStore["authStore.js"]:::frontend
      TimetableStore["timetableStore.js"]:::frontend
    end
    subgraph "Config"
      ViteConfig["vite.config.js"]:::frontend
      TailwindConfig["tailwind.config.js"]:::frontend
    end
    Utils["date.js"]:::frontend
  end

  subgraph "Backend"
    API["Express API"]:::backend
    Index["index.js"]:::backend
    DBConn["connectDB.js"]:::backend
    PassportCfg["passport.js"]:::backend
    AuthMW["auth.js"]:::backend
    subgraph "Routes"
      AuthRoute["auth.route.js"]:::backend
    end
    subgraph "Controllers"
      AuthController["auth.controller.js"]:::backend
      UtilsController["utils.controller.js"]:::backend
    end
    subgraph "Models"
      UserModel["user.model.js"]:::backend
      ScheduleModel["schedule.model.js"]:::backend
      UtilsModel["utils.model.js"]:::backend
    end
  end

  DB["MongoDB"]:::db

  Browser -->|loads SPA| SPA
  NPM -->|hosts assets| SPA
  SPA -->|"calls API"| API
  API -->|uses auth middleware| AuthMW
  AuthMW -->|"protects routes"| AuthController
  API -->|"routes requests"| AuthRoute
  AuthRoute --> AuthController
  API --> UtilsController
  AuthController --> UserModel
  UtilsController --> ScheduleModel
  UtilsController --> UtilsModel
  API --> DBConn
  DBConn --> DB
  UserModel --> DB
  ScheduleModel --> DB
  UtilsModel --> DB

  click SPA "https://github.com/amandeep-a11y-oss/timetable/tree/main/frontend/src"
  click main "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/main.jsx"
  click App "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/App.jsx"
  click Login "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/pages/LoginPage.jsx"
  click SignUp "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/pages/SignUpPage.jsx"
  click Dashboard "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/pages/DashboardPage.jsx"
  click Timetable "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/pages/Timetable.jsx"
  click Delete "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/pages/DeletePage.jsx"
  click DepartmentData "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/pages/DepartmentData.jsx"
  click PeriodTime1 "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/pages/PeriodTime1.jsx"
  click Course "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Course.jsx"
  click CreateDepartment "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/CreateDepartment.jsx"
  click Header "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Header.jsx"
  click Footer "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Footer.jsx"
  click Input "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Input.jsx"
  click Loader "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Loader.jsx"
  click LoadingSpinner "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/LoadingSpinner.jsx"
  click MultipleSelect "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/MultipleSelect.jsx"
  click PasswordStrengthMeter "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/PasswordStrengthMeter.jsx"
  click PeriodLecture "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/PeriodLecture.jsx"
  click Room "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Room.jsx"
  click SemesterScheduler "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/SemesterScheduler.jsx"
  click SemesterSelector "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/SemesterSelector.jsx"
  click Teacher "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Teacher.jsx"
  click TodayPeriod "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/TodayPeriod.jsx"
  click Update "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Update.jsx"
  click UpdateLecture "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/UpdateLecture.jsx"
  click UpdatePeriod "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/UpdatePeriod.jsx"
  click UpdateSchedule "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/UpdateSchedule.jsx"
  click UpdateSemester "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/UpdateSemester.jsx"
  click UpdateSemesterSchedule "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/UpdateSemesterSchedule.jsx"
  click FloatingShape "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/FloatingShape.jsx"
  click Group "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/components/Group.jsx"
  click AuthStore "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/store/authStore.js"
  click TimetableStore "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/store/timetableStore.js"
  click Utils "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/src/utils/date.js"
  click ViteConfig "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/vite.config.js"
  click TailwindConfig "https://github.com/amandeep-a11y-oss/timetable/blob/main/frontend/tailwind.config.js"
  click Index "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/index.js"
  click DBConn "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/db/connectDB.js"
  click PassportCfg "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/config/passport.js"
  click AuthMW "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/middleware/auth.js"
  click AuthRoute "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/routes/auth.route.js"
  click AuthController "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/controllers/auth.controller.js"
  click UtilsController "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/controllers/utils.controller.js"
  click UserModel "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/models/user.model.js"
  click ScheduleModel "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/models/schedule.model.js"
  click UtilsModel "https://github.com/amandeep-a11y-oss/timetable/blob/main/backend/models/utils.model.js"

  classDef frontend fill:#cce5ff,stroke:#004085
  classDef backend fill:#d4edda,stroke:#155724
  classDef db fill:#fff3cd,stroke:#856404
  classDef external stroke-dasharray:5 5,stroke:#6c757d,fill:none
```
