# l3anav/generador-links architecture

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

- Interactive diagram: https://gitdiagram.com/l3anav/generador-links
- Repository: https://github.com/l3anav/generador-links

## Overview

##### Project type and purpose
- This is a single-page web application (React + Vite) whose purpose is to let end users fill out a form, preview a personalized “link page” (like linktr.ee), and then download a ZIP of static files.
- It relies on an external REST API (deployed on Render.com) for any server-side link generation or templating logic.

##### File structure
- Top-level config: .eslintrc.cjs, vite.config.js, vercel.json → build + deployment
- public/index.html → SPA entrypoint
- src/
- main.jsx → app bootstrap (ReactDOM.render, router setup)
- App.jsx → root component with Wouter routing
- pages/ → home page, preview page (styled with styled-components)
- components/ → reusable pieces (Formulario form, Links list, etc.)
- store/useStore.jsx → global state management (Zustand)
- svg/, font/, theme.css, loader.css → static assets + theming
- package.json → key dependencies: react, vite, styled-components, wouter, react-hook-form, react-select, zustand, file-saver

##### Insights from README
- Describes evolution from CLI to web app
- Points to external “mis-links-generador” API
- Emphasizes download via File-Saver (client-side ZIP)
- Deployed on Vercel, uses pnpm

a. Main components
- User’s Browser / Client UI
- React SPA (grouped into Routing, Pages, Components, Store, Utils)
- External REST API service (mis-links-generador)
- File generation library (File-Saver in the browser)
- CDN / Static hosting (Vercel or GitHub Pages)
b. Relationships and data flow
1. Browser loads the SPA from Vercel/GitHub Pages
2. User navigates via Wouter router → Home page → fills Formulario (React Hook Form + react-select)
3. Form submission triggers onSubmit util → optionally posts data to External API → receives template or metadata
4. Preview page renders links list (Links.jsx) using styled-components
5. Download action uses File-Saver to generate and download a ZIP of static HTML/CSS/JS files
c. Architectural patterns & design principles
- Component-based UI (React) with clear separation: Pages vs. shared Components
- Unidirectional data flow: Form → Store → Preview
- Hooks for state (Zustand) and form handling (React Hook Form)
- Utility modules for pure functions (validation, options, handlers)
- Client-side rendering (CSR) with SPA routing (Wouter)
d. Key technologies
- React + Vite (build tool)
- Wouter (routing)
- React Hook Form & React Select (forms)
- Zustand (state management)
- Styled-Components (CSS-in-JS)
- File-Saver (client-side file download)
- External REST API (mis-links-generador)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Static Hosting & Build Config
    subgraph "Static Hosting & Build Config"
        direction TB
        ESLINT[".eslintrc.cjs"]:::external
        VITE["vite.config.js"]:::external
        VERCEL["vercel.json"]:::external
        PACKAGE["package.json"]:::external
    end

    %% Frontend SPA (Browser)
    subgraph "Frontend SPA (Browser)" 
        direction TB
        %% Entry Point
        subgraph "Entry Point"
            direction TB
            INDEX["public/index.html"]:::ui
        end

        %% App Bootstrap & Routing
        subgraph "App Bootstrap & Routing"
            direction TB
            MAIN["src/main.jsx"]:::ui
            APP["src/App.jsx"]:::ui
        end

        %% Pages
        subgraph "Pages"
            direction TB
            HomePage["Home Page\n(src/pages/home/home.jsx)"]:::ui
            PreviewPage["Preview Page\n(src/pages/preview/preview.jsx)"]:::ui
            PreviewStyles["Preview Styles\n(src/pages/preview/preview.styles.jsx)"]:::ui
        end

        %% Shared Components
        subgraph "Components"
            direction TB
            FormJSX["Formulario Component\n(src/components/formulario/formulario.jsx)"]:::ui
            FormCSS["Formulario Styles\n(src/components/formulario/formulario.css)"]:::ui
            LinksJSX["Links List Component\n(src/components/links/Links.jsx)"]:::ui
            LinksCSS["Links Styles\n(src/components/links/links.css)"]:::ui
        end

        %% State Management
        subgraph "Store"
            direction TB
            Store["useStore\n(src/store/useStore.jsx)"]:::state
        end

        %% Utilities
        subgraph "Utils"
            direction TB
            Colors["Color Constants\n(src/utils/colors.js)"]:::state
            ModalHandlers["Modal Handlers\n(src/utils/handlersVentanaModal.js)"]:::state
            OnSubmit["Form Submission Logic\n(src/utils/onSubmit.js)"]:::state
            Options["Select Options\n(src/utils/optionsSelect.js)"]:::state
            Validation["Form Validation\n(src/utils/validacionesFormulario.js)"]:::state
        end

        %% Assets & Theming
        subgraph "Assets & Theming"
            direction TB
            SVGs["SVG Assets\n(src/svg/)"]:::state
            Fonts["Font Files\n(src/font/)"]:::state
            ThemeCSS["Global Theme\n(src/theme.css)"]:::state
            LoaderCSS["Loader Styles\n(src/loader.css)"]:::state
        end

        %% File Generation
        FileSaver["File-Saver Library"]:::ui
    end

    %% External API Service
    ExternalAPI["External REST API\n(mis-links-generador)"]:::external

    %% User Download
    UserDownload["ZIP Downloaded to User"]:::external

    %% Connections
    ESLINT -->|"deployed via GET"| INDEX
    VITE --> INDEX
    VERCEL --> INDEX
    PACKAGE --> INDEX

    INDEX --> MAIN
    MAIN --> APP
    APP --> HomePage
    APP --> PreviewPage

    HomePage --> FormJSX
    FormJSX --> FormCSS
    FormJSX -->|uses React Hook Form\nand react-select| OnSubmit
    FormJSX -->|updates| Store

    OnSubmit -->|HTTP POST| ExternalAPI
    ExternalAPI -->|returns template metadata| PreviewPage

    Store --> PreviewPage
    PreviewPage --> PreviewStyles
    PreviewPage --> LinksJSX
    LinksJSX --> LinksCSS

    PreviewPage -->|click Download| FileSaver
    FileSaver -->|generates ZIP| UserDownload

    %% Click Events
    click ESLINT "https://github.com/l3anav/generador-links/blob/master/.eslintrc.cjs"
    click VITE "https://github.com/l3anav/generador-links/blob/master/vite.config.js"
    click VERCEL "https://github.com/l3anav/generador-links/blob/master/vercel.json"
    click PACKAGE "https://github.com/l3anav/generador-links/blob/master/package.json"
    click INDEX "https://github.com/l3anav/generador-links/blob/master/public/index.html"
    click MAIN "https://github.com/l3anav/generador-links/blob/master/src/main.jsx"
    click APP "https://github.com/l3anav/generador-links/blob/master/src/App.jsx"
    click HomePage "https://github.com/l3anav/generador-links/blob/master/src/pages/home/home.jsx"
    click PreviewPage "https://github.com/l3anav/generador-links/blob/master/src/pages/preview/preview.jsx"
    click PreviewStyles "https://github.com/l3anav/generador-links/blob/master/src/pages/preview/preview.styles.jsx"
    click FormJSX "https://github.com/l3anav/generador-links/blob/master/src/components/formulario/formulario.jsx"
    click FormCSS "https://github.com/l3anav/generador-links/blob/master/src/components/formulario/formulario.css"
    click LinksJSX "https://github.com/l3anav/generador-links/blob/master/src/components/links/Links.jsx"
    click LinksCSS "https://github.com/l3anav/generador-links/blob/master/src/components/links/links.css"
    click Store "https://github.com/l3anav/generador-links/blob/master/src/store/useStore.jsx"
    click Colors "https://github.com/l3anav/generador-links/blob/master/src/utils/colors.js"
    click ModalHandlers "https://github.com/l3anav/generador-links/blob/master/src/utils/handlersVentanaModal.js"
    click OnSubmit "https://github.com/l3anav/generador-links/blob/master/src/utils/onSubmit.js"
    click Options "https://github.com/l3anav/generador-links/blob/master/src/utils/optionsSelect.js"
    click Validation "https://github.com/l3anav/generador-links/blob/master/src/utils/validacionesFormulario.js"
    click SVGs "https://github.com/l3anav/generador-links/tree/master/src/svg/"
    click Fonts "https://github.com/l3anav/generador-links/tree/master/src/font/"
    click ThemeCSS "https://github.com/l3anav/generador-links/blob/master/src/theme.css"
    click LoaderCSS "https://github.com/l3anav/generador-links/blob/master/src/loader.css"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef state fill:#E6F4EA,stroke:#2e7d32,color:#2e7d32
    classDef external fill:#FFE8D0,stroke:#d9534f,color:#d9534f
```
