# fantasma369to/pos-ventas-30-04-2025 architecture

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

- Interactive diagram: https://gitdiagram.com/fantasma369to/pos-ventas-30-04-2025
- Repository: https://github.com/fantasma369to/pos-ventas-30-04-2025

## Overview

##### Main high-level components
- Developer environment
– Vite dev server & build pipeline
– ESLint/Babel or SWC for Fast Refresh
- Frontend Application (React SPA)
– Atomic/Molecular/Organism/Template components
– Pages & Router (TanStack/React Router)
– State management (stores in `/src/store`)
– Context & hooks (`/src/context`, `/src/hooks`)
– Utilities & assets (`/src/utils`, `/src/assets`)
– Supabase client modules (`/src/supabase/*.jsx`)
- Cloud Services
– Firebase Hosting (serves built files)
– Supabase (Auth, Postgres DB, Realtime subscriptions, Storage)

##### Relationships & data‐flow
- Developer → (runs) Vite Dev Server → Browser (localhost)
- Developer → (runs) Vite build → (outputs) static files → Firebase Hosting → Browser (production)
- Browser (React SPA) ↔ Supabase SDK modules → Supabase Cloud
– Auth flows via `supabase.auth.*`
– CRUD operations via `supabase.from(...).select/insert/...`
– Realtime subscriptions via `useSupabaseSubscription` hook

##### Architectural patterns & design principles
- Atomic Design for UI components (atoms, molecules, organisms, templates)
- Separation of concerns:
– UI layer (components)
– Routing layer (`/src/routers`)
– State layer (`/src/store`)
– Data layer (`/src/supabase`)
– Utilities layer (`/src/utils`)
- Hooks & Context for cross-cutting concerns (auth, layout, protected routes)
- BaaS integration—no custom backend servers

##### Technologies/Frameworks to annotate
- React 18 + Vite
- @vitejs/plugin-react or plugin-react-swc
- Firebase CLI & `firebase.json` for hosting
- Supabase JS SDK & Postgres
- TanStack Router (React Router)
- Zustand-style or custom stores in `/src/store`
- ESLint, Babel/SWC

##### Don’t over-complicate—capture all layers
- Top-level directory (components, pages, store, supabase, routers) is represented
- How UI → State → Data → BaaS link together

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Tools Layer
    DevEnv["Developer Environment<br/>Vite Dev Server & Build"]:::dev
    click DevEnv "https://github.com/fantasma369to/pos-ventas-30-04-2025/blob/main/vite.config.js"

    %% Deployment Layer
    Firebase["Firebase Hosting (Cloud Service)"]:::cloud
    click Firebase "https://github.com/fantasma369to/pos-ventas-30-04-2025/blob/main/firebase.json"

    %% Browser Environments
    BrowserLocal["Browser (localhost)"]:::browser
    BrowserProd["Browser (production)"]:::browser

    %% Frontend Application
    subgraph "React SPA" 
        direction TB
        Entry["Entry Points<br/>index.html, src/main.jsx, src/index.js, src/App.jsx"]:::frontend
        click Entry "https://github.com/fantasma369to/pos-ventas-30-04-2025/blob/main/src/main.jsx"

        subgraph "UI Components (Atomic Design)" 
            direction TB
            Atomos["Atoms"]:::frontend
            click Atomos "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/components/atomos"
            Moleculas["Molecules"]:::frontend
            click Moleculas "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/components/moleculas"
            Organismos["Organisms"]:::frontend
            click Organismos "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/components/organismos"
            Templates["Templates"]:::frontend
            click Templates "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/components/templates"
            UI["UI"]:::frontend
            click UI "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/components/ui"
        end

        subgraph "Pages & Routing" 
            direction TB
            Pages["Pages"]:::frontend
            click Pages "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/pages"
            Routers["Routers"]:::frontend
            click Routers "https://github.com/fantasma369to/pos-ventas-30-04-2025/blob/main/src/routers/routes.jsx"
            Tanstack["TanStack Stacks"]:::frontend
            click Tanstack "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/tanstack"
        end

        subgraph "State & Data Layer"
            direction TB
            Store["State Stores"]:::state
            click Store "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/store"
            Context["Context"]:::state
            click Context "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/context"
            Hooks["Hooks"]:::state
            click Hooks "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/hooks"
            SupabaseCLI["Supabase Modules"]:::state
            click SupabaseCLI "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/supabase"
        end

        subgraph "Utilities & Assets"
            direction TB
            Utils["Utils"]:::state
            click Utils "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/utils"
            Assets["Assets"]:::state
            click Assets "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/assets"
            Public["Public"]:::state
            click Public "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/public"
        end

        subgraph "Styles & Theming"
            direction TB
            Styles["Styles/Themes"]:::state
            click Styles "https://github.com/fantasma369to/pos-ventas-30-04-2025/tree/main/src/styles"
        end
    end

    %% Cloud Backend
    subgraph "Supabase Cloud Services" 
        direction TB
        Auth["Auth"]:::cloud
        DB["Postgres DB"]:::cloud
        Realtime["Realtime"]:::cloud
    end

    %% Connections
    DevEnv -->|"runs"| BrowserLocal
    DevEnv -->|"builds→static files"| Firebase
    Firebase -->|"serves"| BrowserProd

    BrowserLocal -->|"loads SPA"| Entry
    BrowserProd -->|"loads SPA"| Entry

    Entry -->|"renders"| Atomos
    Atomos --> Moleculas --> Organismos --> Templates

    Entry -->|"routes through"| Routers --> Pages
    Pages --> Tanstack

    Entry -->|"uses state"| Store
    Store --> SupabaseCLI
    Entry -->|"uses context/hooks"| Context
    Entry --> Hooks

    Entry -->|"uses utils/assets"| Utils
    Entry --> Assets

    Entry -->|"applies styles"| Styles

    SupabaseCLI -->|"SDK calls"| Auth
    SupabaseCLI -->|"SDK calls"| DB
    SupabaseCLI -->|"subscriptions"| Realtime

    classDef dev fill:#f5a623,stroke:#e08e0b,color:#000;
    classDef frontend fill:#4fa3f7,stroke:#1d5bbf,color:#fff;
    classDef state fill:#7ed321,stroke:#5ba01c,color:#000;
    classDef cloud fill:#9b9b9b,stroke:#7a7a7a,color:#fff;
    classDef browser fill:#d0e6f9,stroke:#a0c4e8,color:#000
```
