# gabrielvesal/library-crud architecture

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

- Interactive diagram: https://gitdiagram.com/gabrielvesal/library-crud
- Repository: https://github.com/gabrielvesal/library-crud

## Overview

##### Project type and purpose
- This is a full-stack, ASP.NET Core MVC web application called “Library CRUD,” consisting of two Visual Studio projects in one solution:
- Library (the web app)
- LogicLibrary (a class‐library containing domain models and business‐logic services)
- Its purpose is to provide Create/Read/Update/Delete operations over a collection of books, with a JSON file (Books.json) as the data store (or optionally EF for persistence).

##### File structure
- Top-level: Library.sln, README.md, LICENSE, two project folders:
- Library/ – ASP.NET Core MVC project
– Controllers/HomeController.cs
– Views/Home (Index/Add/Edit/View/Remove) + Shared layouts
– wwwroot (CSS, JS, Bootstrap, jQuery assets)
– appsettings.json (+ Development override)
– Program.cs (host builder)
– Books.json (flat-file store)
- LogicLibrary/ – .NET class library
– Models/Book.cs
– Services/BookManager.cs
- No database folder, so data layer reads/writes JSON directly (or uses EF if swapped in).

##### README for additional insights
- Confirms stack: ASP.NET Core MVC, C#, optional EF, Bootstrap
- Describes core CRUD features
- Shows data model (Book)

##### Elements
- Blue for UI components (Browser, Views, static assets)
- Green for server components (Controllers, Services)
- Orange for data (JSON file)
- Gray for external frameworks (.NET, Bootstrap)
- Rectangles for apps/services
- Hexagon or cloud for external libraries/frameworks

##### Detail without over-splitting
- Logical piece (routing, middleware, views, controller, service, model, data file)
- Don’t fragment into internal build artifacts (bin/obj folders)
- Assembly boundary between Library and LogicLibrary

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "Client Side"
        Browser["Browser"]:::ui
    end

    %% Server Side
    subgraph "Server Side"
        subgraph "Web App (Library)"
            Program["ASP.NET Core Entry Point\n(Program.cs)"]:::server
            Middleware["Static File Middleware"]:::server
            Routing["MVC Routing"]:::server
            Controller["HomeController"]:::server
            Views["Razor Views"]:::ui
            Assets["wwwroot assets"]:::ui
            CSS["site.css"]:::ui
            JS["site.js"]:::ui
            Shared["Shared Layouts & Partials"]:::ui
            ErrorModel["ErrorViewModel"]:::server
            AppSettings["appsettings.json &\nappsettings.Development.json"]:::server
            LibraryProj["Library.csproj"]:::server

            Browser -->|HTTP GET/POST| Program
            Program -->|configure pipeline| Middleware
            Middleware -->|route/static| Routing
            Routing -->|invoke| Controller
            Controller -->|renders| Views
            Views -->|HTML Response| Browser
            Controller -->|uses| BookManager
            Middleware -->|serves| Assets
            Assets -->|includes| CSS
            Assets -->|includes| JS
            Assets -->|uses| Shared
            Middleware -->|serves error| ErrorModel
            Program -->|loads config| AppSettings
        end

        subgraph "Class Library (LogicLibrary)"
            BookManager["BookManager Service"]:::server
            BookModel["Book Domain Model"]:::server
            LogicProj["LogicLibrary.csproj"]:::server

            BookManager -->|manages| BookModel
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        BooksJson["Books.json Data Store"]:::data
        BookManager -->|reads/writes| BooksJson
        BooksJson -->|returns JSON| BookManager
    end

    %% External Frameworks & Libraries
    subgraph "External Frameworks"
        DotNet[".NET 9.0 Runtime"]:::ext
        Bootstrap["Bootstrap Library"]:::ext
        jQuery["jQuery & Validation"]:::ext

        DotNet --> Program
        Bootstrap --> Assets
        jQuery --> Assets
    end

    %% Click Events
    click Program "https://github.com/gabrielvesal/library-crud/blob/main/Library/Program.cs"
    click Assets "https://github.com/gabrielvesal/library-crud/tree/main/Library/wwwroot/"
    click CSS "https://github.com/gabrielvesal/library-crud/blob/main/Library/wwwroot/css/site.css"
    click JS "https://github.com/gabrielvesal/library-crud/blob/main/Library/wwwroot/js/site.js"
    click Bootstrap "https://github.com/gabrielvesal/library-crud/tree/main/Library/wwwroot/lib/bootstrap/"
    click jQuery "https://github.com/gabrielvesal/library-crud/tree/main/Library/wwwroot/lib/jquery/"
    click Controller "https://github.com/gabrielvesal/library-crud/blob/main/Library/Controllers/HomeController.cs"
    click Views "https://github.com/gabrielvesal/library-crud/tree/main/Library/Views/Home/"
    click Shared "https://github.com/gabrielvesal/library-crud/tree/main/Library/Views/Shared/"
    click ErrorModel "https://github.com/gabrielvesal/library-crud/blob/main/Library/Models/ErrorViewModel.cs"
    click AppSettings "https://github.com/gabrielvesal/library-crud/blob/main/Library/appsettings.json"
    click BooksJson "https://github.com/gabrielvesal/library-crud/blob/main/Library/Books.json"
    click BookManager "https://github.com/gabrielvesal/library-crud/blob/main/LogicLibrary/Services/BookManager.cs"
    click BookModel "https://github.com/gabrielvesal/library-crud/blob/main/LogicLibrary/Models/Book.cs"
    click LogicProj "https://github.com/gabrielvesal/library-crud/blob/main/LogicLibrary/LogicLibrary.csproj"
    click LibraryProj "https://github.com/gabrielvesal/library-crud/blob/main/Library/Library.csproj"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#0066cc
    classDef server fill:#d4edda,stroke:#155724
    classDef data fill:#fff3cd,stroke:#856404
    classDef ext fill:#e2e3e5,stroke:#6c757d
```
