# nobthd/dayplaner architecture

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

- Interactive diagram: https://gitdiagram.com/nobthd/dayplaner
- Repository: https://github.com/nobthd/dayplaner

## Overview

##### Main Components
- UI Layer: The “ui” directory contains QML files (e.g., AddTask.qml, ExitButton.qml, ProfileButton.qml, etc.) along with assets and other UI resources. This represents the view layer that handles user interaction.
- Business Logic / Application Core: The “src” and “inc” directories hold the core C++ code. This includes:
- User management (user.h / user.cpp)
- Task management (task.h, task.cpp, task_handler.h, task_handler.cpp)
- Registration handling (reg_handler.h, reg_handler.cpp)
- Utility functions such as password handling (inc/utils/passwordUtils.h, src/utils/passwordUtils.cpp)
- Database Layer: The “inc/sql” and “src/sql” directories include files like pgconn.h/pgconn.cpp and user_query.h/user_query.cpp which indicate interactions with a PostgreSQL database.
- Build/Setup Infrastructure: Files such as CMakeLists.txt and setup.sh represent the build configuration and setup scripts.

##### Relationships and Data Flow
- Additionally, include “Utilities” (e.g., passwordUtils modules) connected to the core logic, noting their role for security or data transformations.

##### Architectural Patterns and Design Principles
- This project follows a clear separation of concerns – a presentation/UI layer (via QML), business logic (C++ modules), and a separate persistence/database layer (SQL handling).
- Although not explicitly stated in the README, the project structure suggests elements of the MVC (Model-View-Controller) or MVVM pattern, where:
- The UI (View) is handled by QML.
- The “Controller/Model” aspects live within the core C++ modules.
- The database layer would be considered part of the Model (data access layer).
- That the project uses CMake for building and likely relies on the Qt framework (inferred from QML usage).

##### Relevant Technologies and Frameworks
- C++ (for core logic)
- Qt/QML (for the user interface)
- PostgreSQL (implied by the pgconn naming and SQL files)
- CMake (for build configuration)

##### Final Touches
- That every component is detailed enough to capture the project’s architectural essence.
- Because the README does not provide additional details, rely on the explicit file organization to infer inter-component dependencies and responsibilities.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% UI Layer
    subgraph "UI Layer"
        UI["QML User Interface"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        UM["User Management"]:::core
        TM["Task Management"]:::core
        RH["Registration Handler"]:::core
        UT["Utilities"]:::core
    end

    %% Database Layer
    subgraph "Database Layer"
        DB["PostgreSQL (SQL Operations)"]:::db
    end

    %% Build/Setup Infrastructure
    subgraph "Build/Setup Infrastructure"
        BS["Build Infrastructure"]:::build
    end

    %% Connections from Build to Layers (build configuration deployment)
    BS -->|"deploys"| UI
    BS -->|"deploys"| UM
    BS -->|"deploys"| TM
    BS -->|"deploys"| RH
    BS -->|"deploys"| UT
    BS -->|"deploys"| DB

    %% Data flow: UI triggers business logic
    UI -->|"userEvents"| UM
    UI -->|"userEvents"| TM
    UI -->|"userEvents"| RH

    %% Business logic interacts with database
    UM -->|"DBRequest"| DB
    TM -->|"DBRequest"| DB
    RH -->|"DBRequest"| DB

    %% Utilities support business logic (dotted connections)
    UT ---|"supports"| UM
    UT ---|"supports"| TM
    UT ---|"supports"| RH

    %% Click Events
    click UI "https://github.com/nobthd/dayplaner/tree/main/ui/components"
    click UM "https://github.com/nobthd/dayplaner/blob/main/inc/user.h"
    click TM "https://github.com/nobthd/dayplaner/blob/main/inc/task.h"
    click RH "https://github.com/nobthd/dayplaner/blob/main/inc/reg_handler.h"
    click UT "https://github.com/nobthd/dayplaner/blob/main/inc/utils/passwordUtils.h"
    click DB "https://github.com/nobthd/dayplaner/tree/main/inc/sql"
    click BS "https://github.com/nobthd/dayplaner/blob/main/CMakeLists.txt"

    %% Styles
    classDef ui fill:#9fdff1,stroke:#333,stroke-width:2px;
    classDef core fill:#f3e9d2,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef db fill:#f7a1a1,stroke:#333,stroke-width:2px,stroke-dasharray: 2 2;
    classDef build fill:#d2f7c3,stroke:#333,stroke-width:2px;
```
