# mrishalk/task-manager architecture

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

- Interactive diagram: https://gitdiagram.com/mrishalk/task-manager
- Repository: https://github.com/mrishalk/task-manager

## Overview

##### Project Type and Purpose
- This is a single-page React application bootstrapped with Create React App (CRA).
- Its focus is on task management: users can add tasks, organize them (via TaskColumn, TaskList), and interact through modals and forms.
- There is no separate backend—state is managed client-side, likely persisted to localStorage (inferred from useTasks and utils).

##### File Structure Analysis
- Top Level
- public/ – contains static assets and index.html entry point
- src/ – React application source code
- package.json / package-lock.json – dependencies and scripts
- src/
- App.js – root component
- components/ – UI pieces (AddTask, TaskColumn, TaskForm, TaskItem, TaskList, TaskModal)
- hooks/useTasks.js – custom hook for state management and persistence
- constants.js, utils.js – shared values and helper functions
- index.js, index.css, style.css – app entry and global styles
- reportWebVitals.js, setupTests.js, App.test.js – performance reporting & testing

##### README Insights
- Standard CRA setup; no mention of backend or external APIs.
- Build and deployment are handled via CRA scripts (npm start, build, test).

##### Main Components and Relationships
- Browser & Web Server
→ Serves static files from public/ including index.html
- React Root (index.js → App.js)
→ Loads CSS, mounts App into the DOM
- App Component
→ Uses useTasks hook to hold task list state and persist changes
→ Renders TaskColumn(s) (e.g., “To Do,” “In Progress,” “Done”)
- TaskColumn
→ Contains TaskList (filtered tasks by status)
- TaskList → maps over tasks → renders TaskItem
- TaskItem → shows individual task details; may open TaskModal
- AddTask & TaskForm
→ Trigger state updates via useTasks (add / update tasks)
- TaskModal
→ Edits or deletes tasks
- Persistence Layer
→ useTasks interacts with localStorage (or other browser storage) via utils.js

##### Architectural Patterns & Principles
- Component-Based UI: Reusable, single-responsibility React components
- Custom Hook for Encapsulated State + Persistence: useTasks abstracts CRUD + storage
- Unidirectional Data Flow: App → components; components invoke hook callbacks to update state
- Separation of Concerns: UI vs. data logic vs. utils/constants

##### Key Takeaways for the Engineer
- UseTasks hook centrally managing data flow between UI and storage.
- Be exhaustive but clear—every component from src/components should appear.
- Interactions (e.g., “onSubmit invokes addTask() in useTasks”).
- Labels are concise and placement reflects hierarchy: index.html → App → child components → storage.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Static Hosting Layer
    subgraph "Static Hosting"
        SFS["Static File Server"]:::static
        HTML["index.html / bundle.js"]:::static
        click SFS "https://github.com/mrishalk/task-manager/blob/main/public/index.html"
    end
    SFS -->|"serves"| HTML

    %% Browser Entry
    subgraph "Browser Entry"
        JS["src/index.js"]:::entry
        CSS1["src/index.css"]:::entry
        CSS2["src/style.css"]:::entry
        click JS "https://github.com/mrishalk/task-manager/blob/main/src/index.js"
        click CSS1 "https://github.com/mrishalk/task-manager/blob/main/src/index.css"
        click CSS2 "https://github.com/mrishalk/task-manager/blob/main/src/style.css"
    end
    HTML -->|"loads bundle"| JS
    HTML -->|"loads styles"| CSS1
    HTML -->|"loads styles"| CSS2

    %% React Root and App
    JS --> App["App"]:::ui
    click App "https://github.com/mrishalk/task-manager/blob/main/src/App.js"

    %% State Management Layer
    subgraph "State Management"
        UT["useTasks Hook"]:::logic
        click UT "https://github.com/mrishalk/task-manager/blob/main/src/hooks/useTasks.js"
        CONST["constants.js"]:::logic
        click CONST "https://github.com/mrishalk/task-manager/blob/main/src/constants.js"
        UTIL["utils.js"]:::logic
        click UTIL "https://github.com/mrishalk/task-manager/blob/main/src/utils.js"
    end
    App -->|"hydrate"| UT
    UT -->|"uses constants"| CONST
    UT -->|"uses utils"| UTIL

    %% Persistence
    subgraph "Persistence"
        PERSIST["localStorage"]:::persist
    end
    UT -->|"persist"| PERSIST
    PERSIST -->|"hydrate state"| UT

    %% UI Components Layer
    subgraph "UI Components"
        AT["AddTask"]:::ui
        click AT "https://github.com/mrishalk/task-manager/blob/main/src/components/AddTask.jsx"
        TC["TaskColumn"]:::ui
        click TC "https://github.com/mrishalk/task-manager/blob/main/src/components/TaskColumn.jsx"
        TL["TaskList"]:::ui
        click TL "https://github.com/mrishalk/task-manager/blob/main/src/components/TaskList.jsx"
        TI["TaskItem"]:::ui
        click TI "https://github.com/mrishalk/task-manager/blob/main/src/components/TaskItem.jsx"
        TF["TaskForm"]:::ui
        click TF "https://github.com/mrishalk/task-manager/blob/main/src/components/TaskForm.jsx"
        TM["TaskModal"]:::ui
        click TM "https://github.com/mrishalk/task-manager/blob/main/src/components/TaskModal.jsx"
    end
    App -->|"render columns"| TC
    TC -->|"render list"| TL
    TL -->|"render items"| TI
    AT -->|"open form"| TF
    TF -->|"onSubmit addTask"| UT
    TI -->|"onEdit"| TM
    TM -->|"onSave updateTask"| UT
    TM -->|"onDelete deleteTask"| UT
    UT -->|"state update triggers rerender"| App

    %% Build & Tooling
    subgraph "Build & Tooling"
        PKG["package.json"]:::tool
        click PKG "https://github.com/mrishalk/task-manager/blob/main/package.json"
        PLK["package-lock.json"]:::tool
        click PLK "https://github.com/mrishalk/task-manager/blob/main/package-lock.json"
        TEST["App.test.js / setupTests.js"]:::tool
        click TEST "https://github.com/mrishalk/task-manager/blob/main/src/App.test.js"
        click TEST "https://github.com/mrishalk/task-manager/blob/main/src/setupTests.js"
        RWH["reportWebVitals.js"]:::tool
        click RWH "https://github.com/mrishalk/task-manager/blob/main/src/reportWebVitals.js"
    end

    classDef static fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef entry fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef ui fill:#add8e6,stroke:#333,stroke-width:1px
    classDef logic fill:#98fb98,stroke:#333,stroke-width:1px
    classDef persist fill:#ffa500,stroke:#333,stroke-width:1px
    classDef tool fill:#dda0dd,stroke:#333,stroke-width:1px
```
