# pabloeferreyra/turnero architecture

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

- Interactive diagram: https://gitdiagram.com/pabloeferreyra/turnero
- Repository: https://github.com/pabloeferreyra/turnero

## Overview

##### Project type and purpose
- This is a full-stack, monolithic ASP.NET Core (Net 8) Razor web application named “Turnero.”
- Purpose: allow users (with different roles) to manage and view service shifts (turnos) in real time, with PWA support, desktop notifications, and SignalR for live updates.

##### File structure
- Top-level directories:
- Areas/Identity: built-in Razor Pages for user/login/roles.
- Controllers: MVC controllers for UI endpoints and Firebase callbacks.
- Views & wwwroot: server-rendered Razor views, static assets (JS/CSS, PWA manifest, service worker).
- Hubs: SignalR hubs for real-time communication.
- Turnero.DAL: Data Access Layer (EF Core DbContext, migrations, Postgres targeting).
- Turnero.SL: Service Layer (business logic, application services, repositories, Firebase integration).
- Turnero.Utilities: shared utilities (AutoMapper profiles, constants).
- Turnero.Test: unit tests for service methods and repositories.
- CI/CD: GitHub workflows for build, test, deploy.

##### README for tech stack & features
- .NET 8, Razor, jQuery, Bootstrap, SignalR, PostgreSQL, PWA, desktop notifications, Firebase for push/auth.
- Features: user roles, multi-platform (web + PWA + desktop notifications).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Side
    subgraph "Client Side"
        Browser["Web Browser<br/>(Desktop/Mobile)"]:::ui
        PWA["PWA Service Worker"]:::ui
        Static["Static Assets<br/>(CSS/JS, manifest, service-worker.js)"]:::ui
    end

    %% Server Side
    subgraph "Server Side"
        Program["Program.cs"]:::server
        subgraph "Presentation Layer"
            Identity["Areas/Identity"]:::server
            Controllers["Controllers"]:::server
            Views["Views"]:::server
        end
        subgraph "Real-time Layer"
            Hub["TurnsTableHub"]:::server
        end
        subgraph "Business Layer"
            GetTurns["GetTurnsService"]:::server
            FirebaseSvc["FirebaseService"]:::server
            LoggerSvc["LoggerService"]:::server
        end
        subgraph "Data Access Layer"
            DbContext["ApplicationDbContext"]:::data
            Repos["Repositories"]:::data
        end
        subgraph "Shared Utilities"
            Utilities["Utilities"]:::server
        end
    end

    %% External Services and Infra
    subgraph "External Services & Infra"
        Postgres["PostgreSQL"]:::external
        FirebaseAPI["Firebase API"]:::external
        CI["GitHub Actions"]:::cicd
    end

    %% Data Flows
    Browser -->|HTTP Requests| Controllers
    Controllers -->|invoke| GetTurns
    GetTurns -->|EF Core Queries| DbContext
    DbContext -->|reads/writes| Postgres
    Controllers -->|renders| Views
    Browser -->|loads| Static
    Browser -->|WebSocket| Hub
    Hub -->|calls| GetTurns
    GetTurns -->|broadcast| Hub
    Controllers -->|uses| FirebaseSvc
    FirebaseSvc -->|REST Calls| FirebaseAPI
    Identity -->|stores identities| DbContext
    DbContext -->|persists| Identity
    Program -->|configures DI & Middleware| Controllers
    Program -->|configures| Hub
    Program -->|registers| GetTurns
    Program -->|registers| DbContext
    Utilities -->|profiles & constants| GetTurns

    CI -->|build/test/deploy| Program

    %% Click Events
    click Identity "https://github.com/pabloeferreyra/turnero/tree/master/Areas/Identity"
    click Controllers "https://github.com/pabloeferreyra/turnero/tree/master/Controllers/"
    click Views "https://github.com/pabloeferreyra/turnero/tree/master/Views/"
    click Static "https://github.com/pabloeferreyra/turnero/tree/master/wwwroot/"
    click Hub "https://github.com/pabloeferreyra/turnero/blob/master/Hubs/TurnsTableHub.cs"
    click Program "https://github.com/pabloeferreyra/turnero/blob/master/Program.cs"
    click DbContext "https://github.com/pabloeferreyra/turnero/blob/master/Turnero.DAL/Data/ApplicationDbContext.cs"
    click Repos "https://github.com/pabloeferreyra/turnero/tree/master/Turnero.DAL/Migrations/"
    click Repos "https://github.com/pabloeferreyra/turnero/tree/master/Turnero.DAL/Models/"
    click GetTurns "https://github.com/pabloeferreyra/turnero/tree/master/Turnero.SL/Services/"
    click Utilities "https://github.com/pabloeferreyra/turnero/tree/master/Turnero.Utilities/Utilities/"
    click CI "https://github.com/pabloeferreyra/turnero/tree/master/.github/workflows/"
    click Browser "https://github.com/pabloeferreyra/turnero/blob/master/appsettings.json"

    %% Styles
    classDef ui fill:#D6E4FF,stroke:#0366d6,color:#0366d6;
    classDef server fill:#D0F0C0,stroke:#228B22,color:#006400;
    classDef data fill:#FFF4C1,stroke:#DAA520,color:#B8860B;
    classDef external fill:#FFD8A8,stroke:#FF8C00,color:#D2691E;
    classDef cicd fill:#D3D3D3,stroke:#696969,color:#333333;
```
