# eloaranha/dashboardfinanceiro architecture

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

- Interactive diagram: https://gitdiagram.com/eloaranha/dashboardfinanceiro
- Repository: https://github.com/eloaranha/dashboardfinanceiro

## Overview

##### Project Type and Purpose
- This is a full-stack ASP.NET Core MVC web application (“DashboardFinanceiro”) for managing and visualizing financial invoices (notas fiscais).
- It serves HTML/Razor views enriched with JavaScript on the front end, exposing controller endpoints on the back end, persisting data in a SQL Server database, and is containerized via Docker.

##### File Structure Analysis
- Top-level entry point and configuration:
- Program.cs (application bootstrap, middleware pipeline)
- appsettings.json / appsettings.Development.json (configuration)
- Dockerfile, docker-compose.yml (container definitions)
- MVC layers:
- Controllers/ (HomeController, NotasFiscaisController)
- Models/ (NotaFiscal, ErrorViewModel, and possibly DashboardData)
- Views/ (Razor pages under Views/Home and shared layout/views under Views/Shared)
- Static assets in wwwroot/ (css, js, images, lib with Bootstrap and jQuery)
- Data and service abstractions (as referenced in README):
- Data/FinanceiroDbContext.cs (EF Core DbContext)
- Services/INotasFiscaisService.cs, NotasFiscaisService.cs

##### Extracted Architecture Patterns
- MVC pattern separating View (Razor + static assets), Controller (HTTP endpoints), Model (domain entities).
- Layered architecture:
- Presentation layer (Views + client-side JS)
- Application/API layer (Controllers)
- Business logic layer (Services via dependency injection)
- Data access layer (EF Core DbContext communicating with SQL Server)
- Dependency Injection throughout (built into ASP.NET Core).
- Containerized deployment (Docker, Compose).

##### Main Components
a. Client Browser (HTML, CSS, JavaScript, Razor-rendered pages)
b. ASP.NET Core Web Application
– Program.cs hosting Kestrel
– Controllers (HomeController, NotasFiscaisController)
– Services (INotasFiscaisService, NotasFiscaisService)
– Data Access (FinanceiroDbContext using EF Core)
c. Database Server (SQL Server)
d. Infrastructure / Deployment
– Docker container image running the .NET app
– Docker-Compose orchestrating multi-container (app + database)

##### Relationships and Data Flows
- Browser → HTTP(S) → Kestrel server (Program.cs)
- Kestrel → Controller action → (via DI) Service → DbContext → SQL Server
- Controller returns ViewResult (HTML) or JSON (for API endpoints)
- Static files (wwwroot) served directly by Kestrel
- Docker Compose links the app container with the database container

##### Capturing Essential Elements
- Cross-cutting concerns injected via Program.cs (logging, configuration).
- Static asset pipeline (wwwroot → delivered by Kestrel).
- Docker Compose networks between “DashboardFinanceiro” container and “SQL Server” container.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph "Client Browser"
        direction TB
        Browser["Client Browser"]:::frontend
        StaticAssets["Static Assets (wwwroot)"]:::frontend
    end

    %% Web Application Layer
    subgraph "DashboardFinanceiro Web App"
        direction TB
        Program["Program.cs (Kestrel & Middleware)"]:::backend
        subgraph Controllers
            direction TB
            HomeCtrl["HomeController"]:::backend
            NotasCtrl["NotasFiscaisController"]:::backend
        end
        subgraph Services
            direction TB
            INotasSvc["INotasFiscaisService"]:::backend
            NotasSvc["NotasFiscaisService"]:::backend
        end
        subgraph "Data Access"
            direction TB
            DbContext["FinanceiroDbContext (EF Core)"]:::backend
        end
    end

    %% Database Layer
    SQLServer["SQL Server Database"]:::database

    %% Infrastructure
    subgraph "Docker Infrastructure"
        direction TB
        DockerApp["App Container"]:::infra
        DockerDB["DB Container"]:::infra
        Compose["docker-compose.yml"]:::infra
    end

    %% Relationships
    Browser -->|"HTTP GET/POST"| Program
    Browser -->|Requests static files| StaticAssets
    StaticAssets -->|Served by| Program

    Program -->|"routes to"| HomeCtrl
    Program -->|"routes to"| NotasCtrl

    HomeCtrl -->|"calls"| INotasSvc
    NotasCtrl -->|"calls"| INotasSvc

    INotasSvc -->|"implements"| NotasSvc
    NotasSvc -->|"uses"| DbContext
    DbContext -->|"EF Core queries"| SQLServer

    HomeCtrl -->|"returns View"| Browser
    NotasCtrl -->|"returns JSON/XML"| Browser

    DockerApp -->|Runs| Program
    DockerDB -->|Hosts| SQLServer
    Compose -->|orchestrates| DockerApp
    Compose -->|orchestrates| DockerDB

    %% Click Events
    click StaticAssets "https://github.com/eloaranha/dashboardfinanceiro/tree/main/wwwroot/"
    click Program "https://github.com/eloaranha/dashboardfinanceiro/blob/main/Program.cs"
    click HomeCtrl "https://github.com/eloaranha/dashboardfinanceiro/blob/main/Controllers/HomeController.cs"
    click NotasCtrl "https://github.com/eloaranha/dashboardfinanceiro/blob/main/Controllers/NotasFiscaisController.cs"
    click SQLServer "https://github.com/eloaranha/dashboardfinanceiro/blob/main/appsettings.json"
    click Compose "https://github.com/eloaranha/dashboardfinanceiro/blob/main/docker-compose.yml"

    %% Styles
    classDef frontend fill:#D6E9FF,stroke:#5B9BD5,stroke-width:1px
    classDef backend fill:#E6F5E6,stroke:#3C763D,stroke-width:1px
    classDef database fill:#FFE6CC,stroke:#D26900,stroke-width:1px,stroke-dasharray: 5 5
    classDef infra fill:#F2F2F2,stroke:#666666,stroke-width:1px,stroke-dasharray: 2 2
```
