# kitikazis/to-do-list architecture

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

- Interactive diagram: https://gitdiagram.com/kitikazis/to-do-list
- Repository: https://github.com/kitikazis/to-do-list

## Overview

##### Project Type and Purpose
- This is a simple full-stack web application written in PHP that implements a To-Do List.
- It uses flat JSON files under a JSON directory for data storage rather than a relational database.
- The frontend assets (CSS, JS, images) are organized into separate directories, and dynamic pages live under pages/.

##### High-Level Structure
- Entry Point: index.php at the project root, which likely includes or routes to the various pages.
- Pages: pages/login.php, actividades.php, calendario.php, progreso.php – each corresponds to a user view.
- Static Assets:
- CSS/: Styles for each page (index.css, login.css, etc.).
- JS/: Client-side scripts (index.js, animaciones.js).
- IMG/: Any image assets used by the UI.
- Data Storage: JSON/: actividades.json (tasks data), login.json (user credentials/session info).

##### Components
- Client Web Browser (UI)
- Loads HTML/CSS/JS from the server.
- Initiates HTTP requests for page navigation and data operations.
- Web Server / PHP Runtime
- Serves PHP pages and handles form submissions or AJAX calls.
- Reads and writes to JSON files in the JSON/ directory.
- File System (Data Layer)
- JSON files act as the persistent store.
- Directory structure is flat—no database server.
- Static Asset Server
- Either the same PHP server or a separate CDN/HTTP static file handler serves CSS, JS, and IMG.

##### Interactions and Data Flow
- User enters app URL → Browser sends HTTP GET to index.php.
- PHP Router/Controller logic in index.php dispatches to one of pages/*.php.
- pages/*.php reads JSON files (via PHP file I/O) to render HTML with current tasks/user info.
- When user adds or updates a task, the page issues an HTML form POST or AJAX request to a PHP endpoint.
- PHP script processes input, updates the appropriate JSON file, and returns success/failure.
- Browser updates the UI (possibly via JS animaciones.js) to reflect changes without a full reload.

##### Architectural Patterns and Principles
- Separation of Concerns:
- Static assets separated from dynamic code.
- One directory for presentation (CSS, JS) and one for business logic (pages/, index.php).
- Flat-File Storage:
- No database layer—simplifies deployment but trades off scalability.
- Minimal MVC:
- “Controller” logic in index.php or at top of each pages/*.php.
- “View” embedded in PHP pages.
- “Model” layer is minimal—direct PHP↔JSON file I/O.

##### Key Takeaway
- Separation between dynamic routing logic and static asset delivery.
- Read/write cycle to JSON files as your “database” layer.
- This approach ensures any stakeholder can understand the flow, the responsibilities of each module, and where to focus for scaling or refactoring (e.g., replacing JSON with a real database).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Client Web Browser"]:::presentation

    %% Server Layer
    subgraph "PHP Server"
        direction TB
        subgraph "Controller (PHP Runtime)" 
            direction TB
            Router["index.php (Router)"]:::application
            LoginPage["login.php"]:::application
            ActividadesPage["actividades.php"]:::application
            CalendarioPage["calendario.php"]:::application
            ProgresoPage["progreso.php"]:::application
        end
        subgraph "Static File Handler"
            direction TB
            CSSDir["CSS/"]:::presentation
            JSDir["JS/"]:::presentation
            IMGDir["IMG/"]:::presentation
        end
    end

    %% Data Layer
    JSONStore["JSON Data Store"]:::data
    ActividadesJSON["actividades.json"]:::data
    LoginJSON["login.json"]:::data

    %% Interactions
    Browser -->|"HTTP GET /index.php"| Router
    Browser -->|"GET CSS/JS/IMG"| CSSDir
    Browser -->|"GET CSS/JS/IMG"| JSDir
    Browser -->|"GET CSS/JS/IMG"| IMGDir

    Router -->|"dispatch to pages"| LoginPage
    Router -->|"dispatch to pages"| ActividadesPage
    Router -->|"dispatch to pages"| CalendarioPage
    Router -->|"dispatch to pages"| ProgresoPage

    LoginPage -->|"read/write"| LoginJSON
    ActividadesPage -->|"read/write"| ActividadesJSON
    CalendarioPage -->|"read/write"| ActividadesJSON
    ProgresoPage -->|"read/write"| ActividadesJSON

    CSSDir -->|serves| Browser
    JSDir -->|serves| Browser
    IMGDir -->|serves| Browser
    Router -->|renders HTML/CSS/JS| Browser
    LoginPage -->|renders HTML| Browser
    ActividadesPage -->|renders HTML| Browser
    CalendarioPage -->|renders HTML| Browser
    ProgresoPage -->|renders HTML| Browser

    %% Click Events
    click Router "https://github.com/kitikazis/to-do-list/blob/main/index.php"
    click LoginPage "https://github.com/kitikazis/to-do-list/blob/main/pages/login.php"
    click ActividadesPage "https://github.com/kitikazis/to-do-list/blob/main/pages/actividades.php"
    click CalendarioPage "https://github.com/kitikazis/to-do-list/blob/main/pages/calendario.php"
    click ProgresoPage "https://github.com/kitikazis/to-do-list/blob/main/pages/progreso.php"
    click CSSDir "https://github.com/kitikazis/to-do-list/tree/main/CSS/"
    click JSDir "https://github.com/kitikazis/to-do-list/tree/main/JS/"
    click IMGDir "https://github.com/kitikazis/to-do-list/tree/main/IMG/"
    click ActividadesJSON "https://github.com/kitikazis/to-do-list/blob/main/JSON/actividades.json"
    click LoginJSON "https://github.com/kitikazis/to-do-list/blob/main/JSON/login.json"
    click README "https://github.com/kitikazis/to-do-list/blob/main/README.md"

    %% Styles
    classDef presentation fill:#AEDFF7,stroke:#034F84,color:#034F84;
    classDef application fill:#C1E1C1,stroke:#2E8B57,color:#2E8B57;
    classDef data fill:#FFD8B1,stroke:#E37222,color:#E37222;
```
