# saiyazulhasan/focus-flow architecture

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

- Interactive diagram: https://gitdiagram.com/saiyazulhasan/focus-flow
- Repository: https://github.com/saiyazulhasan/focus-flow

## Overview

##### Project Type and Purpose
- This is a client-side, single-page Todo application built purely with HTML, CSS and vanilla JavaScript.
- It targets developers and productivity enthusiasts who want a lightweight, responsive task manager that persists data locally via the browser’s LocalStorage API.

##### High-Level Architecture Overview
a. Presentation/UI Layer (index.html + style.css)
b. Application Logic Layer (script.js)
c. Persistence Layer (LocalStorage Web API)

##### Main Components
a. Browser Window (User’s Environment)
– Contains the rendered HTML and applies CSS styles.
b. UI Components
– Task list container, add/edit form, buttons.
– Renders data and captures user events (click, input).
c. JavaScript App Logic
– TaskManager module (CRUD operations, in-memory state).
– UIRenderer module (update DOM).
– EventHandler module (listen to user actions).
d. Persistence (LocalStorage)
– Stores JSON-serialized task list.
– Read/write operations performed by the App Logic.

##### Relationships and Data Flow
1. User interacts with the UI (e.g., clicks “Add Task”).
2. EventHandler in script.js captures the event.
3. TaskManager updates its internal task state.
4. TaskManager writes the updated list to LocalStorage.
5. UIRenderer re-draws the task list in the DOM.
6. On page load, App Logic reads from LocalStorage and initializes the UI.

##### Architectural Patterns and Principles
- Logical separation of concerns (UI vs. business logic vs. persistence).
- Simple MVC-style split (Model = task data, View = DOM, Controller = event handlers).
- Single responsibility modules within script.js for maintainability.

##### Key Technologies and Libraries
- HTML5 for markup.
- CSS3 (including responsive rules) for styling.
- Vanilla JavaScript Web APIs: DOM, event listeners, LocalStorage.

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Actor
    User(("User")):::external

    %% Presentation/UI Layer
    subgraph "Presentation/UI Layer"
        HTML["index.html"]:::ui
        CSS["style.css"]:::ui
        UIComponents["UI Components\n(task list, add/edit form, buttons)"]:::ui
    end

    %% Application Logic Layer
    subgraph "Application Logic Layer"
        EH["EventHandler"]:::logic
        TM["TaskManager"]:::logic
        UR["UIRenderer"]:::logic
    end

    %% Persistence Layer
    Storage[(LocalStorage)]:::storage

    %% Data Flows
    User -->|"interacts with"| UIComponents
    UIComponents -->|"captured by"| EH
    EH -->|"saveTask() / updateTask() / deleteTask()"| TM
    TM -->|"setItem()"| Storage
    Storage -->|"loadTasks() on page load"| TM
    TM -->|"getTasks()"| UR
    UR -->|"render() updates DOM"| UIComponents

    %% Click Events
    click HTML "https://github.com/saiyazulhasan/focus-flow/blob/main/index.html"
    click CSS "https://github.com/saiyazulhasan/focus-flow/blob/main/style.css"
    click EH "https://github.com/saiyazulhasan/focus-flow/blob/main/script.js"
    click TM "https://github.com/saiyazulhasan/focus-flow/blob/main/script.js"
    click UR "https://github.com/saiyazulhasan/focus-flow/blob/main/script.js"
    click Storage "https://github.com/saiyazulhasan/focus-flow/blob/main/script.js"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0044CC,color:#000;
    classDef logic fill:#E0FFD8,stroke:#228B22,color:#000;
    classDef storage fill:#FFD8A8,stroke:#FF8C00,color:#000;
    classDef external fill:#EEEEEE,stroke:#AAAAAA,color:#000;
```
