# code-wizard02/mezcal-tina-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/code-wizard02/mezcal-tina-monitor
- Repository: https://github.com/code-wizard02/mezcal-tina-monitor

## Overview

##### Project Type and Purpose
- This is a front-end Single Page Application (SPA) built with React, TypeScript and Vite.
- It uses Tailwind CSS for styling and shadcn-ui for prebuilt UI primitives.
- It displays live sensor readings (via a WebSocket), vat status, charts and mock data for development.

##### File Structure
- Top-level files: configuration for Vite (vite.config.ts), TypeScript (tsconfig.*.json), Tailwind (tailwind.config.ts), ESLint, package.json.
- public/: static assets (robots.txt, index.html).
- src/main.tsx: entry point that mounts React <App/>.
- src/App.tsx + App.css: the root application wrapper.
- src/components/…: React UI components organized into subfolders:
- ui/: design system primitives (buttons, modals, inputs, etc.)
- layout/: AppLayout, sidebar
- charts/: chart components (VatChart)
- sensors/: WebSocketStatus
- vats/: VatCard, VatStatusBadge
- src/pages/…: route‐based pages (Dashboard, Reports, SensorSetup, VatDetail, etc.)
- src/services/: business-logic modules (mockData.ts, websocket.ts)
- src/hooks/: reusable hooks (use‐toast, use‐mobile)
- src/types/: domain type definitions (sensor, vat, reading, user, etc.)
- src/lib/: utility functions

##### README
- Confirms stack: Vite, React, TypeScript, shadcn-ui, Tailwind CSS.
- Mentions live auto-deploy via Lovable.dev and ability to connect a custom domain.
- No backend code in this repo; data comes from a WebSocket endpoint (or mockData).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Local Development
    subgraph "Local Development"
        Developer[/"Developer Workstation\n(IDE, git)"/]:::external
        ViteDev["Vite Dev Server"]:::external
    end
    Developer -->|"git push / dev"| ViteDev
    click ViteDev "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/vite.config.ts"

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        Lovable["Lovable.dev\nCI/CD & Hosting"]:::external
    end
    Developer -->|"git push"| Lovable

    %% Hosting & Delivery
    subgraph "Hosting & Delivery"
        CDN["CDN / HTTP Server"]:::external
    end
    Lovable -->|"deploy static bundle"| CDN

    %% Client
    Browser["Browser\nReact SPA"]:::frontend
    CDN -->|"HTTPS"| Browser

    %% React Application Structure
    subgraph "React Application"
        direction TB
        EntryPoint["Entry Point\nsrc/main.tsx"]:::frontend
        AppWrapper["App Wrapper\nsrc/App.tsx"]:::frontend

        subgraph "UI Layer"
            UIPrimitives["UI Primitives\nsrc/components/ui/"]:::frontend
            LayoutComps["Layout Components\nsrc/components/layout/"]:::frontend
        end

        subgraph "Pages / Routes"
            Pages["Page/Route Modules\nsrc/pages/"]:::frontend
        end

        subgraph "State & Data Layer"
            WSService["WebSocket Service\nsrc/services/websocket.ts"]:::data
            MockData["Mock Data Service\nsrc/services/mockData.ts"]:::data
            Hooks["Custom Hooks\nsrc/hooks/"]:::data
            Types["Type Definitions\nsrc/types/"]:::data
            Utils["Utility Library\nsrc/lib/utils.ts"]:::data
        end

        subgraph "Components"
            VatChartComp["VatChart\nsrc/components/charts/VatChart.tsx"]:::frontend
            SensorStatusComp["WebSocketStatus\nsrc/components/sensors/WebSocketStatus.tsx"]:::frontend
            VatComps["Vat Components\nsrc/components/vats/"]:::frontend
        end

        EntryPoint --> AppWrapper
        AppWrapper --> UIPrimitives
        AppWrapper --> LayoutComps
        AppWrapper --> Pages
        AppWrapper --> VatChartComp
        AppWrapper --> SensorStatusComp
        AppWrapper --> VatComps

        Pages --> UIPrimitives
        VatChartComp --> WSService
        SensorStatusComp --> WSService
        VatComps --> WSService

        WSService -->|"WS"| ExternalWS
        MockData -->|"fakes data"| AppWrapper
        Hooks --> WSService
        Hooks --> MockData
        AppWrapper --> Types
        AppWrapper --> Utils
    end

    ExternalWS["WebSocket Service Endpoint"]:::external
    Browser -->|"WS"| ExternalWS

    %% Config Files & Static Assets
    subgraph "Configuration & Assets"
        ViteConf["vite.config.ts"]:::data
        TailwindConf["tailwind.config.ts"]:::data
        TSConfig["tsconfig.json\n(tsconfig.app.json,\ntsconfig.node.json)"]:::data
        PackageJSON["package.json"]:::data
        ESLintConf["eslint.config.js"]:::data
        PostCSSConf["postcss.config.js"]:::data
        PublicAssets["public/"]:::external
    end
    Lovable --> ViteConf
    Lovable --> TailwindConf
    Lovable --> TSConfig
    Lovable --> PackageJSON
    Lovable --> ESLintConf
    Lovable --> PostCSSConf
    Lovable --> PublicAssets
    Browser --> PublicAssets

    %% Click Events
    click EntryPoint "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/src/main.tsx"
    click AppWrapper "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/src/App.tsx"
    click UIPrimitives "https://github.com/code-wizard02/mezcal-tina-monitor/tree/main/src/components/ui/"
    click LayoutComps "https://github.com/code-wizard02/mezcal-tina-monitor/tree/main/src/components/layout/"
    click VatChartComp "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/src/components/charts/VatChart.tsx"
    click SensorStatusComp "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/src/components/sensors/WebSocketStatus.tsx"
    click VatComps "https://github.com/code-wizard02/mezcal-tina-monitor/tree/main/src/components/vats/"
    click Pages "https://github.com/code-wizard02/mezcal-tina-monitor/tree/main/src/pages/"
    click WSService "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/src/services/websocket.ts"
    click MockData "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/src/services/mockData.ts"
    click Hooks "https://github.com/code-wizard02/mezcal-tina-monitor/tree/main/src/hooks/"
    click Types "https://github.com/code-wizard02/mezcal-tina-monitor/tree/main/src/types/"
    click Utils "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/src/lib/utils.ts"
    click ViteConf "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/vite.config.ts"
    click TailwindConf "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/tailwind.config.ts"
    click TSConfig "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/tsconfig.json"
    click PackageJSON "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/package.json"
    click ESLintConf "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/eslint.config.js"
    click PostCSSConf "https://github.com/code-wizard02/mezcal-tina-monitor/blob/main/postcss.config.js"
    click PublicAssets "https://github.com/code-wizard02/mezcal-tina-monitor/tree/main/public/"

    %% Styles
    classDef frontend fill:#B3D4FC,stroke:#0366d6
    classDef data fill:#D4FCD4,stroke:#2d8f2d
    classDef external fill:#FCE5CD,stroke:#d2691e
```
