# passossss/emprestimobooks architecture

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

- Interactive diagram: https://gitdiagram.com/passossss/emprestimobooks
- Repository: https://github.com/passossss/emprestimobooks

## Overview

##### Project type and purpose
- This is a full-stack ASP.NET Core MVC web application (“EmprestimoBooks” / “SistemaLivros” solution) that implements a book-lending system with user registration, login, loan management, and contact forms.

##### File structure
- Top-level project folder “SistemaLivros” contains:
- Controllers (MVC controllers for HTTP endpoints)
- Views (Razor .cshtml files + shared layouts + static assets under wwwroot)
- Models (domain entities like UsuarioModel, EmprestimoModel, ContatoModel)
- Dto (data transfer objects for login/register)
- Services (business-logic services and interfaces: Login, Senha/Password, Sessao/Session, Emprestimo/Loan)
- Data (Entity Framework Core DbContext) & Migrations (code-first database schema)
- Program.cs + appsettings.json (application startup & configuration)

##### Detailed component breakdown
- Browser / Client
- wwwroot (static assets)
- Razor Views & Shared Layouts
- Controllers (HomeController, LoginController, EmprestimoController, ContatoController)
- DTOs (UsuarioLoginDto, UsuarioRegisterDto)
- Services & Interfaces (LoginService, ILoginInterface, SenhaService, ISenhaInterface, SessaoService, ISessaoInterface, EmprestimosService, IEmprestimosInterface)
- Data Layer (ApplicationDbContext, Migrations classes)
- Database (e.g., SQL Server)

##### Final advice
- Review controllers and services to ensure no hidden dependencies are missed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser (Client)"]:::external

    subgraph "Presentation Layer"
        wwwroot["wwwroot (Static Assets)"]:::presentation
        subgraph "Razor Views"
            Views["Views"]:::presentation
            Shared["_Layout Shared Views"]:::presentation
            HomeViews["Home Views"]:::presentation
            LoginViews["Login Views"]:::presentation
            EmprestimoViews["Emprestimo Views"]:::presentation
            ContatoViews["Contato Views"]:::presentation
        end
    end

    subgraph "Business Logic Layer"
        subgraph "Controllers"
            HomeController["HomeController"]:::backend
            LoginController["LoginController"]:::backend
            EmprestimoController["EmprestimoController"]:::backend
            ContatoController["ContatoController"]:::backend
        end
        subgraph "DTOs"
            UsuarioLoginDto["UsuarioLoginDto"]:::backend
            UsuarioRegisterDto["UsuarioRegisterDto"]:::backend
        end
        subgraph "Services"
            LoginService["LoginService"]:::backend
            SenhaService["SenhaService"]:::backend
            SessaoService["SessaoService"]:::backend
            EmprestimoService["EmprestimoService"]:::backend
        end
    end

    subgraph "Data Access Layer"
        ApplicationDbContext["ApplicationDbContext"]:::data
        Migrations["Migrations"]:::data
    end

    Database["Database (SQL Server)"]:::external

    %% Relationships
    Browser --> wwwroot
    Browser --> HomeController
    Browser --> LoginController
    Browser --> EmprestimoController
    Browser --> ContatoController
    HomeController --> Views
    LoginController --> Views
    EmprestimoController --> Views
    ContatoController --> Views
    HomeController --> UsuarioLoginDto
    HomeController --> UsuarioRegisterDto
    LoginController --> UsuarioLoginDto
    LoginController --> UsuarioRegisterDto
    HomeController --> LoginService
    LoginController --> LoginService
    HomeController --> SenhaService
    LoginController --> SenhaService
    HomeController --> SessaoService
    LoginController --> SessaoService
    EmprestimoController --> EmprestimoService
    EmprestimoController --> SessaoService
    ContatoController --> SessaoService
    LoginService --> ApplicationDbContext
    SenhaService --> ApplicationDbContext
    SessaoService --> ApplicationDbContext
    EmprestimoService --> ApplicationDbContext
    ApplicationDbContext --> Database
    Migrations -.-> Database

    %% Click Events
    click wwwroot "https://github.com/passossss/emprestimobooks/tree/master/SistemaLivros/wwwroot"
    click Views "https://github.com/passossss/emprestimobooks/tree/master/SistemaLivros/Views"
    click Shared "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Views/Shared/_Layout.cshtml"
    click HomeViews "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Views/Home/Index.cshtml"
    click LoginViews "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Views/Login/Login.cshtml"
    click EmprestimoViews "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Views/Emprestimo/Index.cshtml"
    click ContatoViews "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Views/Contato/Index.cshtml"
    click HomeController "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Controllers/HomeController.cs"
    click LoginController "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Controllers/LoginController.cs"
    click EmprestimoController "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Controllers/EmprestimoController.cs"
    click ContatoController "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Controllers/ContatoController.cs"
    click UsuarioLoginDto "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Dto/UsuarioLoginDto.cs"
    click UsuarioRegisterDto "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Dto/UsuarioRegisterDto.cs"
    click LoginService "https://github.com/passossss/emprestimobooks/tree/master/SistemaLivros/Services/LoginService"
    click SenhaService "https://github.com/passossss/emprestimobooks/tree/master/SistemaLivros/Services/SenhaService"
    click SessaoService "https://github.com/passossss/emprestimobooks/tree/master/SistemaLivros/Services/SessaoService"
    click EmprestimoService "https://github.com/passossss/emprestimobooks/tree/master/SistemaLivros/Services/EmprestimoService"
    click ApplicationDbContext "https://github.com/passossss/emprestimobooks/blob/master/SistemaLivros/Data/ApplicationDbContext.cs"
    click Migrations "https://github.com/passossss/emprestimobooks/tree/master/SistemaLivros/Migrations"

    %% Styles
    classDef presentation fill:#D0E6FF,stroke:#0066CC,color:#003366
    classDef backend fill:#DFFFD0,stroke:#4CAF50,color:#336633
    classDef data fill:#FFF4C1,stroke:#FFB300,color:#997000
    classDef external fill:#FFE0CC,stroke:#FF5722,color:#993D00
```
