# apodwikat/attar-arabi-online-market-23 architecture

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

- Interactive diagram: https://gitdiagram.com/apodwikat/attar-arabi-online-market-23
- Repository: https://github.com/apodwikat/attar-arabi-online-market-23

## Overview

##### Project Type and Purpose
- From the file tree and README, this is a single-page e-commerce frontend application (“Attar Arabi Online Market”) built with React, TypeScript, Vite, Tailwind CSS, and shadcn-ui.
- It relies on Supabase for backend services (authentication, database).

##### File Structure
Top-level structure:
- public/ ­– Static assets (robots.txt, index.html template)
- src/
- pages/ – Route components (Index, Cart, Profile, OwnerDashboard, etc.)
- components/ – Reusable UI pieces and page sections
- components/ui/ – Shadcn-ui building blocks (buttons, dialogs, forms, etc.)
- hooks/ – Custom React hooks (auth, translation, mobile detection, toast management)
- providers/ – Context providers (AuthProvider)
- services/ – Business logic wrappers (auth.service.ts)
- integrations/supabase/ – Supabase client setup and type definitions
- lib/ – Utility functions
- locales/ – i18n strings
- types/ – Shared TypeScript type definitions
- main.tsx, App.tsx – App entry point and router setup

Config & build scripts:
- vite.config.ts, tsconfig*.json, tailwind.config.ts, eslint.config.js, package.json

##### README for Additional Insights
- Confirms tech stack (Vite, TypeScript, React, shadcn-ui, Tailwind CSS).
- Deployment via Lovable or any static host (e.g., Netlify).

a. Main Components
- User’s Browser (Client)
- React SPA (App Shell)
- UI Layer (Pages & Components)
- State/Logic Layer (Hooks & Context Providers)
- Service Layer (auth.service.ts)
- Data Layer (Supabase client & types)
- External Service (Supabase Auth & Database)

b. Relationships & Interactions
- Browser ⇄ React App (served by Vite dev server or static host)
- React App → UI Components → Pages
- Pages & Components use Hooks & Context Providers for state and side-effects
- Hooks/Services call Supabase client to authenticate users, fetch/store data
- Supabase responds with data which flows back up through Services → Hooks → UI

c. Architectural Patterns & Principles
- Layered architecture (Presentation → Domain → Data)
- Component-based UI (React + shadcn-ui)
- Context & Hooks for cross-cutting concerns (Auth, Toasts, i18n)
- Separation of concerns:
- UI vs. business logic (services) vs. data access (integrations)

d. Key Technologies & Frameworks
- React & React Router (pages & navigation)
- shadcn-ui & Tailwind CSS (design system)
- TypeScript (type safety across layers)
- Supabase (BaaS for Auth & Postgres database)
- Vite (build & dev server)

## Diagram (Mermaid)

```mermaid
graph TB
    Browser["User's Browser"]:::external
    AppShell["React App Shell"]:::default

    Browser -->|"loads"| AppShell

    subgraph "Entry Points"
        Main["main.tsx"]:::default
        App["App.tsx"]:::default
    end

    AppShell --> Main
    AppShell --> App

    subgraph "UI Layer"
        Pages["Pages (src/pages/)"]:::ui
        Components["Reusable Components (src/components/)"]:::ui
        UIblocks["shadcn-ui Blocks (src/components/ui/)"]:::ui
    end

    App --> Pages
    App --> Components
    App --> UIblocks

    subgraph "State & Logic Layer"
        Hooks["Custom Hooks (src/hooks/)"]:::logic
        AuthProv["AuthProvider (src/providers/AuthProvider.tsx)"]:::logic
    end

    Pages --> Hooks
    Components --> Hooks
    UIblocks --> Hooks
    Hooks --> AuthProv

    subgraph "Service Layer"
        AuthService["Auth Service (src/services/auth.service.ts)"]:::service
    end

    AuthProv --> AuthService
    Hooks --> AuthService

    subgraph "Data Layer"
        SupaClient["Supabase Client (src/integrations/supabase/client.ts)"]:::data
        SupaTypes["Supabase Types (src/integrations/supabase/types.ts)"]:::data
    end

    AuthService --> SupaClient
    AuthService --> SupaTypes

    subgraph "Utility & Others"
        Utils["Utils (src/lib/utils.ts)"]:::data
        Locales["Locales (src/locales/)"]:::data
        Types["Types (src/types/auth.types.ts)"]:::data
    end

    Pages --> Locales
    Hooks --> Locales
    Components --> Types

    SupaClient -->|"calls"| ExternalAuth
    SupaClient -->|"queries"| ExternalDB

    ExternalAuth["Supabase Auth"]:::external
    ExternalDB["Supabase Database"]:::external

    ExternalAuth --> SupaClient
    ExternalDB --> SupaClient

    click Main "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/main.tsx"
    click App "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/App.tsx"
    click Pages "https://github.com/apodwikat/attar-arabi-online-market-23/tree/main/src/pages/"
    click Components "https://github.com/apodwikat/attar-arabi-online-market-23/tree/main/src/components/"
    click UIblocks "https://github.com/apodwikat/attar-arabi-online-market-23/tree/main/src/components/ui/"
    click Hooks "https://github.com/apodwikat/attar-arabi-online-market-23/tree/main/src/hooks/"
    click AuthProv "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/providers/AuthProvider.tsx"
    click AuthService "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/services/auth.service.ts"
    click SupaClient "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/integrations/supabase/client.ts"
    click SupaTypes "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/integrations/supabase/types.ts"
    click Utils "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/lib/utils.ts"
    click Locales "https://github.com/apodwikat/attar-arabi-online-market-23/tree/main/src/locales/"
    click Types "https://github.com/apodwikat/attar-arabi-online-market-23/blob/main/src/types/auth.types.ts"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#000,stroke-width:1px
    classDef service fill:#FFA500,stroke:#000,stroke-width:1px
    classDef data fill:#DDA0DD,stroke:#000,stroke-width:1px
    classDef external fill:#FFC0CB,stroke:#000,stroke-width:1px
```
