# tmuhammadqodir/libraryofbooks architecture

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

- Interactive diagram: https://gitdiagram.com/tmuhammadqodir/libraryofbooks
- Repository: https://github.com/tmuhammadqodir/libraryofbooks

## Overview

LibraryOfBooks is an online library with a Blazor UI and ASP.NET Web API: users can sign in, browse books, and add books of their own. The principal flow is UI requests to API endpoints, service-layer book handling, and persistence; book creation also uploads image and document assets. The product includes categories, user accounts, comments, favorites, likes, and profile assets. The excerpts show book-service persistence and asset calls, but not all controller-to-service wiring or UI request targets, so those links are marked unverified or omitted.

Main entry points: [`src/LibraryOfBooks.WebApi/Controllers`](https://github.com/tmuhammadqodir/libraryofbooks/tree/main/src/LibraryOfBooks.WebApi/Controllers) (API endpoints), [`src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs`](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs) (Library database), [`web/LibraryOfBooks.Web/Program.cs`](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/web/LibraryOfBooks.Web/Program.cs) (Library UI), [`src/LibraryOfBooks.Service/Services/BookService.cs`](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/BookService.cs) (Book catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Blazor client"]
  node_ui["Library UI<br/>[Program.cs]"]
  node_clientservices["Client services<br/>[Services]"]
  node_authstate["Auth state"]
end

subgraph group_api["HTTP API"]
  node_controllers["API endpoints<br/>[Controllers]"]
  node_exceptionhandler["Error handling"]
end

subgraph group_services["Application services"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_books["Book catalog<br/>[BookService.cs]"]
  node_categories["Categories"]
  node_users["User accounts<br/>[UserService.cs]"]
  node_comments["Comments<br/>[CommentService.cs]"]
  node_assets["Asset files<br/>[AssetService.cs]"]
end

subgraph group_data["Data and domain"]
  node_repository["Generic repository<br/>[Repository.cs]"]
  node_db[("Library database<br/>[AppDbContext.cs]")]
  node_bookmodel["Book model<br/>[Book.cs]"]
  node_usermodel["User model<br/>[User.cs]"]
  node_categorymodel["Category model<br/>[BookCategory.cs]"]
  node_assetmodel["Asset model<br/>[Asset.cs]"]
end

node_reader(("Library user"))

node_reader -->|"uses"| node_ui
node_ui -.->|"invokes"| node_clientservices
node_clientservices -.->|"requests"| node_controllers
node_ui -->|"tracks sign-in"| node_authstate
node_controllers -.->|"dispatches"| node_auth
node_controllers -.->|"dispatches"| node_books
node_controllers -.->|"dispatches"| node_categories
node_controllers -.->|"dispatches"| node_users
node_controllers -.->|"dispatches"| node_comments
node_books -->|"reads and writes"| node_repository
node_books -->|"uploads and removes"| node_assets
node_auth -->|"looks up user"| node_repository
node_repository -->|"queries and saves"| node_db
node_db -->|"maps"| node_bookmodel
node_db -->|"maps"| node_usermodel
node_db -->|"maps"| node_categorymodel
node_db -->|"maps"| node_assetmodel

click node_ui "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/web/LibraryOfBooks.Web/Program.cs"
click node_clientservices "https://github.com/tmuhammadqodir/libraryofbooks/tree/main/web/LibraryOfBooks.Web/Services"
click node_authstate "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/web/LibraryOfBooks.Web/Services/CustomAuthenticationStateProvider.cs"
click node_controllers "https://github.com/tmuhammadqodir/libraryofbooks/tree/main/src/LibraryOfBooks.WebApi/Controllers"
click node_exceptionhandler "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.WebApi/Middlewares/ExceptionHandlerMiddleware.cs"
click node_auth "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/AuthService.cs"
click node_books "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/BookService.cs"
click node_categories "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/BookCategoryService.cs"
click node_users "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/UserService.cs"
click node_comments "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/CommentService.cs"
click node_assets "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/AssetService.cs"
click node_repository "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.DataAccess/Repositories/Repository.cs"
click node_db "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs"
click node_bookmodel "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/Book.cs"
click node_usermodel "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/User.cs"
click node_categorymodel "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/BookCategory.cs"
click node_assetmodel "https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/Asset.cs"

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_ui,node_clientservices,node_authstate,node_reader toneBlue
class node_controllers,node_exceptionhandler toneAmber
class node_auth,node_books,node_categories,node_users,node_comments,node_assets toneMint
class node_repository,node_db,node_bookmodel,node_usermodel,node_categorymodel,node_assetmodel toneRose
```

## Components

### Blazor client

- [Library UI](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/web/LibraryOfBooks.Web/Program.cs): `web/LibraryOfBooks.Web/Program.cs`
- [Client services](https://github.com/tmuhammadqodir/libraryofbooks/tree/main/web/LibraryOfBooks.Web/Services): `web/LibraryOfBooks.Web/Services`
- [Auth state](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/web/LibraryOfBooks.Web/Services/CustomAuthenticationStateProvider.cs): `web/LibraryOfBooks.Web/Services/CustomAuthenticationStateProvider.cs`

### HTTP API

- [API endpoints](https://github.com/tmuhammadqodir/libraryofbooks/tree/main/src/LibraryOfBooks.WebApi/Controllers): `src/LibraryOfBooks.WebApi/Controllers`
- [Error handling](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.WebApi/Middlewares/ExceptionHandlerMiddleware.cs): `src/LibraryOfBooks.WebApi/Middlewares/ExceptionHandlerMiddleware.cs`

### Application services

- [Authentication](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/AuthService.cs): `src/LibraryOfBooks.Service/Services/AuthService.cs`
- [Book catalog](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/BookService.cs): `src/LibraryOfBooks.Service/Services/BookService.cs`
- [Categories](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/BookCategoryService.cs): `src/LibraryOfBooks.Service/Services/BookCategoryService.cs`
- [User accounts](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/UserService.cs): `src/LibraryOfBooks.Service/Services/UserService.cs`
- [Comments](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/CommentService.cs): `src/LibraryOfBooks.Service/Services/CommentService.cs`
- [Asset files](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Service/Services/AssetService.cs): `src/LibraryOfBooks.Service/Services/AssetService.cs`

### Data and domain

- [Generic repository](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.DataAccess/Repositories/Repository.cs): `src/LibraryOfBooks.DataAccess/Repositories/Repository.cs`
- [Library database](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs): `src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs`
- [Book model](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/Book.cs): `src/LibraryOfBooks.Domain/Entities/Book.cs`
- [User model](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/User.cs): `src/LibraryOfBooks.Domain/Entities/User.cs`
- [Category model](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/BookCategory.cs): `src/LibraryOfBooks.Domain/Entities/BookCategory.cs`
- [Asset model](https://github.com/tmuhammadqodir/libraryofbooks/blob/main/src/LibraryOfBooks.Domain/Entities/Asset.cs): `src/LibraryOfBooks.Domain/Entities/Asset.cs`

### Other components

- **Library user**

## Connections

- Library user → Library UI: uses
- Library UI → Client services: invokes (evidence: `web/LibraryOfBooks.Web/Program.cs`)
- Client services → API endpoints: requests
- Library UI → Auth state: tracks sign-in (evidence: `web/LibraryOfBooks.Web/Program.cs`)
- API endpoints → Authentication: dispatches
- API endpoints → Book catalog: dispatches
- API endpoints → Categories: dispatches
- API endpoints → User accounts: dispatches
- API endpoints → Comments: dispatches
- Book catalog → Generic repository: reads and writes (evidence: `src/LibraryOfBooks.Service/Services/BookService.cs`)
- Book catalog → Asset files: uploads and removes (evidence: `src/LibraryOfBooks.Service/Services/BookService.cs`)
- Authentication → Generic repository: looks up user (evidence: `src/LibraryOfBooks.Service/Services/AuthService.cs`)
- Generic repository → Library database: queries and saves (evidence: `src/LibraryOfBooks.DataAccess/Repositories/Repository.cs`)
- Library database → Book model: maps (evidence: `src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs`)
- Library database → User model: maps (evidence: `src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs`)
- Library database → Category model: maps (evidence: `src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs`)
- Library database → Asset model: maps (evidence: `src/LibraryOfBooks.DataAccess/Contexts/AppDbContext.cs`)
