# fridec13/robocop-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/fridec13/robocop-frontend
- Repository: https://github.com/fridec13/robocop-frontend

## Overview

##### Project type and purpose
- This is a full-stack, real-time Robot Monitoring System.
- Frontend: A Vue.js 3 (Vite) SPA that displays dashboards for camera streams, LiDAR point clouds, robot status, maps, and manual controls.
- Backend: A FastAPI service exposing REST endpoints for authentication, robot management and camera status, plus WebSocket endpoints for real-time camera/video streams, monitoring data, and sensor data.
- Database: A relational store (e.g. PostgreSQL) holding Users and Robots tables.

##### File structure
- Top-level:
- backend/ – Python FastAPI app
– main.py (FastAPI app entrypoint)
– auth.py, database.py, models.py (ORM + security)
– camera_test.py, create_admin.py (utilities)
– requirements.txt, run.bat
- frontend/ – Vue 3 SPA
– public/, index.html, vite.config.js, package.json
– src/
· App.vue, router/index.js (Vue Router)
· services/ (mapService.js, websocket.js)
· stores/ (Pinia/Vuex modules)
· views/ (DashboardView, LoginView, RobotControlView, etc.)
- The clear separation of “frontend” vs. “backend” immediately suggests a classic 3-tier architecture.

##### Insights from the README
- REST API endpoints for login (/token), robot listing (/api/robots), camera status.
- WebSocket endpoints at /ws/camera/{id}, /ws/monitoring/{id}, /ws/sensor/{id} with message formats.
- Database schema for users and robots.
- Communication patterns: HTTP for request/response, WebSockets for push updates.
- Security: JWT Bearer tokens in HTTP headers and WebSocket query params; CORS policies.

##### Diagramming recommendations
- Blue = Frontend
- Green = Backend
- Orange = Data
- Grey = External
- Authentication flow (JWT retrieval and header injection).

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Presentation Layer"
        User["User Browser"]:::external
        FrontendSPA["Frontend SPA (Vue 3 + Vite)"]:::frontend
        subgraph "Entry & Configuration"
            MainJS["main.js"]:::frontend
            IndexHTML["index.html"]:::frontend
            ViteConfig["vite.config.js"]:::frontend
        end
        Router["Vue Router (router/index.js)"]:::frontend
        subgraph "Services"
            MapService["mapService.js"]:::frontend
            WSService["websocket.js"]:::frontend
        end
        Store["State Stores (src/stores/)"]:::frontend
        subgraph "UI Components"
            DashboardUI["Dashboard Components (src/components/dashboard/)"]:::frontend
        end
    end

    subgraph "Application Layer"
        BackendAPI["Backend API Service"]:::backend
        AuthMod["Authentication Module (auth.py)"]:::backend
        MainPy["App Entrypoint (main.py)"]:::backend
        DatabaseConn["Database Connection (database.py)"]:::backend
        Models["ORM Models (models.py)"]:::backend
        AdminCLI["Admin CLI Utility (create_admin.py)"]:::backend
        CameraTest["Camera Test Utility (camera_test.py)"]:::backend
    end

    subgraph "Data Layer"
        DB["Database (Users, Robots Tables)"]:::data
    end

    ExternalService["External Map Tile Service"]:::external

    User --> FrontendSPA
    FrontendSPA -->|"HTTP POST /token"| BackendAPI
    FrontendSPA -->|"HTTP GET /api/robots"| BackendAPI
    FrontendSPA -->|"HTTP GET /api/camera/status"| BackendAPI
    FrontendSPA ---|"WS /ws/camera/{id}"| BackendAPI
    FrontendSPA ---|"WS /ws/monitoring/{id}"| BackendAPI
    FrontendSPA ---|"WS /ws/sensor/{id}"| BackendAPI
    BackendAPI -->|"SQL Query Users & Robots"| DB
    FrontendSPA -->|"REST Tile Requests"| ExternalService

    click FrontendSPA "https://github.com/fridec13/robocop-frontend/tree/master/frontend/"
    click MainJS "https://github.com/fridec13/robocop-frontend/blob/master/frontend/src/main.js"
    click IndexHTML "https://github.com/fridec13/robocop-frontend/blob/master/frontend/index.html"
    click ViteConfig "https://github.com/fridec13/robocop-frontend/blob/master/frontend/vite.config.js"
    click Router "https://github.com/fridec13/robocop-frontend/blob/master/frontend/src/router/index.js"
    click MapService "https://github.com/fridec13/robocop-frontend/blob/master/frontend/src/services/mapService.js"
    click WSService "https://github.com/fridec13/robocop-frontend/blob/master/frontend/src/services/websocket.js"
    click Store "https://github.com/fridec13/robocop-frontend/tree/master/frontend/src/stores/"
    click DashboardUI "https://github.com/fridec13/robocop-frontend/tree/master/frontend/src/components/dashboard/"
    click BackendAPI "https://github.com/fridec13/robocop-frontend/blob/master/backend/main.py"
    click AuthMod "https://github.com/fridec13/robocop-frontend/blob/master/backend/auth.py"
    click MainPy "https://github.com/fridec13/robocop-frontend/blob/master/backend/main.py"
    click DatabaseConn "https://github.com/fridec13/robocop-frontend/blob/master/backend/database.py"
    click Models "https://github.com/fridec13/robocop-frontend/blob/master/backend/models.py"
    click AdminCLI "https://github.com/fridec13/robocop-frontend/blob/master/backend/create_admin.py"
    click CameraTest "https://github.com/fridec13/robocop-frontend/blob/master/backend/camera_test.py"

    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef backend fill:#DFF2D8,stroke:#22863a,color:#22863a
    classDef data fill:#FFE6C7,stroke:#cb2431,color:#cb2431
    classDef external fill:#E1E4E8,stroke:#6a737d,color:#6a737d
```
