# lucasfrusci/minidb architecture

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

- Interactive diagram: https://gitdiagram.com/lucasfrusci/minidb
- Repository: https://github.com/lucasfrusci/minidb

## Overview

MiniDB is an embeddable file-backed database with an interactive command-line front end. A user starts the application, which loads a database and routes commands for table creation, deletion, row insertion, listing, saving, or switching database files. Database owns persistence and table collection management; tables own schemas, row insertion, and formatted display, with Row representing individual records. The README documents these capabilities; the shown source establishes the main call paths and file reads/writes.

Main entry points: [`src/app.cpp`](https://github.com/lucasfrusci/minidb/blob/main/src/app.cpp) (Application), [`src/db.cpp`](https://github.com/lucasfrusci/minidb/blob/main/src/db.cpp) (Database manager), [`src/main.cpp`](https://github.com/lucasfrusci/minidb/blob/main/src/main.cpp) (CLI entry), [`src/table.cpp`](https://github.com/lucasfrusci/minidb/blob/main/src/table.cpp) (Table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command interface"]
  node_entry["CLI entry<br/>[main.cpp]"]
  node_application["Application<br/>[app.cpp]"]
  node_menu["Command menu<br/>[menu.cpp]"]
end

subgraph group_database["Database management"]
  node_db["Database manager<br/>[db.cpp]"]
  node_file[("Database file")]
end

subgraph group_records["Table and records"]
  node_table["Table<br/>[table.cpp]"]
  node_row["Row<br/>[row.cpp]"]
end

node_user(("User"))

node_user -->|"starts"| node_entry
node_entry -->|"runs"| node_application
node_application -->|"loads and commands"| node_db
node_application -->|"displays"| node_menu
node_application -->|"lists tables"| node_db
node_db -->|"reads and writes"| node_file
node_db -->|"manages tables"| node_table
node_table -->|"stores and displays"| node_row

click node_entry "https://github.com/lucasfrusci/minidb/blob/main/src/main.cpp"
click node_application "https://github.com/lucasfrusci/minidb/blob/main/src/app.cpp"
click node_menu "https://github.com/lucasfrusci/minidb/blob/main/src/menu.cpp"
click node_db "https://github.com/lucasfrusci/minidb/blob/main/src/db.cpp"
click node_table "https://github.com/lucasfrusci/minidb/blob/main/src/table.cpp"
click node_row "https://github.com/lucasfrusci/minidb/blob/main/src/row.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_entry,node_application,node_menu,node_user toneBlue
class node_db,node_file toneAmber
class node_table,node_row toneMint
```

## Components

### Command interface

- [CLI entry](https://github.com/lucasfrusci/minidb/blob/main/src/main.cpp): `src/main.cpp`
- [Application](https://github.com/lucasfrusci/minidb/blob/main/src/app.cpp): `src/app.cpp`
- [Command menu](https://github.com/lucasfrusci/minidb/blob/main/src/menu.cpp): `src/menu.cpp`

### Database management

- [Database manager](https://github.com/lucasfrusci/minidb/blob/main/src/db.cpp): `src/db.cpp`
- **Database file**

### Table and records

- [Table](https://github.com/lucasfrusci/minidb/blob/main/src/table.cpp): `src/table.cpp`
- [Row](https://github.com/lucasfrusci/minidb/blob/main/src/row.cpp): `src/row.cpp`

### Other components

- **User**

## Connections

- User → CLI entry: starts (evidence: `src/main.cpp`)
- CLI entry → Application: runs (evidence: `src/main.cpp`)
- Application → Database manager: loads and commands (evidence: `src/app.cpp`)
- Application → Command menu: displays (evidence: `src/app.cpp`)
- Application → Database manager: lists tables (evidence: `src/app.cpp`)
- Database manager → Database file: reads and writes (evidence: `src/db.cpp`)
- Database manager → Table: manages tables (evidence: `src/db.cpp`)
- Table → Row: stores and displays (evidence: `src/table.cpp`)
