# cheung4843/todo-app architecture

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

- Interactive diagram: https://gitdiagram.com/cheung4843/todo-app
- Repository: https://github.com/cheung4843/todo-app

## Overview

##### Project type and purpose
- This is a small, standalone, full-stack (single-process) command-line application written in modern C++20.
- Purpose: Manage a todo list via CLI. Supports add, list, mark, delete. Unit-tested with Catch2. Cross-platform build via CMake. CI/CD via GitHub Actions.

##### File structure
- Top-level:
- CMakeLists.txt + build scripts (build.sh, build.bat, build.py): build layer
- src/ : implementation (.cpp)
- / : public headers (.hpp)
- tests/ : Catch2-based unit tests
- docs/ : UML and documentation
- .github/workflows/: CI/CD YAML
- Pattern: simple layered architecture with clear separation of CLI, core domain (TodoList, TodoItem), and test harness.

##### README insights
- Confirms CMake, cross-platform support, Catch2 testing, GitHub Actions pipelines.
- Points to docs/todo_app_uml.md for an existing class-level UML.

##### Components
a. Main components
- CLI Module (main.cpp): parses commands, calls domain API
- Domain Layer: TodoList manager (todo_list.cpp/hpp) & TodoItem model (todo_item.hpp)
- Persistence (in-memory / future file store)
- Test Harness (Catch2 in tests/)
- Build System (CMake + build scripts)
- CI/CD (GitHub Actions workflows)
b. Relationships & interactions
- CLI → Domain Layer: “invoke add/mark/delete/list”
- Domain Layer → Persistence: “store/retrieve tasks” (currently in memory)
- Test Harness → Domain Layer: “unit tests exercising public API”
- Build Scripts → CMake → Compiler/Linker → Produced binaries
- CI/CD → invokes build & test workflows on GitHub
c. Architectural patterns & principles
- Layered architecture: CLI / Domain / Infrastructure / Tests
- Single-responsibility: each class/file has one role
- Modularization via clear include/ src split
d. Key technologies
- C++20, CMake, Catch2, GitHub Actions

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers and Components
    subgraph "CLI Layer" 
        style CLI fill:#e0ffe0,stroke:#333,stroke-width:1px
        CLI["CLI Module\nsrc/main.cpp"] 
    end

    subgraph "Domain Layer"
        style Domain fill:#f0fff0,stroke:#333,stroke-width:1px
        TodoList["TodoList Manager\ninclude/todo_list.hpp\nsrc/todo_list.cpp"]
        TodoItem["TodoItem Model\ninclude/todo_item.hpp"]
    end

    subgraph "Persistence Layer"
        style Persistence fill:#e8f8e8,stroke:#333,stroke-width:1px
        Persistence["In-Memory Store\n(src/todo_list.cpp)"] 
    end

    subgraph "Test Layer"
        style TestHarness fill:#fff8c6,stroke:#333,stroke-width:1px
        Tests["Test Harness\ntests/test_todo.cpp\ntests/catch_amalgamated.cpp\ntests/catch_amalgamated.hpp"]
    end

    subgraph "Build & CI"
        style BuildSystem fill:#cce0ff,stroke:#333,stroke-width:1px
        BuildScripts["Build Scripts\nbuild.sh\nbuild.bat\nbuild.ps1\nbuild.py"]
        CMake["CMake Config\nCMakeLists.txt"]
        Compiler["Compiler/Linker"]
        Binaries["Binaries\ntodo, test_todo"]
        CI_CD["GitHub Actions\nci.yml\nrelease.yml"]
    end

    subgraph "Documentation"
        style Docs fill:#f2f2f2,stroke:#333,stroke-width:1px
        DocsNode["Design Docs\ndocs/todo_app_uml.md"]
    end

    %% Relationships
    CLI -->|"invoke add/mark/delete/list"| TodoList
    TodoList -->|"uses model"| TodoItem
    TodoList -->|"store/retrieve"| Persistence
    Tests -->|"unit tests"| TodoList
    BuildScripts -->|"invoke"| CMake
    CMake -->|"generate build files"| Compiler
    Compiler -->|"produce"| Binaries
    CI_CD -->|"run build & test"| BuildScripts
    CI_CD -->|"trigger release"| Binaries
    DocsNode -.->|references| TodoList

    %% Click Events
    click CLI "https://github.com/cheung4843/todo-app/blob/main/src/main.cpp"
    click TodoList "https://github.com/cheung4843/todo-app/blob/main/include/todo_list.hpp"
    click TodoList "https://github.com/cheung4843/todo-app/blob/main/src/todo_list.cpp"
    click TodoItem "https://github.com/cheung4843/todo-app/blob/main/include/todo_item.hpp"
    click Persistence "https://github.com/cheung4843/todo-app/blob/main/src/todo_list.cpp"
    click Tests "https://github.com/cheung4843/todo-app/blob/main/tests/test_todo.cpp"
    click Tests "https://github.com/cheung4843/todo-app/blob/main/tests/catch_amalgamated.cpp"
    click Tests "https://github.com/cheung4843/todo-app/blob/main/tests/catch_amalgamated.hpp"
    click BuildScripts "https://github.com/cheung4843/todo-app/blob/main/build.sh"
    click BuildScripts "https://github.com/cheung4843/todo-app/blob/main/build.bat"
    click BuildScripts "https://github.com/cheung4843/todo-app/blob/main/build.ps1"
    click BuildScripts "https://github.com/cheung4843/todo-app/blob/main/build.py"
    click CMake "https://github.com/cheung4843/todo-app/blob/main/CMakeLists.txt"
    click CI_CD "https://github.com/cheung4843/todo-app/blob/main/.github/workflows/ci.yml"
    click CI_CD "https://github.com/cheung4843/todo-app/blob/main/.github/workflows/release.yml"
    click DocsNode "https://github.com/cheung4843/todo-app/blob/main/docs/todo_app_uml.md"

    %% Styles
    classDef runtime fill:#e0ffe0,stroke:#333;
    classDef domain fill:#f0fff0,stroke:#333;
    classDef persistence fill:#e8f8e8,stroke:#333;
    classDef tests fill:#fff8c6,stroke:#333;
    classDef buildci fill:#cce0ff,stroke:#333;
    classDef docs fill:#f2f2f2,stroke:#333;

    class CLI runtime
    class TodoList,TodoItem domain
    class Persistence persistence
    class Tests tests
    class BuildScripts,CMake,Compiler,Binaries,CI_CD buildci
    class DocsNode docs
```
