# younisyousaf/final-year-project architecture

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

- Interactive diagram: https://gitdiagram.com/younisyousaf/final-year-project
- Repository: https://github.com/younisyousaf/final-year-project

## Overview

##### Project Overview and Purpose
- The project is a final year system that integrates several technologies to build a real-time vehicle tracking solution.
- It comprises a web-based user interface (built with React JS), a back-end REST API / business layer (using C#.Net), and a mobile application component (developed in Flutter).
- The system delivers live traffic updates, speed monitoring, and route optimization in real-time. It is intended as a robust, research-driven and innovative platform with high extensibility.

##### Identifying the Main Components
- Frontend (Web):
- Located under the “vTrack/frontend” folder, it includes two main sub-projects: a shared module (API integration, state management, common UI components) and a web application (React-based).
- It handles user authentication, asset management, live tracking views, reports, and configuration screens.
- Backend (API and Services):
- Found in “vTrack/backend”, it is subdivided into multiple layers:
- API Layer – “VTrack.Api”: contains controllers (AssetsController, DevicesController, HealthController, etc.) and even SignalR hubs (for real-time notifications).
- Business/Service Layer – “VTrack.Api.Services” and “VTrack.Core.Services”: responsible for application logic (asset management, device operations, location filtering, identity server integration for authentication, etc.).
- Data Access – “VTrack.DataAccess” and its “Mongo” subdirectory: provides repository patterns, data models, and abstraction over the database (likely a MongoDB instance or possibly SQL, with the possibility of a SQL backend as mentioned in the README).
- Testing and Auxiliary Projects – including device simulation “VTrack.Listener.DeviceSimulator” (for generating live tracking data) and various tests.
- Mobile App:
- Under “vehicle_tracking_mobile_app”, implemented in Flutter, with separate directories for Android, iOS, and other platform-specific configurations.
- This component interacts with the back-end to send real-time data from smartphones and display tracking info.

##### Architectural Patterns and Interactions
- Layered Architecture / Separation of Concerns:
- The back-end is clearly divided into API controllers, service logic, and data access layers. This enforces separation of concerns and easier testability.
- Real-time communication:
- The API layer includes a SignalR hub and a Listener which likely supports device simulation and real-time data push to the frontend.
- Microservices/Modular Services:
- Although packaged in a single repository, different modules like identity services, asset management, device management, and reporting are separated into distinct projects.
- Containerization and CI/CD:
- Presence of Dockerfiles, docker-compose files, and GitHub workflows indicates that containerization is used for deployment and there is an automated CI/CD pipeline.

##### Relevant Technologies and Tools
- Frontend:
- React JS, state management (custom hooks and possibly context APIs), Orval (for API code generation), and Tailwind CSS for styling.
- Backend:
- C#.Net, ASP.NET Core Web API, SignalR for real-time data, Identity Server for authentication, and a repository/data access pattern likely abstracting a Mongo or SQL database.
- Mobile:
- Flutter for building Android, iOS, and other cross-platform mobile apps.
- Additional DevOps:
- Docker for containerization, GitHub actions for continuous integration, and build scripts for managing container images.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Components
    subgraph "Frontend"
        FE("React Web App"):::frontend
        FEShared("Shared API Integration"):::frontend
    end

    %% Mobile Application
    subgraph "Mobile App"
        Mobile("Flutter Mobile App"):::mobile
    end

    %% Backend Layers
    subgraph "Backend API Layer"
        APIControllers("API Controllers/REST Endpoints"):::backend
        SignalR("Real-Time Communication (SignalR Hub)"):::backend
    end

    subgraph "Backend Business & Service Layer"
        BusServices("Primary Business Services"):::backend2
        CoreServices("Core Core Services"):::backend2
    end

    subgraph "Data Access Layer"
        DataAccess("Repository & Data Models"):::data
        MongoDB("MongoDB Implementations"):::data
    end

    DS("Device Simulation/Listener"):::device

    %% Interactions
    FE -->|"API_call"| APIControllers
    Mobile -->|"API_call"| APIControllers
    APIControllers -->|"calls_logic"| BusServices
    APIControllers -->|"calls_logic"| CoreServices
    BusServices -->|"data_ops"| DataAccess
    CoreServices -->|"data_ops"| DataAccess
    DataAccess -->|"uses"| MongoDB
    DS -->|"sends_data"| SignalR
    SignalR -->|"pushes_update"| FE

    %% Click Events
    click FE "https://github.com/younisyousaf/final-year-project/tree/main/vTrack/frontend/web"
    click FEShared "https://github.com/younisyousaf/final-year-project/tree/main/vTrack/frontend/shared"
    click APIControllers "https://github.com/younisyousaf/final-year-project/tree/main/vTrack/backend/VTrack.Api/Controllers"
    click SignalR "https://github.com/younisyousaf/final-year-project/blob/main/vTrack/backend/VTrack.Api/Hubs/AssetsHub.cs"
    click BusServices "https://github.com/younisyousaf/final-year-project/blob/main/vTrack/backend/VTrack.Api.Services"
    click CoreServices "https://github.com/younisyousaf/final-year-project/blob/main/vTrack/backend/VTrack.Core.Services"
    click DataAccess "https://github.com/younisyousaf/final-year-project/blob/main/vTrack/backend/VTrack.DataAccess"
    click MongoDB "https://github.com/younisyousaf/final-year-project/tree/main/vTrack/backend/VTrack.DataAccess/Mongo"
    click DS "https://github.com/younisyousaf/final-year-project/blob/main/vTrack/backend/VTrack.Listener.DeviceSimulator"
    click Mobile "https://github.com/younisyousaf/final-year-project/tree/main/vehicle_tracking_mobile_app"

    %% Styles
    classDef frontend fill:#CDEAFF,stroke:#0275d8,stroke-width:2px;
    classDef mobile fill:#D6E9C6,stroke:#3c763d,stroke-width:2px;
    classDef backend fill:#FFF3CD,stroke:#856404,stroke-width:2px;
    classDef backend2 fill:#FFE0B2,stroke:#FF9800,stroke-width:2px;
    classDef data fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef device fill:#F8D7DA,stroke:#721c24,stroke-width:2px;
```
