# blackhat955/todolist architecture

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

- Interactive diagram: https://gitdiagram.com/blackhat955/todolist
- Repository: https://github.com/blackhat955/todolist

## Overview

##### Project Type and Purpose
- This is a single-binary, console‐based To-Do List application written in C++.
- It provides a simple CLI for managing tasks (create, edit, complete, delete) and persists data in a plain text file (`tasks.txt`).

##### File Structure Analysis
- Top-level source files:
- main.cpp: CLI entry point and user interaction loop
- todo.hpp / todo.cpp: Defines the `Task` (or `TodoItem`) class and basic in-memory task operations
- storage.hpp / storage.cpp: Implements file I/O (loading from and saving to `tasks.txt`)
- tasks.txt: The persistent storage file for tasks
- .vscode: Editor configuration (ignored in architecture)
- Resulting binary (`todo`)

##### Key Components
a. CLI Layer (main.cpp)
- Reads user input and prints output
- Calls into the TaskManager/API provided by the `todo` module
b. Domain Layer (todo.hpp/cpp)
- `Task` class (ID, description, status)
- `TaskManager` or equivalent façade that keeps tasks in a `std::vector<Task>`
c. Persistence Layer (storage.hpp/cpp)
- FileReader/Writer functions
- Parses `tasks.txt` into in-memory objects on startup
- Serializes tasks back to `tasks.txt` on exit or after each change
d. Data Store
- Flat file `tasks.txt` (line-delimited task records)

##### Relationships and Data Flow
- User → CLI Layer (enter commands)
- CLI Layer → Domain Layer (invoke add/edit/delete/list)
- Domain Layer → Persistence Layer
- On startup: loadTasks() → Domain Layer
- On modification: saveTasks() ← Domain Layer
- Persistence Layer ↔ Data Store (`tasks.txt`)

##### Architectural Patterns & Principles
- Layered Architecture: separate concerns (Presentation, Domain, Persistence)
- Single responsibility per module (each `.cpp/.hpp` covers a distinct responsibility)
- Plain-text storage for simplicity (no external DB)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Modules
    CLI["CLI Interface\n(main.cpp)"]:::module
    TaskMgr["TaskManager (Domain)\n(todo.hpp, todo.cpp)"]:::module
    Storage["Storage Module\n(storage.hpp, storage.cpp)"]:::module
    DataStore(("tasks.txt")):::datastore

    %% Data Flow
    CLI -->|"add/edit/list"| TaskMgr
    TaskMgr -->|"loadTasks()/saveTasks()"| Storage
    Storage -->|"write"| DataStore
    DataStore -->|"read"| Storage

    %% Click Events
    click CLI "https://github.com/blackhat955/todolist/blob/main/main.cpp"
    click TaskMgr "https://github.com/blackhat955/todolist/blob/main/todo/todo.hpp"
    click Storage "https://github.com/blackhat955/todolist/blob/main/storage.hpp"
    click DataStore "https://github.com/blackhat955/todolist/blob/main/tasks.txt"

    %% Styles
    classDef module fill:#3498db,stroke:#2c3e50,color:#ecf0f1;
    classDef datastore fill:#2ecc71,stroke:#27ae60,color:#ffffff,shape:cylinder;
    class CLI,TaskMgr,Storage module
    class DataStore datastore
```
