# mayelbarachi/ellipsis architecture

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

- Interactive diagram: https://gitdiagram.com/mayelbarachi/ellipsis
- Repository: https://github.com/mayelbarachi/ellipsis

## Overview

##### Project Breakdown
- Client Application (Frontend):
- Located in the “client” folder.
- Built with React and configured as a Progressive Web App (PWA).
- Contains multiple UI components (e.g., dashboards, login/register pages, safety trends, incident reports) distributed across various subdirectories.
- Uses Vite as the build tool.

- Server Application (Backend):
- Found in the “server” folder.
- Built using Node.js and Express.
- Implements REST API endpoints organized through routes (e.g., AdminDashboardRoutes, CamerasRouter, SafetyTrendsRoutes) that call on controllers and query the database.
- Integrates authentication middleware.

- Database:
- A PostgreSQL database (referenced in the README).
- Database connection and event listening logic are found under “server/Database.”
- There is also a database script (Database_Script.sql) to set up the schema.

- Computer Vision Module:
- Housed in the “computer_vision” folder.
- Contains Python scripts and Jupyter notebooks for training and testing (e.g., PPE detection in Phase 1 and Fall Protection Monitoring in Phase 2).
- Uses YOLOv11x models (“best1.pt”, “best2.pt”) for object detection.
- Processes batch videos stored in the corresponding video folders.

- Frontend Client (React PWA)
- Backend Server (Node/Express)
- PostgreSQL Database
- Computer Vision Processing (YOLO module), which could either run as a batch process or be triggered by API endpoints if integrated in real time.

- Data Flow:
- Connections from the Server to the Database for queries, updates, and event notifications.
- Optionally, include external access paths depicting that the PWA can be installed and accessed on mobile devices.

- Architectural Patterns:
- Separation of concerns: UI (client), Business Logic/API (server), Data Management (database), and heavy computation/video analytics (computer vision module).
- Layering – for example, RESTful API routes that communicate with controllers, which in turn interact with the database and external modules.

##### Relevant Technologies & Patterns
- Client:
- React, CSS Modules, PWA standards (service workers).
- Server:
- Node.js, Express, routing and middleware patterns.
- Database:
- PostgreSQL, with SQL scripts for setup.
- Computer Vision:
- YOLOv11x, Python scripts/Jupyter notebooks for training, testing, and processing video streams.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        client["Client (React PWA)"]:::frontend
    end

    subgraph "Backend Layer"
        backend["Backend API (Express)"]:::backend
    end

    subgraph "Data Layer"
        database["PostgreSQL Database"]:::database
        dbScript["Database Script (SQL Setup)"]:::script
    end

    subgraph "Computer Vision Module"
        cv["Computer Vision Module (YOLOv11x)"]:::cv
    end

    client -->|"HTTP/REST"| backend
    backend -->|"SQLQueries"| database
    backend -->|"VisionReq"| cv
    dbScript ---|"setup"| database

    click client "https://github.com/mayelbarachi/ellipsis/tree/main/client/"
    click backend "https://github.com/mayelbarachi/ellipsis/tree/main/server/"
    click database "https://github.com/mayelbarachi/ellipsis/tree/main/server/Database"
    click dbScript "https://github.com/mayelbarachi/ellipsis/blob/main/server/Database_Script.sql"
    click cv "https://github.com/mayelbarachi/ellipsis/tree/main/computer_vision/"

    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef database fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef cv fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef script fill:#E6E6FA,stroke:#000,stroke-width:2px;
```
