# pratikthisside/campops architecture

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

- Interactive diagram: https://gitdiagram.com/pratikthisside/campops
- Repository: https://github.com/pratikthisside/campops

## Overview

##### Project type and purpose
- This is a full-stack web application called “Campus Maintenance Scheduling System.”
- Purpose: allow users (students, teachers, admins) to raise maintenance requests, schedule and track them, and notify stakeholders (e.g. via WhatsApp).

##### File structure
Top-level
- README.md – project summary
- api.py, app.py, db_config.py – a Python service (likely a microservice for scheduling or data processing)
- __pycache__ – Python bytecode cache
- node_modules – Node.js dependencies (used by the Backend folder)
Backend/ (Node.js)
- server.js – main Express app
- routes/requests.js – REST endpoints for CRUD on requests
- db.js – database connection (MySQL/Mongo/etc.)
- sendWhatsApp.js – integration module to send WhatsApp notifications
- package.json & package-lock.json – Node dependencies & scripts
Frontend/ (UI)
- index.html, login.html, admin-home.html, teacher-dashboard.html, raise-request.html, view-request.html, completedRequest.html, manage-users.html, report.html, etc.
- CSS/SCSS for styling each view
- app.js, login.js, script.js – client-side logic
- campus-maintenance.component.ts/.html/.scss – an Angular component (single-page app piece)

##### README
- Confirms it is a “Campus Maintenance Scheduling System” focused on scheduling requests by users.

##### Main components & relationships
a. Components
1. Browser-based Frontend (static HTML/CSS/JS + Angular bits)
2. Node.js Backend API
3. Python Scheduling Service (api.py/app.py)
4. Database (configured via db.js in Node and db_config.py in Python)
5. External WhatsApp API (via sendWhatsApp.js)
b. Data flows
- User → Frontend UI → HTTP REST → Node.js Backend
- Node.js → reads/writes → Database
- Scheduled tasks or triggers in Python service → read pending requests → Database
- Python service → HTTP REST or messaging → Node.js sendWhatsApp module → WhatsApp API → User’s phone
- Admin dashboard views → API calls → Backend → Database
c. Architectural patterns
- Layered architecture: Presentation (Frontend), Application (Node.js + Python services), Data (Database)
- Microservice-style split: Node.js handles request lifecycle; Python handles scheduling logic.
- MVC flavor in Node.js: routes/controllers (routes/requests.js) + data layer (db.js)
d. Key technologies
- Frontend: HTML5, CSS3/SCSS, JavaScript, Angular component
- Backend: Node.js, Express.js
- Scheduling/Processing: Python (Flask or similar)
- Database: MySQL or MongoDB (see db.js / db_config.py)
- External API: WhatsApp Business API

##### Detailed capture of essential elements
- Frontend sub-components: login page, raise-request page, admin dashboard, Angular component.
- Node.js modules: routes/requests.js (CRUD controller), sendWhatsApp.js (notification service), db.js (data access).
- Python files: app.py/api.py (scheduling endpoints or background worker), db_config.py (DB connection).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    User(("User")):::frontend

    %% Frontend
    subgraph "Frontend UI" 
        direction TB
        FE_Browser["Browser UI"]:::frontend
        Index["index.html"]:::frontend
        Login["login.html"]:::frontend
        AppJS["app.js"]:::frontend
        CampusComp["campus-maintenance.component.ts"]:::frontend
    end

    %% Backend Services
    subgraph "Node.js API Service"
        direction TB
        Server["server.js"]:::backend
        Routes["routes/requests.js"]:::backend
        DBConn["db.js"]:::backend
        WhatsAppMod["sendWhatsApp.js"]:::backend
    end

    subgraph "Python Scheduling Service"
        direction TB
        APIpy["api.py"]:::backend
        Apppy["app.py"]:::backend
        PDBConf["db_config.py"]:::backend
    end

    %% Data and External
    DB[(Database)]:::database
    WhatsAppAPI["WhatsApp API"]:::external

    %% Flows
    User -->|"interacts with"| FE_Browser
    FE_Browser -->|"renders pages"| Index
    FE_Browser -->|"renders pages"| Login
    FE_Browser -->|"executes scripts"| AppJS
    FE_Browser -->|"loads component"| CampusComp

    FE_Browser -->|"HTTP REST: /login,/requests"| Server
    Server -->|"DB read/write"| DB
    DB -->|"DB read/write"| Server

    %% Scheduler flows
    Apppy -->|"Cron: fetch pending requests"| DB
    Apppy -->|"Notify(req) via REST"| WhatsAppMod
    WhatsAppMod -->|"HTTP REST"| WhatsAppAPI

    %% Click Events - Frontend
    click FE_Browser "https://github.com/pratikthisside/campops/tree/main/Frontend/"
    click Index "https://github.com/pratikthisside/campops/blob/main/Frontend/index.html"
    click Login "https://github.com/pratikthisside/campops/blob/main/Frontend/login.html"
    click AppJS "https://github.com/pratikthisside/campops/blob/main/Frontend/app.js"
    click CampusComp "https://github.com/pratikthisside/campops/blob/main/Frontend/campus-maintenance.component.ts"

    %% Click Events - Node.js Backend
    click Server "https://github.com/pratikthisside/campops/blob/main/Backend/server.js"
    click Routes "https://github.com/pratikthisside/campops/blob/main/Backend/routes/requests.js"
    click DBConn "https://github.com/pratikthisside/campops/blob/main/Backend/db.js"
    click WhatsAppMod "https://github.com/pratikthisside/campops/blob/main/Backend/sendWhatsApp.js"

    %% Click Events - Python Scheduler
    click APIpy "https://github.com/pratikthisside/campops/blob/main/api.py"
    click Apppy "https://github.com/pratikthisside/campops/blob/main/app.py"
    click PDBConf "https://github.com/pratikthisside/campops/blob/main/db_config.py"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#006064,color:#006064
    classDef backend fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32
    classDef database fill:#ECEFF1,stroke:#455A64,color:#455A64
    classDef external fill:#FFF3E0,stroke:#EF6C00,color:#EF6C00
```
