# luis3132/autolifefe architecture

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

- Interactive diagram: https://gitdiagram.com/luis3132/autolifefe
- Repository: https://github.com/luis3132/autolifefe

## Overview

##### Project type and purpose
- This is a Next.js-based front-end web application, written in TypeScript, styled with Tailwind CSS, and organized with the new app/ directory routing.
- It exposes multiple pages under `/app/home`, `/app/taller`, etc., and relies on reusable React components (e.g. auth, navbar, servicios, vehiculo) to compose the UI.

##### File structure
- Top-level config files: `next.config.mjs`, `tsconfig.json`, `tailwind.config.ts`, ESLint config.
- `/public`: static assets (images, logo).
- `/src/app`: Next.js routes and layouts; each subfolder corresponds to a route and contains its `page.tsx`.
- `/src/components`: shared UI components grouped by feature (auth, navbar, legislacion, etc.).
- `/src/lib`: helper hooks (`auth.ts`), scripts (`comprobar.ts`), and TypeScript types.

##### Key insights from README
- Bootstrapped with Create-Next-App.
- Optimized font loading via `next/font`.
- Designed for deployment on Vercel but can run locally with `npm run dev`.

##### Detailed capture of essential architecture
- Break out the Next.js Server into sub-components:
- Routing layer (`/src/app`)
- Component library (`/src/components`)
- Utility layer (`/src/lib`)
- That each top-level route folder under `/app` (home, taller, etc.) is a node in the routing graph.
- Data flow: user clicks → Next.js server renders page → uses hooks from `/src/lib/auth` to determine session → fetches data from external API → returns HTML/CSS/JS → browser hydrates client components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Tier
    Browser["Client Browser"]:::ui
    Browser -->|"Request Pages"| NextServer
    Browser -->|"Fetch Static Assets"| CDN

    %% Infrastructure Layer
    subgraph "Delivery & Compute" 
        direction TB
        CDN["CDN / Static Assets"]:::infra
        NextServer["Next.js Server (SSR/SSG)"]:::infra
    end

    %% Next.js Server Internals
    subgraph "Next.js Server" 
        direction TB
        subgraph "Routing Layer (src/app)"
            direction TB
            Layout["layout.tsx"]:::ui
            RootPage["page.tsx"]:::ui
            subgraph "Home Routes"
                direction TB
                HomePage["home/page.tsx"]:::ui
                PerfilHome["home/perfil/page.tsx"]:::ui
                RegulacionHome["home/regulacion/page.tsx"]:::ui
                ServiciosHome["home/servicios/page.tsx"]:::ui
                VehPrivHome["home/vehiculoPrivado/page.tsx"]:::ui
                VehPubHome["home/vehiculoPublico/page.tsx"]:::ui
            end
            subgraph "Taller Routes"
                direction TB
                TallerPage["taller/page.tsx"]:::ui
                PerfilTaller["taller/perfil/page.tsx"]:::ui
                ServTaller["taller/vehiculoServicios/page.tsx"]:::ui
                SolTaller["taller/vehiculoSolicitudes/page.tsx"]:::ui
            end
            PublicVeh["vehiculoPublico/page.tsx"]:::ui
        end
        subgraph "Component Library (src/components)"
            direction TB
            subgraph "Auth Components"
                AuthUI["auth/auth.tsx"]:::ui
                AuthT["auth/authT.tsx"]:::ui
            end
            subgraph "Navigation Bars"
                MainNav["navbar/mainNavbar.tsx"]:::ui
                NavOut["navbar/navbarLogOut.tsx"]:::ui
                NavTaller["navbar/navbarTaller.tsx"]:::ui
                NavUser["navbar/navbarUsuario.tsx"]:::ui
            end
            subgraph "Legislación"
                ListReg["legislacion/listRegulacion.tsx"]:::ui
                DetReg["legislacion/detailsRegulacion.tsx"]:::ui
            end
            subgraph "Notifications"
                ListNot["notificaciones/listNotificaciones.tsx"]:::ui
                DetNot["notificaciones/detailsNotificaciones.tsx"]:::ui
                Notif["notificaciones/notificacion.tsx"]:::ui
            end
            subgraph "User Profiles"
                Perfil["perfil/perfil.tsx"]:::ui
                PerfilT["perfil/perfilT.tsx"]:::ui
            end
            subgraph "Services"
                ListServ["servicios/listUsuario.tsx"]:::ui
                SeeTaller["servicios/seeTaller.tsx"]:::ui
            end
            subgraph "Vehicle Management"
                ListVeh["vehiculo/listVehiculo.tsx"]:::ui
                AddVeh["vehiculo/addVehiculo.tsx"]:::ui
                SeeVeh["vehiculo/seeVehiculo.tsx"]:::ui
                LegVeh["vehiculo/legislacion/listLegislacion.tsx"]:::ui
            end
        end
        subgraph "Utility Layer (src/lib)"
            direction TB
            AuthHook["hooks/auth.ts"]:::infra
            Script["scripts/comprobar.ts"]:::infra
            Types["types/types.d.ts"]:::infra
        end
    end

    %% External Services
    subgraph "External Systems"
        direction TB
        AuthService["Auth Service"]:::ext
        DataAPI["Data API / Database"]:::ext
    end

    %% Data Flows
    NextServer -->|"Uses Auth Hook"| AuthHook
    NextServer -->|"Runs Scripts"| Script
    NextServer -->|"Reads Types"| Types
    NextServer -->|"Calls "| AuthService
    NextServer -->|"Fetch Data"| DataAPI
    NextServer -->|"Serves Assets"| CDN

    %% Click Events for Routing Layer
    click Layout "https://github.com/luis3132/autolifefe/blob/main/src/app/layout.tsx"
    click RootPage "https://github.com/luis3132/autolifefe/blob/main/src/app/page.tsx"
    click HomePage "https://github.com/luis3132/autolifefe/blob/main/src/app/home/page.tsx"
    click PerfilHome "https://github.com/luis3132/autolifefe/blob/main/src/app/home/perfil/page.tsx"
    click RegulacionHome "https://github.com/luis3132/autolifefe/blob/main/src/app/home/regulacion/page.tsx"
    click ServiciosHome "https://github.com/luis3132/autolifefe/blob/main/src/app/home/servicios/page.tsx"
    click VehPrivHome "https://github.com/luis3132/autolifefe/blob/main/src/app/home/vehiculoPrivado/page.tsx"
    click VehPubHome "https://github.com/luis3132/autolifefe/blob/main/src/app/home/vehiculoPublico/page.tsx"
    click TallerPage "https://github.com/luis3132/autolifefe/blob/main/src/app/taller/page.tsx"
    click PerfilTaller "https://github.com/luis3132/autolifefe/blob/main/src/app/taller/perfil/page.tsx"
    click ServTaller "https://github.com/luis3132/autolifefe/blob/main/src/app/taller/vehiculoServicios/page.tsx"
    click SolTaller "https://github.com/luis3132/autolifefe/blob/main/src/app/taller/vehiculoSolicitudes/page.tsx"
    click PublicVeh "https://github.com/luis3132/autolifefe/blob/main/src/app/vehiculoPublico/page.tsx"

    %% Click Events for Component Library
    click AuthUI "https://github.com/luis3132/autolifefe/blob/main/src/components/auth/auth.tsx"
    click AuthT "https://github.com/luis3132/autolifefe/blob/main/src/components/auth/authT.tsx"
    click MainNav "https://github.com/luis3132/autolifefe/blob/main/src/components/navbar/mainNavbar.tsx"
    click NavOut "https://github.com/luis3132/autolifefe/blob/main/src/components/navbar/navbarLogOut.tsx"
    click NavTaller "https://github.com/luis3132/autolifefe/blob/main/src/components/navbar/navbarTaller.tsx"
    click NavUser "https://github.com/luis3132/autolifefe/blob/main/src/components/navbar/navbarUsuario.tsx"
    click ListReg "https://github.com/luis3132/autolifefe/blob/main/src/components/legislacion/listRegulacion.tsx"
    click DetReg "https://github.com/luis3132/autolifefe/blob/main/src/components/legislacion/detailsRegulacion.tsx"
    click ListNot "https://github.com/luis3132/autolifefe/blob/main/src/components/notificaciones/listNotificaciones.tsx"
    click DetNot "https://github.com/luis3132/autolifefe/blob/main/src/components/notificaciones/detailsNotificaciones.tsx"
    click Notif "https://github.com/luis3132/autolifefe/blob/main/src/components/notificaciones/notificacion.tsx"
    click Perfil "https://github.com/luis3132/autolifefe/blob/main/src/components/perfil/perfil.tsx"
    click PerfilT "https://github.com/luis3132/autolifefe/blob/main/src/components/perfil/perfilT.tsx"
    click ListServ "https://github.com/luis3132/autolifefe/blob/main/src/components/servicios/listUsuario.tsx"
    click SeeTaller "https://github.com/luis3132/autolifefe/blob/main/src/components/servicios/seeTaller.tsx"
    click ListVeh "https://github.com/luis3132/autolifefe/blob/main/src/components/vehiculo/listVehiculo.tsx"
    click AddVeh "https://github.com/luis3132/autolifefe/blob/main/src/components/vehiculo/addVehiculo.tsx"
    click SeeVeh "https://github.com/luis3132/autolifefe/blob/main/src/components/vehiculo/seeVehiculo.tsx"
    click LegVeh "https://github.com/luis3132/autolifefe/blob/main/src/components/vehiculo/legislacion/listLegislacion.tsx"

    %% Click Events for Utility Layer
    click AuthHook "https://github.com/luis3132/autolifefe/blob/main/src/lib/hooks/auth.ts"
    click Script "https://github.com/luis3132/autolifefe/blob/main/src/lib/scripts/comprobar.ts"
    click Types "https://github.com/luis3132/autolifefe/blob/main/src/lib/types/types.d.ts"

    %% Click Events for Public and Config
    click CDN "https://github.com/luis3132/autolifefe/tree/main/public"
    click NextServer "https://github.com/luis3132/autolifefe/blob/main/next.config.mjs"
    click Browser "https://github.com/luis3132/autolifefe/blob/main/tsconfig.json"

    classDef ui fill:#BBE1FA,stroke:#333,stroke-width:1px
    classDef infra fill:#C3FDB8,stroke:#333,stroke-width:1px
    classDef ext fill:#FFEE93,stroke:#333,stroke-width:1px
```
