# muhamedsyamand/bookstore-system architecture

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

- Interactive diagram: https://gitdiagram.com/muhamedsyamand/bookstore-system
- Repository: https://github.com/muhamedsyamand/bookstore-system

## Overview

This is a small interactive C++ bookstore manager. A user chooses catalog operations through the console: books are added, displayed, removed, sorted, or searched; search sorts the list and uses binary search. The linked list is the central catalog state, with file loading and saving providing persistence. The single source file implements these responsibilities. The README documents the feature set, while the excerpts show only parts of the control flow, so unshown operation-to-persistence links are omitted.

Main entry points: [`Source.cpp`](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp) (Menu loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Console interaction"]
  node_cli["Menu loop<br/>[Source.cpp]"]
  node_input["Input validation<br/>[Source.cpp]"]
end

subgraph group_catalog["Book catalog"]
  node_add["Add book<br/>[Source.cpp]"]
  node_display["Display books<br/>[Source.cpp]"]
  node_remove["Remove book<br/>[Source.cpp]"]
  node_list[("Linked-list catalog<br/>[Source.cpp]")]
end

subgraph group_algorithms["Catalog algorithms"]
  node_sort["Merge sort<br/>[Source.cpp]"]
  node_search["Binary search<br/>[Source.cpp]"]
  node_array["Search array<br/>[Source.cpp]"]
end

subgraph group_persistence["File persistence"]
  node_load["Load books<br/>[Source.cpp]"]
  node_save["Save books<br/>[Source.cpp]"]
  node_file[("Book data file")]
end

node_user(("Bookstore user"))

node_user -->|"chooses operation"| node_cli
node_cli -->|"reads choices"| node_input
node_cli -->|"loads at startup"| node_load
node_cli -->|"dispatches add"| node_add
node_cli -->|"dispatches display"| node_display
node_cli -->|"dispatches remove"| node_remove
node_cli -->|"dispatches sort"| node_sort
node_cli -->|"prepares search"| node_array
node_cli -->|"sorts before search"| node_sort
node_cli -->|"searches books"| node_search
node_add -->|"adds book"| node_list
node_display -->|"reads books"| node_list
node_remove -->|"removes book"| node_list
node_sort -->|"reorders books"| node_list
node_array -->|"copies catalog"| node_list
node_search -->|"searches sorted data"| node_array
node_load -->|"reads records"| node_file
node_load -->|"populates catalog"| node_list
node_save -->|"writes records"| node_file

click node_cli "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_input "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_add "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_display "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_remove "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_list "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_sort "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_search "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_array "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_load "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp"
click node_save "https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.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_input,node_user toneBlue
class node_add,node_display,node_remove,node_list toneAmber
class node_sort,node_search,node_array toneMint
class node_load,node_save,node_file toneRose
```

## Components

### Console interaction

- [Menu loop](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- [Input validation](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`

### Book catalog

- [Add book](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- [Display books](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- [Remove book](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- [Linked-list catalog](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`

### Catalog algorithms

- [Merge sort](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- [Binary search](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- [Search array](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`

### File persistence

- [Load books](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- [Save books](https://github.com/muhamedsyamand/bookstore-system/blob/main/Source.cpp): `Source.cpp`
- **Book data file**

### Other components

- **Bookstore user**

## Connections

- Bookstore user → Menu loop: chooses operation (evidence: `README.md`)
- Menu loop → Input validation: reads choices (evidence: `Source.cpp`)
- Menu loop → Load books: loads at startup (evidence: `Source.cpp`)
- Menu loop → Add book: dispatches add (evidence: `Source.cpp`)
- Menu loop → Display books: dispatches display (evidence: `Source.cpp`)
- Menu loop → Remove book: dispatches remove (evidence: `Source.cpp`)
- Menu loop → Merge sort: dispatches sort (evidence: `README.md`)
- Menu loop → Search array: prepares search (evidence: `Source.cpp`)
- Menu loop → Merge sort: sorts before search (evidence: `Source.cpp`)
- Menu loop → Binary search: searches books (evidence: `README.md`)
- Add book → Linked-list catalog: adds book (evidence: `Source.cpp`)
- Display books → Linked-list catalog: reads books (evidence: `Source.cpp`)
- Remove book → Linked-list catalog: removes book (evidence: `Source.cpp`)
- Merge sort → Linked-list catalog: reorders books (evidence: `Source.cpp`)
- Search array → Linked-list catalog: copies catalog (evidence: `README.md`)
- Binary search → Search array: searches sorted data (evidence: `README.md`)
- Load books → Book data file: reads records (evidence: `Source.cpp`)
- Load books → Linked-list catalog: populates catalog (evidence: `Source.cpp`)
- Save books → Book data file: writes records (evidence: `Source.cpp`)
