# thiagommeneses/waba-control-panel-pro architecture

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

- Interactive diagram: https://gitdiagram.com/thiagommeneses/waba-control-panel-pro
- Repository: https://github.com/thiagommeneses/waba-control-panel-pro

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with React and TypeScript, styled with Tailwind CSS and the shadcn-ui component library.
- It uses Vite as its build tool and development server.
- Data storage and authentication are handled by Supabase, integrated via a client library in the frontend.
- Its primary purpose is to let users create, preview, send, and view logs of message templates.

##### File structure
- Top-level files:
- package.json / bun.lockb / lockfiles: dependency definitions
- vite.config.ts, tsconfig*.json, tailwind.config.ts, postcss.config.js: build & tool configurations
- public/: static assets (robots.txt) + index.html
- src/: main application code
- main.tsx + index.css: app entry point + global styles
- components/: UI components, organized into feature subfolders (templates, ui primitives)
- pages/: route-level components (Dashboard, Index, NotFound)
- hooks/: custom React hooks (data fetching, form state, toast notifications, mobile detection)
- integrations/supabase/: Supabase client setup and types
- lib/: shared utilities
- types/: domain types (template.ts)
- supabase/config.toml: Supabase CLI configuration for local emulation

##### README for additional insights
- Stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS
- Deployment: static site published via Lovable (likely pushes built assets to a CDN)
- Editing: supports live commits via a low-code platform (Lovable) or standard Git workflow

##### Elements
- HTTP(S) requests from Client → CDN → JS/CSS assets → Client
- API calls from React hooks → Supabase → React
- Git pushes → Lovable platform → Vite build → CDN
- Frontend code (e.g., blue rectangles)
- CI/CD pipeline (e.g., grey parallelogram for Git, orange for build tool)

##### Detail without over-splitting
- Similar UI components into one “UI Component Library” cluster.
- “Feature Components” (CreateTemplate, SendTemplate, etc.) as a sub-cluster.
- “Primitive UI” (shadcn-ui) as the foundation layer.
- In the deployment pipeline, illustrate both “Dev” and “Prod” lanes if helpful.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer and CI/CD
    subgraph "Developer Environment"
        DevMachine["Developer Machine"]:::external
        DevMachine -->|push code| Git["Git Repository"]:::ci
        Git -->|triggers| Lovable["Lovable CI/CD"]:::ci
        Lovable -->|build with Vite| Build["Vite Build Server"]:::ci
        Build -->|deploy| CDN["CDN"]:::external
    end

    DevMachine -->|run dev| ViteDev["Vite Dev Server"]:::ci
    ViteDev -->|serves| Browser["Browser"]:::frontend
    ViteDev -->|connects to| SupabaseEmu["Supabase Emulator"]:::backend

    %% Production Flow
    subgraph "Production Flow"
        Browser -->|request| CDN
        CDN -->|serve| StaticAssets["Static Assets"]:::frontend
        Browser -->|loads| ReactApp["React SPA"]:::frontend
    end

    StaticAssets -->|includes| HTML["HTML Template"]:::frontend
    StaticAssets -->|includes| JSBundle["JS Bundle (main.tsx)"]:::frontend
    StaticAssets -->|includes| CSS["Global Styles"]:::frontend

    %% React App Architecture
    subgraph "React Application"
        ReactApp --> Pages
        ReactApp --> UILayer
        ReactApp --> HooksLayer

        subgraph "Pages"
            IndexPage["Home Page"]:::frontend
            DashboardPage["Dashboard Page"]:::frontend
            NotFoundPage["404 Page"]:::frontend
        end

        subgraph "UI Layer"
            PrimitiveUI["Primitive UI Library"]:::frontend
            FeatureComponents["Feature Components"]:::frontend
            PrimitiveUI --> FeatureComponents
        end

        subgraph "Hooks Layer"
            Hooks["Custom React Hooks"]:::frontend
            Hooks -->|calls| SupClient["Supabase Client"]:::backend
        end
    end

    %% Supabase Services
    SupClient --> SupabaseAuth["Supabase Auth"]:::backend
    SupClient --> SupabaseDB["Supabase Database"]:::backend
    SupClient --> SupabaseLogs["Supabase Logging"]:::backend

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#98FB98,stroke:#333,stroke-width:1px
    classDef ci fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px

    %% Click Events
    click ReactApp "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/main.tsx"
    click HTML "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/public/index.html"
    click CSS "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/index.css"
    click CSS "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/App.css"
    click ViteDev "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/vite.config.ts"
    click IndexPage "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/pages/Index.tsx"
    click DashboardPage "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/pages/Dashboard.tsx"
    click NotFoundPage "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/pages/NotFound.tsx"
    click PrimitiveUI "https://github.com/thiagommeneses/waba-control-panel-pro/tree/main/src/components/ui/"
    click Hooks "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/hooks/templates/useTemplateForm.ts"
    click SupClient "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/src/integrations/supabase/client.ts"
    click SupabaseEmu "https://github.com/thiagommeneses/waba-control-panel-pro/blob/main/supabase/config.toml"
```
