# samrinjenesh-svg/cli-based-database architecture

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

- Interactive diagram: https://gitdiagram.com/samrinjenesh-svg/cli-based-database
- Repository: https://github.com/samrinjenesh-svg/cli-based-database

## Overview

A small interactive C++ record manager: it loads records at startup, accepts menu commands to add, search, modify, delete, or display them, and saves changes to Data.txt. The single source file contains the menu, record operations, in-memory table, and file persistence. Relationships below follow calls visible in main.cpp; the README is empty.

Main entry points: [`main.cpp`](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp) (Menu loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Console interaction"]
  node_menu["Menu loop<br/>[main.cpp]"]
end

subgraph group_records["Record management"]
  node_record["Record model<br/>[main.cpp]"]
  node_table[("In-memory table<br/>[main.cpp]")]
  node_initialize["Initialize records<br/>[main.cpp]"]
  node_add["Add record<br/>[main.cpp]"]
  node_search["Search records<br/>[main.cpp]"]
  node_modify["Modify record<br/>[main.cpp]"]
  node_delete["Delete record<br/>[main.cpp]"]
  node_display["Display records<br/>[main.cpp]"]
  node_sort["Sort by ID<br/>[main.cpp]"]
end

subgraph group_persistence["File persistence"]
  node_persist["Load and save<br/>[main.cpp]"]
  node_datafile[("Data.txt")]
end

node_user(("User"))

node_user -->|"enters commands"| node_menu
node_menu -->|"initializes"| node_initialize
node_menu -->|"dispatches"| node_add
node_menu -->|"dispatches"| node_search
node_menu -->|"dispatches"| node_modify
node_menu -->|"dispatches"| node_delete
node_menu -->|"dispatches"| node_display
node_menu -->|"saves through"| node_persist
node_initialize -->|"loads from"| node_persist
node_add -->|"updates"| node_table
node_add -->|"sorts via"| node_sort
node_search -->|"searches"| node_table
node_modify -->|"finds target"| node_search
node_modify -->|"updates"| node_table
node_modify -->|"sorts via"| node_sort
node_delete -->|"finds target"| node_search
node_delete -->|"erases from"| node_table
node_delete -->|"sorts via"| node_sort
node_display -->|"reads"| node_table
node_persist -->|"reads and writes"| node_table
node_persist -->|"reads and writes"| node_datafile
node_initialize -->|"populates"| node_table
node_initialize -->|"sorts via"| node_sort
node_sort -->|"orders"| node_table
node_table -->|"stores"| node_record

click node_menu "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_record "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_table "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_initialize "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_add "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_search "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_modify "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_delete "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_display "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_sort "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp"
click node_persist "https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.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_menu,node_user toneBlue
class node_record,node_table,node_initialize,node_add,node_search,node_modify,node_delete,node_display,node_sort toneAmber
class node_persist,node_datafile toneMint
```

## Components

### Console interaction

- [Menu loop](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`

### Record management

- [Record model](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [In-memory table](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [Initialize records](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [Add record](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [Search records](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [Modify record](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [Delete record](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [Display records](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- [Sort by ID](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`

### File persistence

- [Load and save](https://github.com/samrinjenesh-svg/cli-based-database/blob/main/main.cpp): `main.cpp`
- **Data.txt**

### Other components

- **User**

## Connections

- User → Menu loop: enters commands (evidence: `main.cpp`)
- Menu loop → Initialize records: initializes (evidence: `main.cpp`)
- Menu loop → Add record: dispatches (evidence: `main.cpp`)
- Menu loop → Search records: dispatches (evidence: `main.cpp`)
- Menu loop → Modify record: dispatches (evidence: `main.cpp`)
- Menu loop → Delete record: dispatches (evidence: `main.cpp`)
- Menu loop → Display records: dispatches (evidence: `main.cpp`)
- Menu loop → Load and save: saves through (evidence: `main.cpp`)
- Initialize records → Load and save: loads from (evidence: `main.cpp`)
- Add record → In-memory table: updates (evidence: `main.cpp`)
- Add record → Sort by ID: sorts via (evidence: `main.cpp`)
- Search records → In-memory table: searches (evidence: `main.cpp`)
- Modify record → Search records: finds target (evidence: `main.cpp`)
- Modify record → In-memory table: updates (evidence: `main.cpp`)
- Modify record → Sort by ID: sorts via (evidence: `main.cpp`)
- Delete record → Search records: finds target (evidence: `main.cpp`)
- Delete record → In-memory table: erases from (evidence: `main.cpp`)
- Delete record → Sort by ID: sorts via (evidence: `main.cpp`)
- Display records → In-memory table: reads (evidence: `main.cpp`)
- Load and save → In-memory table: reads and writes (evidence: `main.cpp`)
- Load and save → Data.txt: reads and writes (evidence: `main.cpp`)
- Initialize records → In-memory table: populates (evidence: `main.cpp`)
- Initialize records → Sort by ID: sorts via (evidence: `main.cpp`)
- Sort by ID → In-memory table: orders (evidence: `main.cpp`)
- In-memory table → Record model: stores (evidence: `main.cpp`)
