# sidd19898/jswm architecture

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

- Interactive diagram: https://gitdiagram.com/sidd19898/jswm
- Repository: https://github.com/sidd19898/jswm

## Overview

#### Purpose and Top-Level Shape
JSWM (“Just Stay With Me”) is an in-progress full-stack productivity system combining personal TODO tasks, reminders/habit tracking, and education workflows. It is split into a Vite/React single-page frontend and a Node.js backend with route modules, middleware, and domain models.

#### Application Entry Points
- Backend server startup and route composition: `backend/index.js`
- Frontend React bootstrap: `frontend/src/main.jsx`
- Frontend application shell: `frontend/src/App.jsx`
- Primary user-facing screens include dashboard, login/signup, and landing: `frontend/src/pages/Dashboard.jsx`, `frontend/src/pages/Login.jsx`, `frontend/src/pages/landing.jsx`

#### Frontend UI and State Boundary
The frontend is a React SPA organized around reusable dashboard/task UI components. The dashboard assembles operational views such as task display, task creation, reminder UI, navigation, and sidebars.
- Task/dashboard composition: `frontend/src/pages/Dashboard.jsx`, `frontend/src/components/Taskview.jsx`, `frontend/src/components/OperatingBoard.jsx`
- Task mutation interface: `frontend/src/components/Addtask.jsx`
- Shared task-removal state is represented through React context: `frontend/src/context/RemovetaskContext.jsx`

#### Frontend API Layer
Client-server communication is centralized in a small API layer rather than embedded directly in screen components.
- Axios client setup: `frontend/src/api/axios.js`
- Authentication requests: `frontend/src/api/auth.js`
- Task requests: `frontend/src/api/tasks.js`

This creates the principal boundary between browser state/UI and backend HTTP endpoints.

#### Backend HTTP, Authentication, and Access Control
The backend is an Express-style HTTP service. Routes separate the main functional areas: user identity, tasks, education, collaboration, and habits.
- Route modules: `backend/routes/user.js`, `backend/routes/task.js`, `backend/routes/education.js`
- Additional domain endpoints: `backend/routes/collaboration.js`, `backend/routes/habit.js`
- Authentication and student-specific authorization middleware: `backend/middleware/authMiddleware.js`, `backend/middleware/studentcheck.js`
- Upload handling is a separate request-processing concern: `backend/middleware/upload.js`

Expected control flow is request → authentication/role middleware where required → route handler → model/database operation → HTTP response.

#### Persistence and Domain Model Layer
Persistence is configured independently from request handling, with a database connection module at `backend/config/db.js`. The model set indicates a broad education/productivity schema, likely backed by MongoDB/Mongoose or a comparable document-model integration.

Architecture-defining domains include:
- Identity and roles: `backend/model/jswm/user.js`, `backend/model/jswm/students.js`, `backend/model/jswm/teachers.js`
- Personal productivity: `backend/model/jswm/task.js`, `backend/model/jswm/habitTracker.js`
- Educational activity: `backend/model/jswm/class.js`, `backend/model/jswm/homework.js`, `backend/model/jswm/submissions.js`
- Scheduling/communications: `backend/model/jswm/lectures.js`, `backend/model/jswm/exam.js`, `backend/model/jswm/announcement.js`
- Collaboration and school calendar: `backend/model/jswm/Collaboration.js`, `backend/model/jswm/holidays.js`

#### Key Functional Flows
1. A user signs up or logs in through frontend auth calls, which reach user routes and pass through authentication controls for protected operations.
2. Authenticated users interact with the dashboard to create, view, or remove tasks; React components call the task API, which reaches `backend/routes/task.js` and the task model.
3. Education-oriented users access class, homework, lecture, exam, submission, and announcement workflows through the education route boundary and corresponding models.
4. Habit/reminder interactions follow the habit route boundary and persist through the habit-tracker domain model.

#### Runtime and External Dependencies
The frontend runs as a Vite-served React application (`frontend/vite.config.js`, `frontend/package.json`). The backend runs under Node.js (`backend/package.json`) and obtains database/environment configuration through `backend/config/db.js` and `backend/.env.example`. The README links a Figma prototype as the primary external design reference.

Main entry points: [`backend/index.js`](https://github.com/sidd19898/jswm/blob/main/backend/index.js) (Backend server), [`backend/routes/education.js`](https://github.com/sidd19898/jswm/blob/main/backend/routes/education.js) (Education routes), [`backend/config/db.js`](https://github.com/sidd19898/jswm/blob/main/backend/config/db.js) (Database connection), [`frontend/src/pages/Dashboard.jsx`](https://github.com/sidd19898/jswm/blob/main/frontend/src/pages/Dashboard.jsx) (User screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React frontend"]
  node_vite{{"Vite runtime<br/>frontend runtime<br/>[vite.config.js]"}}
  node_react_bootstrap["React bootstrap<br/>SPA entry<br/>[main.jsx]"]
  node_app_shell["Application shell<br/>React shell<br/>[App.jsx]"]
  node_screens["User screens<br/>page views<br/>[Dashboard.jsx]"]
  node_task_ui["Task dashboard UI<br/>React components<br/>[Taskview.jsx]"]
  node_task_context["Task removal state<br/>React context"]
  node_api_layer["Client API layer<br/>Axios API modules<br/>[axios.js]"]
end

subgraph group_backend["Node backend"]
  node_server{{"Backend server<br/>Node HTTP entry<br/>[index.js]"}}
  node_user_routes["Identity routes<br/>HTTP routes<br/>[user.js]"]
  node_task_routes["Task routes<br/>HTTP routes<br/>[task.js]"]
  node_education_routes["Education routes<br/>HTTP routes<br/>[education.js]"]
  node_habit_routes["Habit routes<br/>HTTP routes<br/>[habit.js]"]
  node_collaboration_routes["Collaboration routes<br/>HTTP routes<br/>[collaboration.js]"]
  node_access_middleware["Access middleware<br/>authentication and role checks<br/>[authMiddleware.js]"]
  node_upload_middleware["Upload processing<br/>request middleware<br/>[upload.js]"]
end

subgraph group_persistence["Domain persistence"]
  node_identity_models["Identity models<br/>user and role models<br/>[user.js]"]
  node_productivity_models["Productivity models<br/>task and habit models<br/>[task.js]"]
  node_education_models["Education models<br/>academic workflow models<br/>[class.js]"]
  node_collaboration_models["Collaboration models<br/>collaboration and calendar models<br/>[Collaboration.js]"]
  node_database[("Database connection<br/>persistence configuration<br/>[db.js]")]
end

node_vite -->|"serves"| node_react_bootstrap
node_react_bootstrap -->|"mounts"| node_app_shell
node_app_shell -->|"renders"| node_screens
node_screens -->|"dashboard composition"| node_task_ui
node_task_ui -->|"shares removal state"| node_task_context
node_screens -->|"auth requests"| node_api_layer
node_task_ui -->|"task requests"| node_api_layer
node_api_layer -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_task_routes
node_server -->|"mounts"| node_education_routes
node_server -->|"mounts"| node_habit_routes
node_server -->|"mounts"| node_collaboration_routes
node_user_routes -->|"protects operations"| node_access_middleware
node_task_routes -->|"protects operations"| node_access_middleware
node_education_routes -->|"role-gated access"| node_access_middleware
node_education_routes -.->|"handles uploads"| node_upload_middleware
node_user_routes -->|"reads and writes"| node_identity_models
node_task_routes -->|"reads and writes tasks"| node_productivity_models
node_habit_routes -->|"persists habits"| node_productivity_models
node_education_routes -->|"reads and writes"| node_education_models
node_collaboration_routes -->|"reads and writes"| node_collaboration_models
node_identity_models -->|"uses connection"| node_database
node_productivity_models -->|"uses connection"| node_database
node_education_models -->|"uses connection"| node_database
node_collaboration_models -->|"uses connection"| node_database

click node_vite "https://github.com/sidd19898/jswm/blob/main/frontend/vite.config.js"
click node_react_bootstrap "https://github.com/sidd19898/jswm/blob/main/frontend/src/main.jsx"
click node_app_shell "https://github.com/sidd19898/jswm/blob/main/frontend/src/App.jsx"
click node_screens "https://github.com/sidd19898/jswm/blob/main/frontend/src/pages/Dashboard.jsx"
click node_task_ui "https://github.com/sidd19898/jswm/blob/main/frontend/src/components/Taskview.jsx"
click node_task_context "https://github.com/sidd19898/jswm/blob/main/frontend/src/context/RemovetaskContext.jsx"
click node_api_layer "https://github.com/sidd19898/jswm/blob/main/frontend/src/api/axios.js"
click node_server "https://github.com/sidd19898/jswm/blob/main/backend/index.js"
click node_user_routes "https://github.com/sidd19898/jswm/blob/main/backend/routes/user.js"
click node_task_routes "https://github.com/sidd19898/jswm/blob/main/backend/routes/task.js"
click node_education_routes "https://github.com/sidd19898/jswm/blob/main/backend/routes/education.js"
click node_habit_routes "https://github.com/sidd19898/jswm/blob/main/backend/routes/habit.js"
click node_collaboration_routes "https://github.com/sidd19898/jswm/blob/main/backend/routes/collaboration.js"
click node_access_middleware "https://github.com/sidd19898/jswm/blob/main/backend/middleware/authMiddleware.js"
click node_upload_middleware "https://github.com/sidd19898/jswm/blob/main/backend/middleware/upload.js"
click node_identity_models "https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/user.js"
click node_productivity_models "https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/task.js"
click node_education_models "https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/class.js"
click node_collaboration_models "https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/Collaboration.js"
click node_database "https://github.com/sidd19898/jswm/blob/main/backend/config/db.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_vite,node_react_bootstrap,node_app_shell,node_screens,node_task_ui,node_task_context,node_api_layer toneBlue
class node_server,node_user_routes,node_task_routes,node_education_routes,node_habit_routes,node_collaboration_routes,node_access_middleware,node_upload_middleware toneAmber
class node_identity_models,node_productivity_models,node_education_models,node_collaboration_models,node_database toneMint
```

## Components

### React frontend

Vite-served single-page application.

- [Vite runtime](https://github.com/sidd19898/jswm/blob/main/frontend/vite.config.js): frontend runtime · `frontend/vite.config.js`
- [React bootstrap](https://github.com/sidd19898/jswm/blob/main/frontend/src/main.jsx): SPA entry · `frontend/src/main.jsx`
- [Application shell](https://github.com/sidd19898/jswm/blob/main/frontend/src/App.jsx): React shell · `frontend/src/App.jsx`
- [User screens](https://github.com/sidd19898/jswm/blob/main/frontend/src/pages/Dashboard.jsx): page views · Dashboard, login/signup, and landing screens. · `frontend/src/pages/Dashboard.jsx`
- [Task dashboard UI](https://github.com/sidd19898/jswm/blob/main/frontend/src/components/Taskview.jsx): React components · Composes task views, operating board, and task creation. · `frontend/src/components/Taskview.jsx`
- [Task removal state](https://github.com/sidd19898/jswm/blob/main/frontend/src/context/RemovetaskContext.jsx): React context · `frontend/src/context/RemovetaskContext.jsx`
- [Client API layer](https://github.com/sidd19898/jswm/blob/main/frontend/src/api/axios.js): Axios API modules · Centralizes authentication and task HTTP requests. · `frontend/src/api/axios.js`

### Node backend

Express HTTP service and request middleware.

- [Backend server](https://github.com/sidd19898/jswm/blob/main/backend/index.js): Node HTTP entry · Starts the service and composes route modules. · `backend/index.js`
- [Identity routes](https://github.com/sidd19898/jswm/blob/main/backend/routes/user.js): HTTP routes · `backend/routes/user.js`
- [Task routes](https://github.com/sidd19898/jswm/blob/main/backend/routes/task.js): HTTP routes · `backend/routes/task.js`
- [Education routes](https://github.com/sidd19898/jswm/blob/main/backend/routes/education.js): HTTP routes · Serves class, homework, lecture, exam, submission, and announcement workflows. · `backend/routes/education.js`
- [Habit routes](https://github.com/sidd19898/jswm/blob/main/backend/routes/habit.js): HTTP routes · `backend/routes/habit.js`
- [Collaboration routes](https://github.com/sidd19898/jswm/blob/main/backend/routes/collaboration.js): HTTP routes · `backend/routes/collaboration.js`
- [Access middleware](https://github.com/sidd19898/jswm/blob/main/backend/middleware/authMiddleware.js): authentication and role checks · Authenticates protected requests and checks student access. · `backend/middleware/authMiddleware.js`
- [Upload processing](https://github.com/sidd19898/jswm/blob/main/backend/middleware/upload.js): request middleware · `backend/middleware/upload.js`

### Domain persistence

Document-model domain data backed by the configured database.

- [Identity models](https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/user.js): user and role models · User, student, and teacher records. · `backend/model/jswm/user.js`
- [Productivity models](https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/task.js): task and habit models · `backend/model/jswm/task.js`
- [Education models](https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/class.js): academic workflow models · Classes, homework, submissions, lectures, exams, and announcements. · `backend/model/jswm/class.js`
- [Collaboration models](https://github.com/sidd19898/jswm/blob/main/backend/model/jswm/Collaboration.js): collaboration and calendar models · `backend/model/jswm/Collaboration.js`
- [Database connection](https://github.com/sidd19898/jswm/blob/main/backend/config/db.js): persistence configuration · Connects domain models to the database. · `backend/config/db.js`

## Connections

- Vite runtime → React bootstrap: serves
- React bootstrap → Application shell: mounts
- Application shell → User screens: renders
- User screens → Task dashboard UI: dashboard composition
- Task dashboard UI → Task removal state: shares removal state
- User screens → Client API layer: auth requests
- Task dashboard UI → Client API layer: task requests
- Client API layer → Backend server: HTTP requests
- Backend server → Identity routes: mounts
- Backend server → Task routes: mounts
- Backend server → Education routes: mounts
- Backend server → Habit routes: mounts
- Backend server → Collaboration routes: mounts
- Identity routes → Access middleware: protects operations
- Task routes → Access middleware: protects operations
- Education routes → Access middleware: role-gated access
- Education routes → Upload processing: handles uploads
- Identity routes → Identity models: reads and writes
- Task routes → Productivity models: reads and writes tasks
- Habit routes → Productivity models: persists habits
- Education routes → Education models: reads and writes
- Collaboration routes → Collaboration models: reads and writes
- Identity models → Database connection: uses connection
- Productivity models → Database connection: uses connection
- Education models → Database connection: uses connection
- Collaboration models → Database connection: uses connection
