How apodwikat/attar-arabi-online-market-23 works
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)