# dhruv-218/todo-app architecture

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

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

## Overview

##### Project Type and Purpose
- This is a single-page, front-end–only To-Do List web application built with React, Vite, and Tailwind CSS.
- Purpose: allow users to add/edit/delete/sort tasks by priority, mark tasks complete/incomplete, animate interactions, and persist data in browser storage.

##### File Structure Analysis
- Top-level files:
- index.html – host page for the SPA
- package.json / lock – dependency list
- vite.config.js, postcss.config.cjs, tailwind.config.js, eslint.config.js – build and lint configs
- Directories:
- public – static assets served as-is
- src – source code:
– main.jsx: app entry, React root mounting via Vite
– App.jsx + App.css: root component and styles
– index.css: global styles (Tailwind imports)
- No backend or external API; persistence via browser’s localStorage.

##### README Insights
- Features emphasize: client-side state management, localStorage persistence, animation, responsive design.

##### Main Components
a. User’s Browser (Client)
b. Vite Dev/Build Layer
c. React Application:
- UI Components (TaskList, TaskItem, TaskInput, PrioritySelector)
- State Management (React hooks/useState + useEffect for localStorage)
- Animation Layer (Framer Motion)
- Styling Layer (Tailwind CSS)
d. Data Persistence: localStorage (browser API)

##### Relationships & Data Flows
- User interacts via Browser UI → React components handle events
- React state updates → UI re-renders (with Framer Motion transitions)
- Effects hook serializes task list to localStorage
- On app load, main.jsx/App.jsx reads from localStorage into initial state
- Build tools (Vite) process source + Tailwind → final JS/CSS bundle served at index.html

##### Architectural Patterns & Design Principles
- Component-based UI (React)
- Unidirectional data flow: Props / Hooks → View
- Separation of concerns:
- UI Layer (JSX + CSS)
- Data Layer (state + persistence)
- Build Layer (Vite + Tailwind + PostCSS)
- Progressive enhancement: works offline after initial load (via localStorage)

##### Final Checklist
1. Browser → React App (user events)
2. React App → localStorage (read/write)
3. Source files → Vite (build) → Bundles → Browser

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build Tools Layer
    subgraph "Build & Config" 
        direction TB
        VITE["Vite Build (vite.config.js)"]:::build
        ESLINT["ESLint Config (eslint.config.js)"]:::build
        subgraph "CSS Pipeline"
            direction TB
            POSTCSS["PostCSS Config (postcss.config.cjs)"]:::build
            TAILWIND["Tailwind Config (tailwind.config.js)"]:::build
            INDEXCSS["Global Styles (src/index.css)"]:::build
        end
    end

    %% Source Files
    subgraph "Source Files"
        direction TB
        MAIN["App Entry (src/main.jsx)"]:::build
        APP["Root Component (src/App.jsx)"]:::ui
        APPCSS["App Styles (src/App.css)"]:::ui
        ASSETS["Static Assets (src/assets/)"]:::third
    end

    %% Bundling & Host
    VITE -->|bundles JS/CSS| BUNDLE["JS & CSS Bundle"]
    BUNDLE --> INDEXHTML["Host Page (index.html)"]:::third

    INDEXHTML --> BROWSER["User's Browser"]:::third

    BROWSER -->|loads SPA| REACT["React Application"]:::ui

    %% React App Internal
    subgraph "React Application"
        direction TB
        UI["UI Components"]:::ui
        STATE["State Management\n(useState/useEffect)"]:::ui
        ANIM["Framer Motion"]:::third
        ICON["Lucide React"]:::third
        STYLE["Tailwind CSS"]:::third
        STORAGE["localStorage"]:::persistence
    end

    REACT --> UI
    UI -->|renders| STATE
    STATE -->|serialize/deserialize| STORAGE
    UI -->|animations| ANIM
    UI -->|icons| ICON
    UI -->|styles| STYLE

    %% Arrows for data flow
    BROWSER -->|User Input| UI
    STATE -->|State Update| UI

    %% Legend
    subgraph "Legend"
        direction LR
        L1["UI Components"]:::ui
        L2["Data Persistence"]:::persistence
        L3["Build Tools"]:::build
        L4["Third-party Libs"]:::third
    end

    %% Click Events
    click INDEXHTML "https://github.com/dhruv-218/todo-app/blob/main/index.html"
    click VITE "https://github.com/dhruv-218/todo-app/blob/main/vite.config.js"
    click POSTCSS "https://github.com/dhruv-218/todo-app/blob/main/postcss.config.cjs"
    click TAILWIND "https://github.com/dhruv-218/todo-app/blob/main/tailwind.config.js"
    click INDEXCSS "https://github.com/dhruv-218/todo-app/blob/main/src/index.css"
    click MAIN "https://github.com/dhruv-218/todo-app/blob/main/src/main.jsx"
    click APP "https://github.com/dhruv-218/todo-app/blob/main/src/App.jsx"
    click APPCSS "https://github.com/dhruv-218/todo-app/blob/main/src/App.css"
    click ASSETS "https://github.com/dhruv-218/todo-app/tree/main/src/assets/"
    click ESLINT "https://github.com/dhruv-218/todo-app/blob/main/eslint.config.js"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef persistence fill:#90EE90,stroke:#333,stroke-width:1px
    classDef build fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef third fill:#FFD700,stroke:#333,stroke-width:1px
```
