# rfypych/micro-mart-nexus architecture

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

- Interactive diagram: https://gitdiagram.com/rfypych/micro-mart-nexus
- Repository: https://github.com/rfypych/micro-mart-nexus

## Overview

##### Project type and purpose
- This is a frontend-focused Single Page Application built with React, TypeScript, Vite, Tailwind CSS, and the shadcn-ui component library.
- It integrates with Supabase for data storage, authentication, and possibly real-time features.

##### File structure
- Top-level config files: vite.config.ts, tsconfig.json, tailwind.config.ts, postcss.config.js, vercel.json.
- Public/static assets in `public/`.
- Source code in `src/`, subdivided into:
- `pages/` (route components under React Router or similar)
- `components/` (shared UI components and the shadcn-ui folder)
- `context/` (React Context providers: Cart & Admin)
- `data/` (in-memory product definitions)
- `integrations/supabase/` (Supabase client and type definitions)
- `hooks/` (custom hooks e.g., `use-mobile`, `use-toast`)
- `lib/utils.ts` (utility functions)
- Entry point: `src/main.tsx` + `src/App.tsx`

##### README
- Confirms stack: Vite, React, TS, Tailwind, shadcn-ui, Supabase.
- Deployment: Vercel or via Lovable platform.

##### Elements
- User → Browser → React App
- React App → Supabase client → Supabase services
- Supabase → React App (data events)
- Frontend (light blue)
- Backend (light green)
- CI/CD & Deployment (grey)
- CDN / Static (orange)

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef frontend fill:#E0F7FA,stroke:#0288D1,stroke-width:1px
    classDef backend fill:#E8F5E9,stroke:#2E7D32,stroke-width:1px
    classDef deployment fill:#CFD8DC,stroke:#455A64,stroke-width:1px
    classDef cdn fill:#FFF3E0,stroke:#FB8C00,stroke-width:1px
    classDef external fill:#FFFFFF,stroke:#000000,stroke-width:1px

    User["User"]:::external
    Browser["Browser (SPA)"]:::external

    subgraph "Development & Deployment"
        Build["Vite Dev Server / Build Pipeline"]:::deployment
        Tailwind["tailwind.config.ts"]:::deployment
        PostCSS["postcss.config.js"]:::deployment
        TSRoot["tsconfig.json"]:::deployment
        TSApp["tsconfig.app.json"]:::deployment
        TSNode["tsconfig.node.json"]:::deployment
        Vercel["vercel.json"]:::deployment
        SupaServiceConfig["supabase/config.toml"]:::deployment
    end

    StaticAssets["Static Assets (public/)"]:::cdn

    subgraph "Frontend"
        subgraph "Entry & App Shell"
            Main["src/main.tsx"]:::frontend
            AppShell["src/App.tsx"]:::frontend
        end
        subgraph "Routing & Pages"
            Router["src/pages/"]:::frontend
        end
        subgraph "UI & Layout Components"
            Layout["src/components/Layout.tsx"]:::frontend
            Navbar["src/components/Navbar.tsx"]:::frontend
            Footer["src/components/Footer.tsx"]:::frontend
            ProductCard["src/components/ProductCard.tsx"]:::frontend
            subgraph "shadcn-ui Library"
                Shadcn["src/components/ui/"]:::frontend
            end
        end
        subgraph "State & Logic"
            CartCtx["src/context/CartContext.tsx"]:::frontend
            AdminCtx["src/context/AdminContext.tsx"]:::frontend
            HooksMobile["src/hooks/use-mobile.tsx"]:::frontend
            HooksToast["src/hooks/use-toast.ts"]:::frontend
            Utils["src/lib/utils.ts"]:::frontend
            ProductsData["src/data/products.ts"]:::frontend
        end
        subgraph "API Layer"
            SupaClient["src/integrations/supabase/client.ts"]:::frontend
            SupaTypes["src/integrations/supabase/types.ts"]:::frontend
        end
    end

    subgraph "Supabase Services"
        Auth["Auth"]:::backend
        Database["Database"]:::backend
        Realtime["Realtime"]:::backend
    end

    User --> Browser
    Browser -->|"load from CDN"| Vercel
    Vercel -->|"serves assets"| StaticAssets
    StaticAssets --> Browser
    Build --> Vercel
    Tailwind --> Build
    PostCSS --> Build
    TSRoot --> Build
    TSApp --> Build
    TSNode --> Build
    SupaServiceConfig --> SupaClient
    SupaServiceConfig --> Auth
    SupaServiceConfig --> Database
    SupaServiceConfig --> Realtime

    Browser -->|"initializes"| Main
    Main -->|"renders"| AppShell
    AppShell -->|"routes to"| Router

    Router -->|"uses"| Layout
    Router -->|"uses"| Navbar
    Router -->|"uses"| Footer
    Router -->|"renders"| ProductCard
    Router -->|"imports UI"| Shadcn
    Router -->|"consumes state"| CartCtx
    Router -->|"consumes state"| AdminCtx
    Router -->|"calls hooks"| HooksMobile
    Router -->|"calls hooks"| HooksToast
    Router -->|"calls utils"| Utils
    Router -->|"reads data"| ProductsData
    Router -->|"calls API"| SupaClient

    SupaClient -->|"auth calls"| Auth
    SupaClient -->|"db queries"| Database
    SupaClient -->|"realtime"| Realtime
    Auth -->|"responses"| SupaClient
    Database -->|"responses"| SupaClient
    Realtime -->|"push events"| SupaClient

    class User,Browser external
    class Build,Tailwind,PostCSS,TSRoot,TSApp,TSNode,Vercel,SupaServiceConfig deployment
    class StaticAssets cdn
    class Main,AppShell,Router,Layout,Navbar,Footer,ProductCard,Shadcn,CartCtx,AdminCtx,HooksMobile,HooksToast,Utils,ProductsData,SupaClient,SupaTypes frontend
    class Auth,Database,Realtime backend

    click Build "https://github.com/rfypych/micro-mart-nexus/blob/main/vite.config.ts"
    click Tailwind "https://github.com/rfypych/micro-mart-nexus/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/rfypych/micro-mart-nexus/blob/main/postcss.config.js"
    click TSRoot "https://github.com/rfypych/micro-mart-nexus/blob/main/tsconfig.json"
    click TSApp "https://github.com/rfypych/micro-mart-nexus/blob/main/tsconfig.app.json"
    click TSNode "https://github.com/rfypych/micro-mart-nexus/blob/main/tsconfig.node.json"
    click Vercel "https://github.com/rfypych/micro-mart-nexus/blob/main/vercel.json"
    click SupaServiceConfig "https://github.com/rfypych/micro-mart-nexus/blob/main/supabase/config.toml"
    click Main "https://github.com/rfypych/micro-mart-nexus/blob/main/src/main.tsx"
    click AppShell "https://github.com/rfypych/micro-mart-nexus/blob/main/src/App.tsx"
    click Router "https://github.com/rfypych/micro-mart-nexus/tree/main/src/pages/"
    click Layout "https://github.com/rfypych/micro-mart-nexus/blob/main/src/components/Layout.tsx"
    click Navbar "https://github.com/rfypych/micro-mart-nexus/blob/main/src/components/Navbar.tsx"
    click Footer "https://github.com/rfypych/micro-mart-nexus/blob/main/src/components/Footer.tsx"
    click ProductCard "https://github.com/rfypych/micro-mart-nexus/blob/main/src/components/ProductCard.tsx"
    click Shadcn "https://github.com/rfypych/micro-mart-nexus/tree/main/src/components/ui/"
    click CartCtx "https://github.com/rfypych/micro-mart-nexus/blob/main/src/context/CartContext.tsx"
    click AdminCtx "https://github.com/rfypych/micro-mart-nexus/blob/main/src/context/AdminContext.tsx"
    click HooksMobile "https://github.com/rfypych/micro-mart-nexus/blob/main/src/hooks/use-mobile.tsx"
    click HooksToast "https://github.com/rfypych/micro-mart-nexus/blob/main/src/hooks/use-toast.ts"
    click Utils "https://github.com/rfypych/micro-mart-nexus/blob/main/src/lib/utils.ts"
    click ProductsData "https://github.com/rfypych/micro-mart-nexus/blob/main/src/data/products.ts"
    click SupaClient "https://github.com/rfypych/micro-mart-nexus/blob/main/src/integrations/supabase/client.ts"
    click SupaTypes "https://github.com/rfypych/micro-mart-nexus/blob/main/src/integrations/supabase/types.ts"
```
