# farahelnakhal/lcms architecture

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

- Interactive diagram: https://gitdiagram.com/farahelnakhal/lcms
- Repository: https://github.com/farahelnakhal/lcms

## Overview

LCMS is a command-line library catalog. Users enter commands through the main loop; the LCMS operations layer dispatches catalog actions to a hierarchical tree that stores categories and books, with results printed or CSV files imported/exported. The README documents CRUD and search for books and categories, recursive listing, and CSV transfer. The tree and vector excerpts show the storage and traversal design; some operation bodies are unsampled, so only directly evidenced call relationships are shown.

Main entry points: [`tree.cpp`](https://github.com/farahelnakhal/lcms/blob/main/tree.cpp) (Category tree), [`lcms.cpp`](https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp) (CSV import/export), [`main.cpp`](https://github.com/farahelnakhal/lcms/blob/main/main.cpp) (Command loop), [`book.cpp`](https://github.com/farahelnakhal/lcms/blob/main/book.cpp) (Book records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command interface"]
  node_command_loop["Command loop<br/>[main.cpp]"]
end

subgraph group_catalog["Catalog operations"]
  node_catalog_ops["Catalog operations<br/>[lcms.cpp]"]
  node_book_ops["Book management<br/>[lcms.cpp]"]
  node_category_ops["Category management<br/>[lcms.cpp]"]
  node_search_list["Search and listing<br/>[lcms.cpp]"]
  node_csv_io["CSV import/export<br/>[lcms.cpp]"]
end

subgraph group_domain["Catalog model"]
  node_tree["Category tree<br/>[tree.cpp]"]
  node_tree_node["Category nodes<br/>[tree.cpp]"]
  node_book["Book records<br/>[book.cpp]"]
end

subgraph group_storage["In-memory storage"]
  node_vector["Dynamic vector<br/>[myvector.h]"]
end

node_user(("CLI user"))
node_csv_file["CSV file"]

node_user -->|"enters commands"| node_command_loop
node_command_loop -->|"dispatches commands"| node_catalog_ops
node_catalog_ops -->|"creates tree"| node_tree
node_book_ops -->|"manages books"| node_tree
node_category_ops -->|"manages categories"| node_tree
node_search_list -->|"searches and lists"| node_tree
node_csv_io -->|"imports and exports"| node_tree
node_csv_io -->|"reads or writes"| node_csv_file
node_tree -->|"traverses"| node_tree_node
node_tree_node -->|"stores books"| node_book
node_tree_node -->|"stores children and books"| node_vector

click node_command_loop "https://github.com/farahelnakhal/lcms/blob/main/main.cpp"
click node_catalog_ops "https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp"
click node_book_ops "https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp"
click node_category_ops "https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp"
click node_search_list "https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp"
click node_csv_io "https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp"
click node_tree "https://github.com/farahelnakhal/lcms/blob/main/tree.cpp"
click node_tree_node "https://github.com/farahelnakhal/lcms/blob/main/tree.cpp"
click node_book "https://github.com/farahelnakhal/lcms/blob/main/book.cpp"
click node_vector "https://github.com/farahelnakhal/lcms/blob/main/myvector.h"

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_command_loop,node_user toneBlue
class node_catalog_ops,node_book_ops,node_category_ops,node_search_list,node_csv_io toneAmber
class node_tree,node_tree_node,node_book toneMint
class node_vector toneRose
class node_csv_file toneIndigo
```

## Components

### Command interface

- [Command loop](https://github.com/farahelnakhal/lcms/blob/main/main.cpp): `main.cpp`

### Catalog operations

- [Catalog operations](https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp): `lcms.cpp`
- [Book management](https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp): `lcms.cpp`
- [Category management](https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp): `lcms.cpp`
- [Search and listing](https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp): `lcms.cpp`
- [CSV import/export](https://github.com/farahelnakhal/lcms/blob/main/lcms.cpp): `lcms.cpp`

### Catalog model

- [Category tree](https://github.com/farahelnakhal/lcms/blob/main/tree.cpp): `tree.cpp`
- [Category nodes](https://github.com/farahelnakhal/lcms/blob/main/tree.cpp): `tree.cpp`
- [Book records](https://github.com/farahelnakhal/lcms/blob/main/book.cpp): `book.cpp`

### In-memory storage

- [Dynamic vector](https://github.com/farahelnakhal/lcms/blob/main/myvector.h): `myvector.h`

### Other components

- **CLI user**
- **CSV file**

## Connections

- CLI user → Command loop: enters commands (evidence: `main.cpp`)
- Command loop → Catalog operations: dispatches commands (evidence: `main.cpp`)
- Catalog operations → Category tree: creates tree (evidence: `lcms.cpp`)
- Book management → Category tree: manages books (evidence: `lcms.cpp`)
- Category management → Category tree: manages categories (evidence: `README.md`)
- Search and listing → Category tree: searches and lists (evidence: `lcms.cpp`)
- CSV import/export → Category tree: imports and exports (evidence: `lcms.cpp`)
- CSV import/export → CSV file: reads or writes (evidence: `lcms.cpp`)
- Category tree → Category nodes: traverses (evidence: `tree.cpp`)
- Category nodes → Book records: stores books
- Category nodes → Dynamic vector: stores children and books
