# marcellreynoso/tesis architecture

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

- Interactive diagram: https://gitdiagram.com/marcellreynoso/tesis
- Repository: https://github.com/marcellreynoso/tesis

## Overview

##### Project Type and Purpose
- This is a full-stack Next.js application (React on the front end + serverless API routes on the back end) for collecting and displaying environmental and corporal sensor data and KPIs (e.g., humidity, temperature, BPM).

##### File-tree Analysis
- **src/app** holds both the UI (React pages/components) and the API routes under `/api/ambiental` and `/api/corporal`.
- **src/app/components** contains reusable React components (charts, tables, cards, navigation).
- **src/lib/db.js** and **src/lib/utils.js** form the data-access and utility layer.
- Configuration files (`next.config.mjs`, `.env.*`) indicate environment-driven DB connections or service endpoints.
- Static assets live in **public/**.

##### README Insights
- Confirms Next.js with App Router, server-side rendering (SSR) and serverless functions (API routes).
- Deployment target is Vercel (serverless).

## Diagram (Mermaid)

```mermaid
graph TD
    Browser["Browser (Client)"]:::external

    subgraph "Frontend Layer"
        direction TB
        PresLayer["Presentation Layer"]:::frontend

        subgraph "Pages"
            direction TB
            HP["Home Page: /"]:::frontend
            Layout["Global Layout"]:::frontend
            GlobalsCss["Global Styles"]:::frontend
            AmbientPage["Ambient Dashboard Page: /ambiental"]:::frontend
            CorporalPage["Corporal Dashboard Page: /corporal"]:::frontend
            DatosOverview["Datos Overview Page: /datos"]:::frontend
            DatosAmbiental["Datos Ambiental Page: /datos/ambiental"]:::frontend
            DatosCorporal["Datos Corporal Page: /datos/corporal"]:::frontend
            SensoresPage["Sensores Page: /sensores"]:::frontend
        end

        subgraph "UI Components"
            direction TB
            BarChart["Bar Chart Component"]:::frontend
            LineChart["Line Chart Component"]:::frontend
            KpiCard["KPI Card Component"]:::frontend
            Card["General Card Component"]:::frontend
            Tabla["Data Table Component"]:::frontend
            TablaBPM["BPM Table Component"]:::frontend
            TablaTempCorp["Body Temperature Table Component"]:::frontend
            BarraNav["Navigation Bar"]:::frontend
            OptImage["Optimized Image"]:::frontend
        end
    end

    Browser --> PresLayer
    PresLayer --> AmbientalAPI
    PresLayer --> CorporalAPI

    subgraph "Backend Layer"
        direction TB
        subgraph "API Layer"
            direction TB
            AmbientalAPI["Base Ambiental API"]:::api
            KitAmbiental["Ambiental Kit Data API"]:::api
            HumAPI["Humedad Readings API"]:::api
            TempAPI["Temperatura Readings API"]:::api
            KPIHumAPI["KPI Humedad API"]:::api
            KPITempAPI["KPI Temperatura API"]:::api
            CorporalAPI["Base Corporal API"]:::api
            KPIBPM["KPI BPM API"]:::api
            KPITempCor["KPI Temperatura Corporal API"]:::api
        end

        Utils["Shared Utilities (utils.js)"]:::util
        DB["Database Connection (db.js)"]:::db
    end

    AmbientalAPI --> Utils
    KitAmbiental --> Utils
    HumAPI --> Utils
    TempAPI --> Utils
    KPIHumAPI --> Utils
    KPITempAPI --> Utils
    CorporalAPI --> Utils
    KPIBPM --> Utils
    KPITempCor --> Utils
    Utils --> DB

    Browser --> Static
    Static["Static Assets (public/)"]:::static

    subgraph "Config & Environment"
        direction TB
        NextConfig["next.config.mjs"]:::static
        EnvLocal[".env.local"]:::static
        EnvProd[".env.production"]:::static
        ESLint["eslint.config.mjs"]:::static
        PostCSS["postcss.config.mjs"]:::static
    end

    click HP "https://github.com/marcellreynoso/tesis/blob/master/src/app/page.js"
    click Layout "https://github.com/marcellreynoso/tesis/blob/master/src/app/layout.js"
    click GlobalsCss "https://github.com/marcellreynoso/tesis/blob/master/src/app/globals.css"
    click AmbientPage "https://github.com/marcellreynoso/tesis/blob/master/src/app/ambiental/page.jsx"
    click CorporalPage "https://github.com/marcellreynoso/tesis/blob/master/src/app/corporal/page.jsx"
    click DatosOverview "https://github.com/marcellreynoso/tesis/blob/master/src/app/datos/page.jsx"
    click DatosAmbiental "https://github.com/marcellreynoso/tesis/blob/master/src/app/datos/ambiental/page.jsx"
    click DatosCorporal "https://github.com/marcellreynoso/tesis/blob/master/src/app/datos/corporal/page.jsx"
    click SensoresPage "https://github.com/marcellreynoso/tesis/blob/master/src/app/sensores/page.jsx"
    click BarChart "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/BarChart.jsx"
    click LineChart "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/LineChart.jsx"
    click KpiCard "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/KPI.jsx"
    click Card "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/Card.jsx"
    click Tabla "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/Tabla.jsx"
    click TablaBPM "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/TablaFrecuenciaCardiaca.jsx"
    click TablaTempCorp "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/TablaTemperaturaCorporal.jsx"
    click BarraNav "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/BarraNavegacion.jsx"
    click OptImage "https://github.com/marcellreynoso/tesis/blob/master/src/app/components/OptimizedImage.jsx"
    click AmbientalAPI "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/ambiental/route.js"
    click KitAmbiental "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/ambiental/[kitId]/route.js"
    click HumAPI "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/ambiental/humedad/route.js"
    click TempAPI "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/ambiental/temperatura/route.js"
    click KPIHumAPI "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/ambiental/kpis/humedad/route.js"
    click KPITempAPI "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/ambiental/kpis/temperatura/route.js"
    click CorporalAPI "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/corporal/route.js"
    click KPIBPM "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/corporal/kpis/bpm/route.js"
    click KPITempCor "https://github.com/marcellreynoso/tesis/blob/master/src/app/api/corporal/kpis/temperatura/route.js"
    click DB "https://github.com/marcellreynoso/tesis/blob/master/src/lib/db.js"
    click Utils "https://github.com/marcellreynoso/tesis/blob/master/src/lib/utils.js"
    click Static "https://github.com/marcellreynoso/tesis/tree/master/public/"
    click NextConfig "https://github.com/marcellreynoso/tesis/blob/master/next.config.mjs"
    click EnvLocal "https://github.com/marcellreynoso/tesis/blob/master/.env.local"
    click EnvProd "https://github.com/marcellreynoso/tesis/blob/master/.env.production"
    click ESLint "https://github.com/marcellreynoso/tesis/blob/master/eslint.config.mjs"
    click PostCSS "https://github.com/marcellreynoso/tesis/blob/master/postcss.config.mjs"

    classDef frontend fill:#cce5ff,stroke:#2b6cb0;
    classDef api fill:#c6f6d5,stroke:#2f855a;
    classDef db fill:#fbd38d,stroke:#dd6b20;
    classDef static fill:#e2e8f0,stroke:#4a5568;
    classDef util fill:#edf2f7,stroke:#a0aec0;
    classDef external fill:#ffffff,stroke:#718096;
```
