# zoz646/library-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/zoz646/library-management-system
- Repository: https://github.com/zoz646/library-management-system

## Overview

Titans is a C++17 library-management application with a console interface, in-memory catalog and member state, and optional SQLite persistence. The principal workflow starts at the CLI, proceeds through interactive input and menu actions, and delegates catalog, member, loan, search, sorting, and statistics operations to LibraryService. The service applies domain rules and uses a custom linked-list container; repository implementations provide persistence. Major search, sorting, sample-data, and formatted-output capabilities are shown. Some links are based on README architecture statements because implementation excerpts are partial.

Main entry points: [`service/LibraryService.cpp`](https://github.com/zoz646/library-management-system/blob/master/service/LibraryService.cpp) (Library service), [`ui/ConsoleApp.cpp`](https://github.com/zoz646/library-management-system/blob/master/ui/ConsoleApp.cpp) (Menu actions), [`main.cpp`](https://github.com/zoz646/library-management-system/blob/master/main.cpp) (CLI entry), [`repository/SqliteRepository.cpp`](https://github.com/zoz646/library-management-system/blob/master/repository/SqliteRepository.cpp) (SQLite repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Console interface"]
  node_cli["CLI entry<br/>[main.cpp]"]
  node_console["Menu actions<br/>[ConsoleApp.cpp]"]
  node_input["Input validation<br/>[InputReader.cpp]"]
  node_tables["Table rendering<br/>[Table.cpp]"]
  node_sample["Sample data<br/>[DemoData.cpp]"]
end

subgraph group_application["Library services"]
  node_service["Library service<br/>[LibraryService.cpp]"]
  node_search["Search strategies<br/>[SearchStrategy.cpp]"]
  node_sorting["Sort strategies<br/>[SortStrategy.cpp]"]
end

subgraph group_domain["Library domain"]
  node_container["Linked-list container<br/>[Container.h]"]
  node_book["Book entity<br/>[Book.cpp]"]
  node_member["Member entity<br/>[Member.cpp]"]
  node_text["Text utilities<br/>[Text.h]"]
end

subgraph group_persistence["Persistence"]
  node_repoapi["Repository contract"]
  node_nullrepo["Null repository<br/>[NullRepository.h]"]
  node_sqlite["SQLite repository"]
end

node_user(("Library user"))
node_database[("SQLite database")]

node_user -->|"starts"| node_cli
node_cli -->|"runs"| node_console
node_cli -->|"configures"| node_service
node_cli -->|"creates"| node_sqlite
node_console -->|"reads input"| node_input
node_console -->|"renders"| node_tables
node_console -->|"loads samples"| node_sample
node_console -->|"delegates"| node_service
node_service -->|"manages"| node_book
node_service -->|"manages"| node_member
node_service -->|"stores state"| node_container
node_member -->|"stores loans"| node_container
node_service -->|"matches books"| node_search
node_service -->|"orders catalog"| node_sorting
node_service -->|"normalizes queries"| node_text
node_service -->|"persists changes"| node_repoapi
node_sqlite -->|"implements"| node_repoapi
node_nullrepo -->|"implements"| node_repoapi
node_sqlite -->|"reads and writes"| node_database

click node_cli "https://github.com/zoz646/library-management-system/blob/master/main.cpp"
click node_console "https://github.com/zoz646/library-management-system/blob/master/ui/ConsoleApp.cpp"
click node_input "https://github.com/zoz646/library-management-system/blob/master/ui/InputReader.cpp"
click node_tables "https://github.com/zoz646/library-management-system/blob/master/ui/Table.cpp"
click node_sample "https://github.com/zoz646/library-management-system/blob/master/ui/DemoData.cpp"
click node_service "https://github.com/zoz646/library-management-system/blob/master/service/LibraryService.cpp"
click node_search "https://github.com/zoz646/library-management-system/blob/master/service/SearchStrategy.cpp"
click node_sorting "https://github.com/zoz646/library-management-system/blob/master/service/SortStrategy.cpp"
click node_container "https://github.com/zoz646/library-management-system/blob/master/core/Container.h"
click node_book "https://github.com/zoz646/library-management-system/blob/master/domain/Book.cpp"
click node_member "https://github.com/zoz646/library-management-system/blob/master/domain/Member.cpp"
click node_text "https://github.com/zoz646/library-management-system/blob/master/domain/Text.h"
click node_repoapi "https://github.com/zoz646/library-management-system/blob/master/repository/ILibraryRepository.h"
click node_nullrepo "https://github.com/zoz646/library-management-system/blob/master/repository/NullRepository.h"
click node_sqlite "https://github.com/zoz646/library-management-system/blob/master/repository/SqliteRepository.cpp"

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_cli,node_console,node_input,node_tables,node_sample,node_user toneBlue
class node_service,node_search,node_sorting,node_database toneAmber
class node_container,node_book,node_member,node_text toneMint
class node_repoapi,node_nullrepo,node_sqlite toneRose
```

## Components

### Console interface

- [CLI entry](https://github.com/zoz646/library-management-system/blob/master/main.cpp): `main.cpp`
- [Menu actions](https://github.com/zoz646/library-management-system/blob/master/ui/ConsoleApp.cpp): `ui/ConsoleApp.cpp`
- [Input validation](https://github.com/zoz646/library-management-system/blob/master/ui/InputReader.cpp): `ui/InputReader.cpp`
- [Table rendering](https://github.com/zoz646/library-management-system/blob/master/ui/Table.cpp): `ui/Table.cpp`
- [Sample data](https://github.com/zoz646/library-management-system/blob/master/ui/DemoData.cpp): `ui/DemoData.cpp`

### Library services

- [Library service](https://github.com/zoz646/library-management-system/blob/master/service/LibraryService.cpp): `service/LibraryService.cpp`
- [Search strategies](https://github.com/zoz646/library-management-system/blob/master/service/SearchStrategy.cpp): `service/SearchStrategy.cpp`
- [Sort strategies](https://github.com/zoz646/library-management-system/blob/master/service/SortStrategy.cpp): `service/SortStrategy.cpp`

### Library domain

- [Linked-list container](https://github.com/zoz646/library-management-system/blob/master/core/Container.h): `core/Container.h`
- [Book entity](https://github.com/zoz646/library-management-system/blob/master/domain/Book.cpp): `domain/Book.cpp`
- [Member entity](https://github.com/zoz646/library-management-system/blob/master/domain/Member.cpp): `domain/Member.cpp`
- [Text utilities](https://github.com/zoz646/library-management-system/blob/master/domain/Text.h): `domain/Text.h`

### Persistence

- [Repository contract](https://github.com/zoz646/library-management-system/blob/master/repository/ILibraryRepository.h): `repository/ILibraryRepository.h`
- [Null repository](https://github.com/zoz646/library-management-system/blob/master/repository/NullRepository.h): `repository/NullRepository.h`
- [SQLite repository](https://github.com/zoz646/library-management-system/blob/master/repository/SqliteRepository.cpp): `repository/SqliteRepository.cpp`

### Other components

- **Library user**
- **SQLite database**

## Connections

- Library user → CLI entry: starts (evidence: `README.md`)
- CLI entry → Menu actions: runs (evidence: `main.cpp`)
- CLI entry → Library service: configures (evidence: `main.cpp`)
- CLI entry → SQLite repository: creates (evidence: `main.cpp`)
- Menu actions → Input validation: reads input (evidence: `ui/ConsoleApp.cpp`)
- Menu actions → Table rendering: renders (evidence: `ui/ConsoleApp.cpp`)
- Menu actions → Sample data: loads samples (evidence: `ui/ConsoleApp.cpp`)
- Menu actions → Library service: delegates (evidence: `README.md`)
- Library service → Book entity: manages (evidence: `service/LibraryService.cpp`)
- Library service → Member entity: manages
- Library service → Linked-list container: stores state
- Member entity → Linked-list container: stores loans
- Library service → Search strategies: matches books (evidence: `service/LibraryService.cpp`)
- Library service → Sort strategies: orders catalog (evidence: `service/LibraryService.cpp`)
- Library service → Text utilities: normalizes queries (evidence: `service/LibraryService.cpp`)
- Library service → Repository contract: persists changes (evidence: `README.md`)
- SQLite repository → Repository contract: implements
- Null repository → Repository contract: implements (evidence: `repository/NullRepository.h`)
- SQLite repository → SQLite database: reads and writes (evidence: `repository/SqliteRepository.cpp`)
