# salvatierraj/gestura-front architecture

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

- Interactive diagram: https://gitdiagram.com/salvatierraj/gestura-front
- Repository: https://github.com/salvatierraj/gestura-front

## Overview

##### Project type and purpose
- This is a single-page front-end application built with React and Vite.
- It serves as an administrative and student portal (“Administrador” vs “Estudiantes”).
- It consumes external REST APIs for data (auth, casos, docentes, etc.).

##### File structure
- Top-level:
- index.html / main.jsx – application entry point
- src/layout – shared layout components (header, sidebar, login, mainLayout)
- src/features – feature modules split by user role (Administrador, Estudiantes), each with pages and nested components
- src/components – shared UI elements (menuItems, searchInput)
- src/services – HTTP client wrappers and domain-specific services
- src/store – global state management (authStore, casos.store, docentes.store, plus route guards)
- Vite config, ESLint, package.json, public assets.

##### README for additional insights
- Uses Vite with React plugin (Babel or SWC) for fast refresh.
- No built-in backend, so service calls go to an external API endpoint (configured in src/services/api.js).

##### Main components and their relationships
a. Presentation layer
- index.html → loads main.jsx → renders <App />
- <App /> wraps <Router> with route definitions and guards (public vs protected).
- Layout components (header, menuLateral) wrap feature pages.
- Feature pages (e.g., controlDeAcceso.jsx, MisDefensas.jsx) compose UI by invoking shared and feature-specific components.
b. State management
- src/store provides global stores for authentication, casos, docentes.
- Components dispatch actions to stores and subscribe to store state.
c. Service layer
- src/services/api.js configures Axios (base URL, interceptors).
- services/auth.js, casos.services.js, docentes.services.js call API endpoints.
- Stores invoke services to fetch/update data.
d. External dependencies
- REST API server (authentication, data persistence).
- pdf.worker.mjs – PDF generation/preview.

##### Architectural patterns and design principles
- Feature-based folder structure: each domain (Administrador, Estudiantes) encapsulates its pages and components.
- Unidirectional data flow: Services → Stores → Components.
- Separation of concerns:
- Presentation (components, pages, layout)
- Business logic (stores)
- Data access (services).
- Route guards enforce authentication logic.

- Step-by-step:
- Entry point (index.html → main.jsx → <App />).
- Router + Route Guards (publicRoute, authGuardRoute).
- Layout & UI components (header, menuLateral, pages).
- Feature modules (Administrador, Estudiantes) annotated as grouped sub-systems.
3. Assets:
- Public folder assets (site.webmanifest, pdf.worker.mjs) as static resources served by Vite/dev server.
4. Developer toolchain (optional):
- Build pipeline → dist folder.

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Client (Browser)"
    subgraph "Entry Point" 
      HTML["index.html"]:::ui
      Main["main.jsx"]:::ui
    end
    HTML --> Main
    Main --> App["App.jsx"]:::ui

    click HTML "https://github.com/salvatierraj/gestura-front/blob/main/index.html"
    click Main "https://github.com/salvatierraj/gestura-front/blob/main/src/main.jsx"
    click App "https://github.com/salvatierraj/gestura-front/blob/main/src/App.jsx"

    subgraph "Routing"
      PR["PublicRoute"]:::ui
      AG["AuthGuardRoute"]:::ui
    end
    App --> PR
    App --> AG

    click PR "https://github.com/salvatierraj/gestura-front/blob/main/src/store/publicRoute.jsx"
    click AG "https://github.com/salvatierraj/gestura-front/blob/main/src/store/authGuardRoute.jsx"

    subgraph "Layout & UI Components"
      Header["Header"]:::ui
      Sidebar["MenuLateral"]:::ui
      MainLayout["MainLayout"]:::ui
      LoginLayout["Login Layout"]:::ui
    end
    PR --> LoginLayout
    AG --> MainLayout
    MainLayout --> Header
    MainLayout --> Sidebar

    click Header "https://github.com/salvatierraj/gestura-front/blob/main/src/layout/header.jsx"
    click Sidebar "https://github.com/salvatierraj/gestura-front/blob/main/src/layout/menuLateral.jsx"
    click MainLayout "https://github.com/salvatierraj/gestura-front/blob/main/src/layout/mainLayout.jsx"
    click LoginLayout "https://github.com/salvatierraj/gestura-front/blob/main/src/layout/login.jsx"

    subgraph "Features"
      subgraph "Administrador Module"
        APages["Pages"]:::ui
        AComps["Components"]:::ui
      end
      subgraph "Estudiantes Module"
        EPages["Pages"]:::ui
      end
    end
    Sidebar --> APages
    Sidebar --> EPages
    MainLayout --> APages
    MainLayout --> EPages

    click APages "https://github.com/salvatierraj/gestura-front/tree/main/src/features/Administrador/pages"
    click AComps "https://github.com/salvatierraj/gestura-front/tree/main/src/features/Administrador/components"
    click EPages "https://github.com/salvatierraj/gestura-front/tree/main/src/features/Estudiantes/pages"

    subgraph "Shared UI Components"
      SC1["administradorContenido"]:::ui
      SC2["menuItems"]:::ui
      SC3["searchInput"]:::ui
    end
    APages --> SC1
    APages --> SC2
    APages --> SC3

    click SC1 "https://github.com/salvatierraj/gestura-front/blob/main/src/components/administradorContenido.jsx"
    click SC2 "https://github.com/salvatierraj/gestura-front/blob/main/src/components/menuItems.jsx"
    click SC3 "https://github.com/salvatierraj/gestura-front/blob/main/src/components/searchInput.jsx"

    subgraph "State Management"
      AuthStore["Auth Store"]:::store
      CasosStore["Casos Store"]:::store
      DocentesStore["Docentes Store"]:::store
    end
    APages --> AuthStore
    APages --> CasosStore
    APages --> DocentesStore
    EPages --> AuthStore
    EPages --> CasosStore
    EPages --> DocentesStore

    click AuthStore "https://github.com/salvatierraj/gestura-front/blob/main/src/store/authStore.js"
    click CasosStore "https://github.com/salvatierraj/gestura-front/blob/main/src/store/casos.store.js"
    click DocentesStore "https://github.com/salvatierraj/gestura-front/blob/main/src/store/docentes.store.js"

    subgraph "Service Layer"
      APIConf["api.js (Axios)"]:::service
      AuthSvc["auth.js"]:::service
      CasosSvc["casos.services.js"]:::service
      DocentesSvc["docentes.services.js"]:::service
    end
    AuthStore --> AuthSvc
    CasosStore --> CasosSvc
    DocentesStore --> DocentesSvc
    AuthSvc --> APIConf
    CasosSvc --> APIConf
    DocentesSvc --> APIConf

    click APIConf "https://github.com/salvatierraj/gestura-front/blob/main/src/services/api.js"
    click AuthSvc "https://github.com/salvatierraj/gestura-front/blob/main/src/services/auth.js"
    click CasosSvc "https://github.com/salvatierraj/gestura-front/blob/main/src/services/casos.services.js"
    click DocentesSvc "https://github.com/salvatierraj/gestura-front/blob/main/src/services/docentes.services.js"

    subgraph "Static Assets"
      PDF["pdf.worker.mjs"]:::asset
    end
    MainLayout --> PDF

    click PDF "https://github.com/salvatierraj/gestura-front/blob/main/pdf.worker.mjs"
    click PDF "https://github.com/salvatierraj/gestura-front/blob/main/public/pdf.worker.mjs"
  end

  ExternalAPI["API Server"]:::external
  APIConf -->|"HTTP"| ExternalAPI

  Vite["Vite Dev Server"]:::external
  Vite -->|"HMR"| Main

  Build["Production Build (dist)"]:::external
  Main -->|"Build"| Build

  classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
  classDef store fill:#90EE90,stroke:#333,stroke-width:1px
  classDef service fill:#FFFF99,stroke:#333,stroke-width:1px
  classDef external fill:#FFDAB9,stroke:#333,stroke-width:1px
  classDef asset fill:#E6E6FA,stroke:#333,stroke-width:1px
```
