# lebaohuflit06/librarymanagement architecture

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

- Interactive diagram: https://gitdiagram.com/lebaohuflit06/librarymanagement
- Repository: https://github.com/lebaohuflit06/librarymanagement

## Overview

Thư viện Sách Việt is an ASP.NET Core MVC library-catalogue and membership app backed by SQLite. Visitors can browse the home page, search and filter books, and view book details; account registration/login enables the separate library-card registration and card-view workflow. Controllers own these operations and use EF Core for persisted data; account actions also establish cookie sessions. The README confirms SQLite and first-run database creation. View links follow MVC conventions, but the view contents were not sampled, so those relationships are shown as unverified.

Main entry points: [`Data/AppDbContext.cs`](https://github.com/lebaohuflit06/librarymanagement/blob/master/Data/AppDbContext.cs) (EF Core context and seed data), [`Controllers/BooksController.cs`](https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/BooksController.cs) (Book search and details), [`Controllers/AccountController.cs`](https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/AccountController.cs) (Account registration and login), [`Controllers/HomeController.cs`](https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/HomeController.cs) (Home summary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry"]
  node_program["App startup and routing<br/>[Program.cs]"]
  node_cookie["Cookie authentication"]
end

subgraph group_catalog["Catalogue"]
  node_home["Home summary<br/>[HomeController.cs]"]
  node_books["Book search and details<br/>[BooksController.cs]"]
  node_text["Vietnamese text normalization<br/>[TextHelper.cs]"]
  node_homeview["Home page<br/>[Index.cshtml]"]
  node_bookindexview["Book list page<br/>[Index.cshtml]"]
  node_bookdetailsview["Book details page<br/>[Details.cshtml]"]
end

subgraph group_membership["Membership"]
  node_account["Account registration and login"]
  node_card["Library card registration and view"]
  node_loginview["Login page<br/>[Login.cshtml]"]
  node_registerview["Account registration page<br/>[Register.cshtml]"]
  node_cardindexview["Card page<br/>[Index.cshtml]"]
  node_cardregisterview["Card registration page<br/>[Register.cshtml]"]
end

subgraph group_data["Data and models"]
  node_dbcontext["EF Core context and seed data<br/>[AppDbContext.cs]"]
  node_sqlite[("SQLite database")]
  node_bookmodel["Book entity<br/>[Book.cs]"]
  node_usermodel["User entity<br/>[AppUser.cs]"]
  node_cardmodel["Library card entity<br/>[LibraryCard.cs]"]
  node_viewmodels["Workflow view models<br/>[ViewModels.cs]"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests pages"| node_program
node_program -->|"configures and initializes"| node_dbcontext
node_program -->|"configures"| node_cookie
node_program -->|"routes requests"| node_home
node_visitor -.->|"requests home"| node_home
node_visitor -.->|"requests catalogue"| node_books
node_visitor -.->|"submits credentials"| node_account
node_home -->|"reads catalogue and counts"| node_dbcontext
node_books -->|"reads books"| node_dbcontext
node_books -->|"normalizes search"| node_text
node_account -->|"reads and writes users"| node_dbcontext
node_account -->|"signs in and out"| node_cookie
node_card -->|"reads and writes cards"| node_dbcontext
node_dbcontext -->|"persists data"| node_sqlite
node_dbcontext -->|"maps and seeds"| node_bookmodel
node_dbcontext -->|"maps users"| node_usermodel
node_dbcontext -->|"maps cards"| node_cardmodel
node_usermodel -->|"has optional card"| node_cardmodel
node_home -->|"builds summary"| node_viewmodels
node_books -->|"builds book list"| node_viewmodels
node_home -.->|"renders"| node_homeview
node_books -.->|"renders"| node_bookindexview
node_books -.->|"renders"| node_bookdetailsview
node_account -.->|"renders"| node_loginview
node_account -.->|"renders"| node_registerview
node_card -.->|"renders"| node_cardindexview
node_card -.->|"renders"| node_cardregisterview

click node_program "https://github.com/lebaohuflit06/librarymanagement/blob/master/Program.cs"
click node_home "https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/HomeController.cs"
click node_books "https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/BooksController.cs"
click node_text "https://github.com/lebaohuflit06/librarymanagement/blob/master/Helpers/TextHelper.cs"
click node_account "https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/AccountController.cs"
click node_card "https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/LibraryCardController.cs"
click node_dbcontext "https://github.com/lebaohuflit06/librarymanagement/blob/master/Data/AppDbContext.cs"
click node_bookmodel "https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/Book.cs"
click node_usermodel "https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/AppUser.cs"
click node_cardmodel "https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/LibraryCard.cs"
click node_viewmodels "https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/ViewModels.cs"
click node_homeview "https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Home/Index.cshtml"
click node_bookindexview "https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Books/Index.cshtml"
click node_bookdetailsview "https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Books/Details.cshtml"
click node_loginview "https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Account/Login.cshtml"
click node_registerview "https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Account/Register.cshtml"
click node_cardindexview "https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/LibraryCard/Index.cshtml"
click node_cardregisterview "https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/LibraryCard/Register.cshtml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_cookie toneBlue
class node_home,node_books,node_text,node_homeview,node_bookindexview,node_bookdetailsview toneAmber
class node_account,node_card,node_loginview,node_registerview,node_cardindexview,node_cardregisterview toneMint
class node_dbcontext,node_sqlite,node_bookmodel,node_usermodel,node_cardmodel,node_viewmodels toneRose
class node_visitor toneIndigo
```

## Components

### Web entry

- [App startup and routing](https://github.com/lebaohuflit06/librarymanagement/blob/master/Program.cs): `Program.cs`
- **Cookie authentication**

### Catalogue

- [Home summary](https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/HomeController.cs): `Controllers/HomeController.cs`
- [Book search and details](https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/BooksController.cs): `Controllers/BooksController.cs`
- [Vietnamese text normalization](https://github.com/lebaohuflit06/librarymanagement/blob/master/Helpers/TextHelper.cs): `Helpers/TextHelper.cs`
- [Home page](https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Home/Index.cshtml): `Views/Home/Index.cshtml`
- [Book list page](https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Books/Index.cshtml): `Views/Books/Index.cshtml`
- [Book details page](https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Books/Details.cshtml): `Views/Books/Details.cshtml`

### Membership

- [Account registration and login](https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/AccountController.cs): `Controllers/AccountController.cs`
- [Library card registration and view](https://github.com/lebaohuflit06/librarymanagement/blob/master/Controllers/LibraryCardController.cs): `Controllers/LibraryCardController.cs`
- [Login page](https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Account/Login.cshtml): `Views/Account/Login.cshtml`
- [Account registration page](https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/Account/Register.cshtml): `Views/Account/Register.cshtml`
- [Card page](https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/LibraryCard/Index.cshtml): `Views/LibraryCard/Index.cshtml`
- [Card registration page](https://github.com/lebaohuflit06/librarymanagement/blob/master/Views/LibraryCard/Register.cshtml): `Views/LibraryCard/Register.cshtml`

### Data and models

- [EF Core context and seed data](https://github.com/lebaohuflit06/librarymanagement/blob/master/Data/AppDbContext.cs): `Data/AppDbContext.cs`
- **SQLite database**
- [Book entity](https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/Book.cs): `Models/Book.cs`
- [User entity](https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/AppUser.cs): `Models/AppUser.cs`
- [Library card entity](https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/LibraryCard.cs): `Models/LibraryCard.cs`
- [Workflow view models](https://github.com/lebaohuflit06/librarymanagement/blob/master/Models/ViewModels.cs): `Models/ViewModels.cs`

### Other components

- **Visitor**

## Connections

- Visitor → App startup and routing: requests pages (evidence: `Program.cs`)
- App startup and routing → EF Core context and seed data: configures and initializes (evidence: `Program.cs`)
- App startup and routing → Cookie authentication: configures (evidence: `Program.cs`)
- App startup and routing → Home summary: routes requests (evidence: `Program.cs`)
- Visitor → Home summary: requests home
- Visitor → Book search and details: requests catalogue
- Visitor → Account registration and login: submits credentials
- Home summary → EF Core context and seed data: reads catalogue and counts (evidence: `Controllers/HomeController.cs`)
- Book search and details → EF Core context and seed data: reads books (evidence: `Controllers/BooksController.cs`)
- Book search and details → Vietnamese text normalization: normalizes search (evidence: `Controllers/BooksController.cs`)
- Account registration and login → EF Core context and seed data: reads and writes users (evidence: `Controllers/AccountController.cs`)
- Account registration and login → Cookie authentication: signs in and out (evidence: `Controllers/AccountController.cs`)
- Library card registration and view → EF Core context and seed data: reads and writes cards (evidence: `Controllers/LibraryCardController.cs`)
- EF Core context and seed data → SQLite database: persists data
- EF Core context and seed data → Book entity: maps and seeds (evidence: `Data/AppDbContext.cs`)
- EF Core context and seed data → User entity: maps users (evidence: `Data/AppDbContext.cs`)
- EF Core context and seed data → Library card entity: maps cards (evidence: `Data/AppDbContext.cs`)
- User entity → Library card entity: has optional card (evidence: `Models/AppUser.cs`)
- Home summary → Workflow view models: builds summary (evidence: `Controllers/HomeController.cs`)
- Book search and details → Workflow view models: builds book list (evidence: `Controllers/BooksController.cs`)
- Home summary → Home page: renders
- Book search and details → Book list page: renders
- Book search and details → Book details page: renders
- Account registration and login → Login page: renders
- Account registration and login → Account registration page: renders
- Library card registration and view → Card page: renders
- Library card registration and view → Card registration page: renders
