# youssefali123/sari3_app architecture

> Architecture diagram of the GitHub repository youssefali123/sari3_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/youssefali123/sari3_app
- Repository: https://github.com/youssefali123/sari3_app

## Overview

This is an Expo/React Native food-ordering and delivery app with customer, authentication, and driver route groups. The main customer journey is area-based discovery and search, selecting products, then checking out with an address and coupon to create an order; customers can also revisit orders and favorites. Drivers manage availability, claim and progress deliveries, and view history. The graph uses the source index for documented imports and the sampled driver repository for its Supabase operations; unsampled driver-screen wiring is left unverified.

Main entry points: [`src/app/(customer)/(home)/index.tsx`](https://github.com/youssefali123/sari3_app/blob/main/src/app/(customer)/(home)/index.tsx) (Discovery home), [`src/app/(customer)/checkout/index.tsx`](https://github.com/youssefali123/sari3_app/blob/main/src/app/(customer)/checkout/index.tsx) (Checkout), [`src/shared/lib/supabase.ts`](https://github.com/youssefali123/sari3_app/blob/main/src/shared/lib/supabase.ts) (Supabase), [`src/features/orders/infrastructure/SupabaseOrderRepository.ts`](https://github.com/youssefali123/sari3_app/blob/main/src/features/orders/infrastructure/SupabaseOrderRepository.ts) (Customer orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer commerce"]
  node_customer["Customer routes"]
  node_home["Discovery home<br/>[index.tsx]"]
  node_search["Catalog search<br/>[useSearch.ts]"]
  node_stores["Stores and products"]
  node_areas["Delivery areas<br/>[useAreas.ts]"]
  node_cart["Cart state<br/>[cartSlice.ts]"]
  node_checkout["Checkout<br/>[index.tsx]"]
  node_addresses["Saved addresses"]
  node_promotions["Coupons and promotions"]
  node_orders["Customer orders"]
  node_favorites["Favorites"]
end

subgraph group_identity["Identity and profile"]
  node_auth["Authentication<br/>[useAuth.ts]"]
  node_profiles["User profiles"]
end

subgraph group_delivery["Driver fulfillment"]
  node_driver["Driver routes"]
  node_fulfillment["Driver fulfillment"]
  node_realtime["Delivery realtime"]
end

subgraph group_backend["Backend services"]
  node_notifications["Push notifications"]
  node_notifyfunction["Order status notifier<br/>[index.ts]"]
  node_supabase[("Supabase<br/>[supabase.ts]")]
end

subgraph group_platform["App foundation"]
  node_providers["App providers<br/>[AppProviders.tsx]"]
  node_query["Query client<br/>[queryClient.ts]"]
end

node_user(("App user"))
node_pushservice{{"Push service"}}

node_user -->|"browses"| node_home
node_home -->|"selects area"| node_areas
node_home -->|"searches catalog"| node_search
node_home -->|"loads stores"| node_stores
node_user -->|"checks out"| node_checkout
node_checkout -->|"loads addresses"| node_addresses
node_checkout -->|"applies coupon"| node_promotions
node_checkout -->|"creates order"| node_orders
node_checkout -->|"reads cart"| node_cart
node_home -->|"reorders"| node_orders
node_user -.->|"signs in"| node_auth
node_driver -.->|"manages deliveries"| node_fulfillment
node_fulfillment -->|"queries and updates"| node_supabase
node_search -->|"searches catalog"| node_supabase
node_orders -->|"reads and writes"| node_supabase
node_providers -->|"provides auth"| node_auth
node_providers -->|"configures queries"| node_query
node_notifications -->|"registers device"| node_supabase
node_notifyfunction -.->|"sends notification"| node_pushservice

click node_customer "https://github.com/youssefali123/sari3_app/tree/main/src/app/(customer)"
click node_home "https://github.com/youssefali123/sari3_app/blob/main/src/app/(customer)/(home)/index.tsx"
click node_search "https://github.com/youssefali123/sari3_app/blob/main/src/features/search/application/hooks/useSearch.ts"
click node_stores "https://github.com/youssefali123/sari3_app/blob/main/src/features/restaurants/infrastructure/SupabaseStoreRepository.ts"
click node_areas "https://github.com/youssefali123/sari3_app/blob/main/src/features/areas/application/hooks/useAreas.ts"
click node_cart "https://github.com/youssefali123/sari3_app/blob/main/src/features/cart/application/cartSlice.ts"
click node_checkout "https://github.com/youssefali123/sari3_app/blob/main/src/app/(customer)/checkout/index.tsx"
click node_addresses "https://github.com/youssefali123/sari3_app/blob/main/src/features/addresses/infrastructure/SupabaseAddressRepository.ts"
click node_promotions "https://github.com/youssefali123/sari3_app/blob/main/src/features/promotions/infrastructure/SupabaseCouponRepository.ts"
click node_orders "https://github.com/youssefali123/sari3_app/blob/main/src/features/orders/infrastructure/SupabaseOrderRepository.ts"
click node_favorites "https://github.com/youssefali123/sari3_app/blob/main/src/features/favorites/infrastructure/SupabaseFavoritesRepository.ts"
click node_auth "https://github.com/youssefali123/sari3_app/blob/main/src/features/auth/application/hooks/useAuth.ts"
click node_profiles "https://github.com/youssefali123/sari3_app/blob/main/src/features/profile/infrastructure/SupabaseProfileRepository.ts"
click node_driver "https://github.com/youssefali123/sari3_app/tree/main/src/app/(driver)"
click node_fulfillment "https://github.com/youssefali123/sari3_app/blob/main/src/features/drivers/infrastructure/SupabaseDriverFulfillmentRepository.ts"
click node_realtime "https://github.com/youssefali123/sari3_app/blob/main/src/features/drivers/infrastructure/SupabaseDriverRealtimeService.ts"
click node_notifications "https://github.com/youssefali123/sari3_app/blob/main/src/features/notifications/infrastructure/ExpoNotificationService.ts"
click node_notifyfunction "https://github.com/youssefali123/sari3_app/blob/main/supabase/functions/notify-order-status/index.ts"
click node_supabase "https://github.com/youssefali123/sari3_app/blob/main/src/shared/lib/supabase.ts"
click node_providers "https://github.com/youssefali123/sari3_app/blob/main/src/providers/AppProviders.tsx"
click node_query "https://github.com/youssefali123/sari3_app/blob/main/src/shared/lib/queryClient.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_customer,node_home,node_search,node_stores,node_areas,node_cart,node_checkout,node_addresses,node_promotions,node_orders,node_favorites,node_user toneBlue
class node_auth,node_profiles toneAmber
class node_driver,node_fulfillment,node_realtime toneMint
class node_notifications,node_notifyfunction,node_supabase toneRose
class node_providers,node_query,node_pushservice toneIndigo
```

## Components

### Customer commerce

- [Customer routes](https://github.com/youssefali123/sari3_app/tree/main/src/app/(customer)): `src/app/(customer)`
- [Discovery home](https://github.com/youssefali123/sari3_app/blob/main/src/app/(customer)/(home)/index.tsx): `src/app/(customer)/(home)/index.tsx`
- [Catalog search](https://github.com/youssefali123/sari3_app/blob/main/src/features/search/application/hooks/useSearch.ts): `src/features/search/application/hooks/useSearch.ts`
- [Stores and products](https://github.com/youssefali123/sari3_app/blob/main/src/features/restaurants/infrastructure/SupabaseStoreRepository.ts): `src/features/restaurants/infrastructure/SupabaseStoreRepository.ts`
- [Delivery areas](https://github.com/youssefali123/sari3_app/blob/main/src/features/areas/application/hooks/useAreas.ts): `src/features/areas/application/hooks/useAreas.ts`
- [Cart state](https://github.com/youssefali123/sari3_app/blob/main/src/features/cart/application/cartSlice.ts): `src/features/cart/application/cartSlice.ts`
- [Checkout](https://github.com/youssefali123/sari3_app/blob/main/src/app/(customer)/checkout/index.tsx): `src/app/(customer)/checkout/index.tsx`
- [Saved addresses](https://github.com/youssefali123/sari3_app/blob/main/src/features/addresses/infrastructure/SupabaseAddressRepository.ts): `src/features/addresses/infrastructure/SupabaseAddressRepository.ts`
- [Coupons and promotions](https://github.com/youssefali123/sari3_app/blob/main/src/features/promotions/infrastructure/SupabaseCouponRepository.ts): `src/features/promotions/infrastructure/SupabaseCouponRepository.ts`
- [Customer orders](https://github.com/youssefali123/sari3_app/blob/main/src/features/orders/infrastructure/SupabaseOrderRepository.ts): `src/features/orders/infrastructure/SupabaseOrderRepository.ts`
- [Favorites](https://github.com/youssefali123/sari3_app/blob/main/src/features/favorites/infrastructure/SupabaseFavoritesRepository.ts): `src/features/favorites/infrastructure/SupabaseFavoritesRepository.ts`

### Identity and profile

- [Authentication](https://github.com/youssefali123/sari3_app/blob/main/src/features/auth/application/hooks/useAuth.ts): `src/features/auth/application/hooks/useAuth.ts`
- [User profiles](https://github.com/youssefali123/sari3_app/blob/main/src/features/profile/infrastructure/SupabaseProfileRepository.ts): `src/features/profile/infrastructure/SupabaseProfileRepository.ts`

### Driver fulfillment

- [Driver routes](https://github.com/youssefali123/sari3_app/tree/main/src/app/(driver)): `src/app/(driver)`
- [Driver fulfillment](https://github.com/youssefali123/sari3_app/blob/main/src/features/drivers/infrastructure/SupabaseDriverFulfillmentRepository.ts): `src/features/drivers/infrastructure/SupabaseDriverFulfillmentRepository.ts`
- [Delivery realtime](https://github.com/youssefali123/sari3_app/blob/main/src/features/drivers/infrastructure/SupabaseDriverRealtimeService.ts): `src/features/drivers/infrastructure/SupabaseDriverRealtimeService.ts`

### Backend services

- [Push notifications](https://github.com/youssefali123/sari3_app/blob/main/src/features/notifications/infrastructure/ExpoNotificationService.ts): `src/features/notifications/infrastructure/ExpoNotificationService.ts`
- [Order status notifier](https://github.com/youssefali123/sari3_app/blob/main/supabase/functions/notify-order-status/index.ts): `supabase/functions/notify-order-status/index.ts`
- [Supabase](https://github.com/youssefali123/sari3_app/blob/main/src/shared/lib/supabase.ts): `src/shared/lib/supabase.ts`

### App foundation

- [App providers](https://github.com/youssefali123/sari3_app/blob/main/src/providers/AppProviders.tsx): `src/providers/AppProviders.tsx`
- [Query client](https://github.com/youssefali123/sari3_app/blob/main/src/shared/lib/queryClient.ts): `src/shared/lib/queryClient.ts`

### Other components

- **App user**
- **Push service**

## Connections

- App user → Discovery home: browses (evidence: `src/app/(customer)/(home)/index.tsx`)
- Discovery home → Delivery areas: selects area (evidence: `src/app/(customer)/(home)/index.tsx`)
- Discovery home → Catalog search: searches catalog (evidence: `src/app/(customer)/(home)/index.tsx`)
- Discovery home → Stores and products: loads stores (evidence: `src/app/(customer)/(home)/index.tsx`)
- App user → Checkout: checks out (evidence: `src/app/(customer)/checkout/index.tsx`)
- Checkout → Saved addresses: loads addresses (evidence: `src/app/(customer)/checkout/index.tsx`)
- Checkout → Coupons and promotions: applies coupon (evidence: `src/app/(customer)/checkout/index.tsx`)
- Checkout → Customer orders: creates order (evidence: `src/app/(customer)/checkout/index.tsx`)
- Checkout → Cart state: reads cart (evidence: `src/app/(customer)/checkout/index.tsx`)
- Discovery home → Customer orders: reorders (evidence: `src/app/(customer)/(home)/index.tsx`)
- App user → Authentication: signs in
- Driver routes → Driver fulfillment: manages deliveries
- Driver fulfillment → Supabase: queries and updates (evidence: `src/features/drivers/infrastructure/SupabaseDriverFulfillmentRepository.ts`)
- Catalog search → Supabase: searches catalog
- Customer orders → Supabase: reads and writes (evidence: `src/features/orders/infrastructure/SupabaseOrderRepository.ts`)
- App providers → Authentication: provides auth (evidence: `src/providers/AppProviders.tsx`)
- App providers → Query client: configures queries (evidence: `src/providers/AppProviders.tsx`)
- Push notifications → Supabase: registers device (evidence: `src/features/notifications/infrastructure/ExpoNotificationService.ts`)
- Order status notifier → Push service: sends notification
