# alighailes/sakan-dz architecture

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

- Interactive diagram: https://gitdiagram.com/alighailes/sakan-dz
- Repository: https://github.com/alighailes/sakan-dz

## Overview

Sakan DZ is an Algerian property marketplace for browsing, mapping, saving, and publishing listings, with account, messaging, and property-related services. The principal flow is routed through the app shell to discovery or listing pages, then through property APIs to Supabase; publishing additionally uses location and storage services. The tree and source index show further capabilities such as valuation, contracts, collaborative favorites, and push notifications, but their internal interactions are not fully evidenced. Edges below follow explicit routes, imports, and calls in the excerpts or source index.

Main entry points: [`src/App.tsx`](https://github.com/alighailes/sakan-dz/blob/main/src/App.tsx) (App router), [`src/pages/PublishPage.tsx`](https://github.com/alighailes/sakan-dz/blob/main/src/pages/PublishPage.tsx) (Publish listing), [`src/lib/supabase.ts`](https://github.com/alighailes/sakan-dz/blob/main/src/lib/supabase.ts) (Supabase platform), [`src/components/search/HeroSearch.tsx`](https://github.com/alighailes/sakan-dz/blob/main/src/components/search/HeroSearch.tsx) (Search controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and accounts"]
  node_app["App router<br/>[App.tsx]"]
  node_layout["Shared layout<br/>[Layout.tsx]"]
  node_authpage["Sign in and register<br/>[Auth.tsx]"]
  node_authstore["Authentication state<br/>[authStore.ts]"]
  node_guard["Protected routes<br/>[ProtectedRoute.tsx]"]
end

subgraph group_discovery["Property discovery"]
  node_home["Marketplace home<br/>[HomePage.tsx]"]
  node_search["Search controls<br/>[HeroSearch.tsx]"]
  node_locations["Algerian locations"]
  node_listings["Listing results<br/>[ListingsPage.tsx]"]
  node_filters["Listing filters<br/>[FilterBar.tsx]"]
  node_map["Map browsing<br/>[MapView.tsx]"]
  node_searchstate["Search state<br/>[searchStore.ts]"]
end

subgraph group_listing["Listing lifecycle"]
  node_publish["Publish listing<br/>[PublishPage.tsx]"]
  node_locationpicker["Listing location picker<br/>[LocationPicker.tsx]"]
end

subgraph group_engagement["User engagement"]
  node_savedsearch["Saved searches"]
  node_notifications["Notifications<br/>[notifications.ts]"]
  node_messaging["Messaging<br/>[MessagesPage.tsx]"]
end

subgraph group_backend["Data and services"]
  node_listingapi["Property API<br/>[api.ts]"]
  node_propertyhook["Property data hook<br/>[useProperties.ts]"]
  node_storage["Media storage<br/>[storage.ts]"]
  node_supabase[("Supabase platform<br/>[supabase.ts]")]
end

node_visitor(("Marketplace user"))

node_visitor -->|"opens"| node_app
node_app -->|"wraps routes"| node_layout
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_listings
node_app -->|"routes to"| node_authpage
node_app -->|"guards route"| node_publish
node_app -->|"routes to"| node_messaging
node_authpage -->|"authenticates through"| node_authstore
node_guard -->|"checks session"| node_authstore
node_authstore -->|"uses auth"| node_supabase
node_home -.->|"presents search"| node_search
node_search -->|"updates filters"| node_searchstate
node_search -->|"uses location data"| node_locations
node_listings -.->|"loads properties"| node_propertyhook
node_propertyhook -->|"fetches through"| node_listingapi
node_listings -.->|"offers filtering"| node_filters
node_app -->|"routes to"| node_map
node_publish -->|"submits listing"| node_listingapi
node_publish -->|"uploads media"| node_storage
node_publish -->|"selects location"| node_locationpicker
node_listingapi -->|"queries data"| node_supabase
node_storage -->|"uses storage"| node_supabase
node_app -->|"routes to"| node_savedsearch
node_savedsearch -.->|"subscribes to alerts"| node_notifications
node_notifications -->|"uses backend"| node_supabase

click node_app "https://github.com/alighailes/sakan-dz/blob/main/src/App.tsx"
click node_layout "https://github.com/alighailes/sakan-dz/blob/main/src/components/layout/Layout.tsx"
click node_authpage "https://github.com/alighailes/sakan-dz/blob/main/src/pages/Auth.tsx"
click node_authstore "https://github.com/alighailes/sakan-dz/blob/main/src/stores/authStore.ts"
click node_guard "https://github.com/alighailes/sakan-dz/blob/main/src/components/layout/ProtectedRoute.tsx"
click node_home "https://github.com/alighailes/sakan-dz/blob/main/src/pages/HomePage.tsx"
click node_search "https://github.com/alighailes/sakan-dz/blob/main/src/components/search/HeroSearch.tsx"
click node_locations "https://github.com/alighailes/sakan-dz/blob/main/src/data/algeria-locations.ts"
click node_listings "https://github.com/alighailes/sakan-dz/blob/main/src/pages/ListingsPage.tsx"
click node_filters "https://github.com/alighailes/sakan-dz/blob/main/src/components/listings/FilterBar.tsx"
click node_map "https://github.com/alighailes/sakan-dz/blob/main/src/components/map/MapView.tsx"
click node_searchstate "https://github.com/alighailes/sakan-dz/blob/main/src/stores/searchStore.ts"
click node_publish "https://github.com/alighailes/sakan-dz/blob/main/src/pages/PublishPage.tsx"
click node_locationpicker "https://github.com/alighailes/sakan-dz/blob/main/src/components/map/LocationPicker.tsx"
click node_listingapi "https://github.com/alighailes/sakan-dz/blob/main/src/services/api.ts"
click node_propertyhook "https://github.com/alighailes/sakan-dz/blob/main/src/hooks/useProperties.ts"
click node_storage "https://github.com/alighailes/sakan-dz/blob/main/src/services/storage.ts"
click node_savedsearch "https://github.com/alighailes/sakan-dz/blob/main/src/pages/SavedSearchesPage.tsx"
click node_notifications "https://github.com/alighailes/sakan-dz/blob/main/src/services/notifications.ts"
click node_messaging "https://github.com/alighailes/sakan-dz/blob/main/src/pages/MessagesPage.tsx"
click node_supabase "https://github.com/alighailes/sakan-dz/blob/main/src/lib/supabase.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_app,node_layout,node_authpage,node_authstore,node_guard,node_visitor toneBlue
class node_home,node_search,node_locations,node_listings,node_filters,node_map,node_searchstate toneAmber
class node_publish,node_locationpicker toneMint
class node_savedsearch,node_notifications,node_messaging toneRose
class node_listingapi,node_propertyhook,node_storage,node_supabase toneIndigo
```

## Components

### App and accounts

- [App router](https://github.com/alighailes/sakan-dz/blob/main/src/App.tsx): `src/App.tsx`
- [Shared layout](https://github.com/alighailes/sakan-dz/blob/main/src/components/layout/Layout.tsx): `src/components/layout/Layout.tsx`
- [Sign in and register](https://github.com/alighailes/sakan-dz/blob/main/src/pages/Auth.tsx): `src/pages/Auth.tsx`
- [Authentication state](https://github.com/alighailes/sakan-dz/blob/main/src/stores/authStore.ts): `src/stores/authStore.ts`
- [Protected routes](https://github.com/alighailes/sakan-dz/blob/main/src/components/layout/ProtectedRoute.tsx): `src/components/layout/ProtectedRoute.tsx`

### Property discovery

- [Marketplace home](https://github.com/alighailes/sakan-dz/blob/main/src/pages/HomePage.tsx): `src/pages/HomePage.tsx`
- [Search controls](https://github.com/alighailes/sakan-dz/blob/main/src/components/search/HeroSearch.tsx): `src/components/search/HeroSearch.tsx`
- [Algerian locations](https://github.com/alighailes/sakan-dz/blob/main/src/data/algeria-locations.ts): `src/data/algeria-locations.ts`
- [Listing results](https://github.com/alighailes/sakan-dz/blob/main/src/pages/ListingsPage.tsx): `src/pages/ListingsPage.tsx`
- [Listing filters](https://github.com/alighailes/sakan-dz/blob/main/src/components/listings/FilterBar.tsx): `src/components/listings/FilterBar.tsx`
- [Map browsing](https://github.com/alighailes/sakan-dz/blob/main/src/components/map/MapView.tsx): `src/components/map/MapView.tsx`
- [Search state](https://github.com/alighailes/sakan-dz/blob/main/src/stores/searchStore.ts): `src/stores/searchStore.ts`

### Listing lifecycle

- [Publish listing](https://github.com/alighailes/sakan-dz/blob/main/src/pages/PublishPage.tsx): `src/pages/PublishPage.tsx`
- [Listing location picker](https://github.com/alighailes/sakan-dz/blob/main/src/components/map/LocationPicker.tsx): `src/components/map/LocationPicker.tsx`

### User engagement

- [Saved searches](https://github.com/alighailes/sakan-dz/blob/main/src/pages/SavedSearchesPage.tsx): `src/pages/SavedSearchesPage.tsx`
- [Notifications](https://github.com/alighailes/sakan-dz/blob/main/src/services/notifications.ts): `src/services/notifications.ts`
- [Messaging](https://github.com/alighailes/sakan-dz/blob/main/src/pages/MessagesPage.tsx): `src/pages/MessagesPage.tsx`

### Data and services

- [Property API](https://github.com/alighailes/sakan-dz/blob/main/src/services/api.ts): `src/services/api.ts`
- [Property data hook](https://github.com/alighailes/sakan-dz/blob/main/src/hooks/useProperties.ts): `src/hooks/useProperties.ts`
- [Media storage](https://github.com/alighailes/sakan-dz/blob/main/src/services/storage.ts): `src/services/storage.ts`
- [Supabase platform](https://github.com/alighailes/sakan-dz/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Marketplace user**

## Connections

- Marketplace user → App router: opens (evidence: `src/App.tsx`)
- App router → Shared layout: wraps routes (evidence: `src/App.tsx`)
- App router → Marketplace home: routes to (evidence: `src/App.tsx`)
- App router → Listing results: routes to (evidence: `src/App.tsx`)
- App router → Sign in and register: routes to (evidence: `src/App.tsx`)
- App router → Publish listing: guards route (evidence: `src/App.tsx`)
- App router → Messaging: routes to (evidence: `src/App.tsx`)
- Sign in and register → Authentication state: authenticates through (evidence: `src/pages/Auth.tsx`)
- Protected routes → Authentication state: checks session (evidence: `src/components/layout/ProtectedRoute.tsx`)
- Authentication state → Supabase platform: uses auth (evidence: `src/stores/authStore.ts`)
- Marketplace home → Search controls: presents search
- Search controls → Search state: updates filters (evidence: `src/components/search/HeroSearch.tsx`)
- Search controls → Algerian locations: uses location data (evidence: `src/components/search/HeroSearch.tsx`)
- Listing results → Property data hook: loads properties
- Property data hook → Property API: fetches through (evidence: `src/hooks/useProperties.ts`)
- Listing results → Listing filters: offers filtering
- App router → Map browsing: routes to (evidence: `src/App.tsx`)
- Publish listing → Property API: submits listing (evidence: `src/pages/PublishPage.tsx`)
- Publish listing → Media storage: uploads media (evidence: `src/pages/PublishPage.tsx`)
- Publish listing → Listing location picker: selects location (evidence: `src/pages/PublishPage.tsx`)
- Property API → Supabase platform: queries data (evidence: `src/services/api.ts`)
- Media storage → Supabase platform: uses storage (evidence: `src/services/storage.ts`)
- App router → Saved searches: routes to (evidence: `src/App.tsx`)
- Saved searches → Notifications: subscribes to alerts
- Notifications → Supabase platform: uses backend (evidence: `src/services/notifications.ts`)
