# santiagolator/reinvent-steps architecture

> Architecture diagram of the GitHub repository santiagolator/reinvent-steps, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/santiagolator/reinvent-steps
- Repository: https://github.com/santiagolator/reinvent-steps

## Overview

##### Tipo de proyecto y propósito (qué estás diagramando)
Por el `file_tree` + README, esto es una **aplicación frontend estática** (SPA) hecha con **React 18 + Vite 5**, estilada con **Tailwind CSS/PostCSS**, cuyo propósito es **generar una tarjeta personalizada** con estadísticas de pasos (1–7 días), venues recorridos y un **rango** calculado; luego permite **descargar la tarjeta como PNG** usando **Canvas API**.
No hay backend, base de datos ni autenticación en el repo; el deployment mencionado es a **Vercel** (hosting estático).

**Implicación para el diagrama:** la arquitectura es principalmente **cliente → lógica de UI → generación de imagen (Canvas) → descarga local**, y el resto son componentes de build/tooling y hosting.

##### Anatomía del repo (cómo mapear carpeta/archivos a “componentes” del diagrama)
Estructura relevante:
- `index.html`: shell HTML de Vite donde se monta React.
- `src/main.jsx`: **entrypoint** (crea root, monta `<App />`).
- `src/App.jsx`: **núcleo funcional** (UI + estado + cálculos + probablemente lógica de canvas/export).
- `src/index.css`: estilos globales (Tailwind base + utilities).
- `tailwind.config.js`, `postcss.config.js`: pipeline de estilos.
- `vite.config.js`: bundling/build/dev server.
- `public/`: assets estáticos (favicon).
- `package.json`, `package-lock.json`: dependencias y scripts.
- `.vscode`, `.gitignore`: no arquitectónicos (generalmente no van al diagrama).

**Traducción a “bloques” diagramables:**
- Runtime (en el navegador): `index.html` + `main.jsx` + `App.jsx` + Tailwind CSS compilado.
- Tooling (build time): Vite + PostCSS + Tailwind.
- Hosting (runtime infra): Vercel sirviendo `dist/` (resultado de `npm run build`).

##### Interacciones clave a reflejar (flujos de datos)
Dentro del navegador, el flujo típico que conviene dibujar:
##### Cálculo de métricas
- total pasos
- rango (lookup en `RANKS` dentro de `App.jsx`)
- badges/colores/emoji
##### Generación de PNG
- UI gatilla “Descargar”
- lógica usa **Canvas API** (o similar) para dibujar la tarjeta
- crea `Blob`/`dataURL`
##### Descarga local (anchor download / File API).
No hay persistencia: todo se queda en memoria del cliente.

##### Qué diagramas dibujar (para “best and most accurate”)
Para este proyecto (frontend-only), lo más útil es hacer **2 niveles**: un **C4 Container** (macro) y un **C4 Component / runtime flow** (micro). Si querés ser más detallista, agregás un “Build/Deploy pipeline” separado.

##### Diagrama 1 — “System/Container” (macro)
Objetivo: mostrar el sistema completo y su despliegue.

**Bloques recomendados:**
- **User (Browser)**
- **Vercel (Static Hosting/CDN)** sirviendo assets
- **React SPA** (en el browser)
- **No Backend / No DB** (explicitarlo evita malentendidos)
- **Canvas API (Browser capability)** como dependencia del runtime

**Flechas:**
- Browser ↔ Vercel: `GET /` + assets JS/CSS
- User → React SPA: interacción UI
- React SPA → Canvas API: “Render card to canvas”
- React SPA → File download: “Export PNG”

##### Diagrama 2 — “Component / Runtime” (micro)
Objetivo: mostrar cómo el código se organiza y cómo fluye el dato dentro del cliente.

**Bloques recomendados (ajustados a tu repo):**
- `index.html` (mount point)
- `src/main.jsx` (bootstrap React root)
- `src/App.jsx` (core)
- Sub-bloques lógicos dentro de App (aunque estén en el mismo archivo):
- **Input Model**: pasos diarios (1–7), venues
- **Rank Engine**: `RANKS` + función de matching (min/max)
- **PNG Exporter**: Canvas drawing → blob/dataURL → download
- `src/index.css` + Tailwind utilities (estilos aplicados al UI)

**Flechas:**
- `index.html` → `main.jsx` → `App.jsx`
- Inputs → state → derived computations (total/rank) → UI preview
- UI preview / derived data → PNG Exporter → Canvas → File download

##### Diagrama 3 (opcional pero recomendable) — Build & Deploy
Objetivo: que quede claro qué corre en build-time vs run-time.

**Bloques:**
- Developer machine
- `npm run dev` → Vite dev server (HMR)
- `npm run build` → `dist/`
- Vercel build pipeline (si aplica) → serve `dist/` via CDN

**Flechas:**
- Source (`src/`, configs) → Vite build → `dist/`
- `dist/` → Vercel hosting → Browser

##### Patrones/principios arquitectónicos presentes (para anotarlos en el diagrama)
- **Client-side only** (cero server-side logic).
- **Single entrypoint + single “god component”** (todo en `App.jsx` según README). En el diagrama podés marcar esto como “monolithic UI component” o “single component composition”.
- **Derived state**: rank/total calculado desde inputs.
- **Use of browser platform APIs**: Canvas API como “subsystem” clave.
- **Utility-first styling**: Tailwind (build-time) → CSS final (runtime).

##### Cómo “separar en la mayor cantidad de componentes posible” sin inventar cosas
Aunque el repo sea chico, podés descomponer por **responsabilidad**, y dejar explícito que están co-localizadas en `App.jsx`. Ejemplo de cajas internas:
- StepsInput (1–7 days)
- VenuesSelector
- RankCalculator (RANKS lookup)
- CardPreview
- PngExportService (Canvas)
- Assets/Styling (Tailwind)

En el diagrama ponés una nota: “Implementado en `src/App.jsx` (puede refactorizarse a componentes separados)”.

##### Convenciones visuales (para que el diagrama quede “ingenieril” y legible)
Incluí sí o sí:
- **Etiquetas claras** con nombre + archivo (cuando aplica): e.g., “App (src/App.jsx)”
- **Flechas direccionales** con verbos: “serves”, “computes”, “renders”, “exports”
- Rectángulos azules: runtime en browser
- Rectángulos verdes: build/deploy toolchain
- Cilindros (si hubiera DB; acá podés omitir o poner “None” en gris)
- Caja punteada: “Browser APIs” (Canvas, File download)

##### Plantilla rápida (texto) para convertir a diagrama
**Macro (Containers):**
- User → Browser
- Browser runs React SPA (Vite-built bundle)
- Browser loads assets from Vercel CDN
- React SPA uses Canvas API → generates PNG → triggers download

**Micro (Components):**
- index.html mounts → main.jsx bootstraps → App.jsx
- App.jsx:
- Collect inputs (steps 1–7, venues)
- Compute totals & rank (RANKS)
- Render preview (Tailwind)
- Export PNG (Canvas → blob/url → download)

Si me pegás el contenido de `src/App.jsx`, puedo decirte exactamente qué subcomponentes lógicos existen (nombres de handlers, funciones de export, estructura de estado) y proponerte un diagrama aún más fiel al flujo real de la app.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %%========================
    %% External Actors / Infra
    %%========================
    U["User"]:::external
    B["Browser (Client Runtime)"]:::external
    V["Vercel (Static Hosting/CDN)"]:::hosting

    %%========================
    %% Delivered Static Assets
    %%========================
    subgraph "Static App Delivery (from Vercel)"
        H["HTML Shell (Vite)"]:::runtime
        A["Static Assets (favicon, etc.)"]:::runtime
        JS["JS Bundle (Vite output)"]:::runtime
        CSS["CSS Bundle (Tailwind output)"]:::runtime
    end

    %%========================
    %% SPA Runtime (in Browser)
    %%========================
    subgraph "React SPA Runtime (in Browser)"
        direction TB
        IDX["Mount Point DOM (#root)"]:::runtime

        subgraph "Bootstrap"
            direction TB
            M["React Bootstrap / Entry Point"]:::runtime
        end

        subgraph "Core UI + Logic"
            direction TB
            APP["Core React SPA (single main component)"]:::runtime

            subgraph "Co-located responsibilities (inside App)"
                direction TB
                INP["Input Model\n(steps 1–7 days, venues)"]:::logic
                STATE["React State\n(inputs + derived values)"]:::logic
                CALC["Metrics & Rank Engine\n(total steps + RANKS lookup)"]:::logic
                PREV["Card Preview Renderer\n(JSX + Tailwind classes)"]:::runtime
                EXP["PNG Exporter\n(draw card → Blob/dataURL)"]:::logic
            end
        end

        subgraph "Browser Platform APIs"
            direction TB
            CAN["Canvas API"]:::browserapi
            DL["File Download\n(anchor download / Blob URL)"]:::browserapi
        end

        NOTE["No Backend / No DB\nAll data in-memory (client-side only)"]:::note
    end

    %%========================
    %% Build & Tooling (Build-time)
    %%========================
    subgraph "Build & Tooling (Build-time)"
        direction TB
        DEV["Developer Machine / CI"]:::tooling

        subgraph "Toolchain"
            direction TB
            PKG["Project Scripts & Dependencies\n(npm scripts + deps)"]:::tooling
            VITE["Vite (dev server + bundling)"]:::tooling
            POST["PostCSS Pipeline"]:::tooling
            TW["Tailwind CSS Config"]:::tooling
            CONF["Vite Config"]:::tooling
            DOC["Documentation / Usage Notes"]:::doc
        end

        SRC["Source Files\n(index.html + src/ + public/)"]:::tooling
        DIST["dist/ (static build output)"]:::artifact
    end

    %%========================
    %% Relationships (Vertical)
    %%========================
    U -->|"uses"| B
    B -->|"GET / + assets"| V
    V -->|"serves"| H
    V -->|"serves"| JS
    V -->|"serves"| CSS
    V -->|"serves"| A

    H -->|"contains"| IDX
    JS -->|"executes"| M
    M -->|"mounts"| APP
    CSS -->|"styles"| PREV

    U -->|"inputs steps/venues"| INP
    INP -->|"updates"| STATE
    STATE -->|"derives"| CALC
    CALC -->|"feeds"| PREV
    PREV -->|"user clicks Download"| EXP
    EXP -->|"draws"| CAN
    CAN -->|"produces PNG (Blob/dataURL)"| DL
    DL -->|"downloads locally"| U

    APP -.->|"client-only"| NOTE
    APP -->|"uses"| CAN
    APP -->|"triggers"| DL

    %% Build pipeline
    DEV -->|"runs"| PKG
    PKG -->|"npm run dev/build"| VITE
    SRC -->|"bundles"| VITE
    TW -->|"provides utilities"| POST
    POST -->|"processes CSS"| VITE
    CONF -->|"configures"| VITE
    VITE -->|"outputs"| DIST
    DIST -->|"deployed to"| V
    DOC -.->|"describes"| SRC

    %%========================
    %% Click Events (from mapping)
    %%========================
    click H "https://github.com/santiagolator/reinvent-steps/blob/main/index.html"
    click M "https://github.com/santiagolator/reinvent-steps/blob/main/src/main.jsx"
    click APP "https://github.com/santiagolator/reinvent-steps/blob/main/src/App.jsx"
    click CSS "https://github.com/santiagolator/reinvent-steps/blob/main/src/index.css"
    click A "https://github.com/santiagolator/reinvent-steps/tree/main/public/"
    click TW "https://github.com/santiagolator/reinvent-steps/blob/main/tailwind.config.js"
    click POST "https://github.com/santiagolator/reinvent-steps/blob/main/postcss.config.js"
    click CONF "https://github.com/santiagolator/reinvent-steps/blob/main/vite.config.js"
    click PKG "https://github.com/santiagolator/reinvent-steps/blob/main/package.json"
    click DOC "https://github.com/santiagolator/reinvent-steps/blob/main/README.md"

    %%========================
    %% Styles (color!)
    %%========================
    classDef external fill:#0f172a,stroke:#1e293b,color:#e2e8f0,stroke-width:1.5px
    classDef hosting fill:#14532d,stroke:#166534,color:#ecfdf5,stroke-width:1.5px
    classDef runtime fill:#1d4ed8,stroke:#1e40af,color:#eff6ff,stroke-width:1.5px
    classDef logic fill:#6d28d9,stroke:#5b21b6,color:#f5f3ff,stroke-width:1.5px
    classDef browserapi fill:#0f766e,stroke:#115e59,color:#ecfeff,stroke-width:1.5px
    classDef tooling fill:#047857,stroke:#065f46,color:#ecfdf5,stroke-width:1.5px
    classDef artifact fill:#334155,stroke:#1f2937,color:#f1f5f9,stroke-width:1.5px
    classDef note fill:#f59e0b,stroke:#b45309,color:#111827,stroke-width:1.5px
    classDef doc fill:#7c2d12,stroke:#9a3412,color:#fff7ed,stroke-width:1.5px
```
