# waleednjlaty/waleed-zone-wab architecture

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

- Interactive diagram: https://gitdiagram.com/waleednjlaty/waleed-zone-wab
- Repository: https://github.com/waleednjlaty/waleed-zone-wab

## Overview

WALEED ZONE Web is an Arabic, right-to-left apps-and-games catalog backed by PostgreSQL and connected to a Telegram bot. Visitors browse or search listings, open details, and use a staged download flow; they can also register, log in, and save favorites. Owner-facing admin and aggregate analytics are distinct product branches, as are the documented advertising gates. The graph uses README and SOURCE INDEX relationships where available; several unsampled route and UI implementations are represented by their exact tree paths, without inferred internal call chains.

Main entry points: [`src/lib/db.ts`](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/db.ts) (PostgreSQL), [`src/lib/downloads/http.ts`](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/http.ts) (Download request handling), [`src/lib/queries.ts`](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/queries.ts) (Catalog queries), [`src/app/page.tsx`](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/page.tsx) (Catalog pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog experience"]
  node_catalog_ui["Catalog pages<br/>[page.tsx]"]
  node_catalog_views["Browse and details<br/>[page.tsx]"]
  node_catalog_landing["Catalog presentation<br/>[presentation.ts]"]
  node_search_api["Search endpoint<br/>[route.ts]"]
  node_queries["Catalog queries<br/>[queries.ts]"]
  node_search_service["Search ranking<br/>[service.ts]"]
  node_search_normalize["Query normalization<br/>[normalize.ts]"]
end

subgraph group_accounts["Accounts and metrics"]
  node_account_ui["Account pages<br/>[page.tsx]"]
  node_auth_routes["Authentication routes<br/>[route.ts]"]
  node_auth_service["Sessions and credentials<br/>[auth.ts]"]
  node_favorites_api["Saved favorites<br/>[route.ts]"]
  node_visit_api["Visitor registration<br/>[route.ts]"]
  node_stats_api["Owner statistics<br/>[route.ts]"]
end

subgraph group_downloads["Download delivery"]
  node_download_ui["Download experience"]
  node_download_routes["Download endpoints<br/>[route.ts]"]
  node_download_http["Download request handling<br/>[http.ts]"]
  node_download_service["Download orchestration<br/>[service.ts]"]
  node_download_rules["Download rules<br/>[rules.ts]"]
  node_download_network["Network safeguards<br/>[network.ts]"]
  node_browser_manager["Browser provider manager<br/>[manager.ts]"]
  node_browser_engine["Provider browser engine<br/>[engine.ts]"]
  node_provider_bzzhr["BZZHR provider<br/>[bzzhr.ts]"]
  node_provider_http["Public HTTP provider<br/>[public-http.ts]"]
  node_storage["Delivery storage<br/>[storage.ts]"]
end

subgraph group_operations["Owner operations"]
  node_admin_ui["Admin workspace<br/>[AdminDashboard.tsx]"]
  node_admin_api["Admin endpoints<br/>[route.ts]"]
  node_monetization["Ad consent and gates<br/>[consent.ts]"]
  node_ads_integration["Ad serving<br/>[ManualAd.tsx]"]
end

subgraph group_platform["Shared platform"]
  node_database[("PostgreSQL<br/>[db.ts]")]
  node_locale["Locale services<br/>[locale.ts]"]
  node_cover["Catalog imagery<br/>[CoverImage.tsx]"]
end

node_visitor(("Visitor"))
node_bot["Telegram bot"]
node_adsense["Google AdSense"]

node_visitor -->|"browses"| node_catalog_ui
node_visitor -->|"searches"| node_search_api
node_search_api -->|"requests listings"| node_queries
node_queries -->|"ranks candidates"| node_search_service
node_search_service -->|"normalizes query"| node_search_normalize
node_catalog_ui -->|"opens titles"| node_catalog_views
node_catalog_views -.->|"renders catalog data"| node_catalog_landing
node_queries -->|"reads listings"| node_database
node_catalog_views -.->|"shows artwork"| node_cover
node_visitor -->|"manages account"| node_account_ui
node_account_ui -.->|"submits credentials"| node_auth_routes
node_auth_routes -->|"authenticates"| node_auth_service
node_auth_service -->|"stores sessions"| node_database
node_visitor -->|"saves favorites"| node_favorites_api
node_favorites_api -->|"checks user"| node_auth_service
node_favorites_api -->|"reads catalog"| node_queries
node_visitor -->|"registers visit"| node_visit_api
node_visit_api -->|"records aggregate"| node_database
node_stats_api -->|"reads totals"| node_database
node_admin_ui -.->|"manages catalog"| node_admin_api
node_admin_ui -->|"views reports"| node_stats_api
node_admin_api -.->|"updates catalog"| node_database
node_monetization -->|"gates serving"| node_ads_integration
node_ads_integration -.->|"serves ads"| node_adsense
node_visitor -->|"requests download"| node_download_ui
node_download_ui -.->|"calls endpoints"| node_download_routes
node_download_routes -->|"dispatches request"| node_download_http
node_download_http -->|"orchestrates"| node_download_service
node_download_http -->|"validates request"| node_download_rules
node_download_http -->|"checks network"| node_download_network
node_download_service -->|"applies rules"| node_download_rules
node_download_service -->|"prepares delivery"| node_storage
node_browser_manager -->|"runs provider flow"| node_browser_engine
node_browser_engine -->|"resolves provider"| node_provider_bzzhr
node_browser_engine -->|"validates URLs"| node_provider_http
node_bot -->|"publishes applications"| node_database
node_catalog_ui -.->|"localizes interface"| node_locale

click node_catalog_ui "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/page.tsx"
click node_catalog_views "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/apps/%5Bslug%5D/page.tsx"
click node_catalog_landing "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/catalog/presentation.ts"
click node_search_api "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/search/route.ts"
click node_queries "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/queries.ts"
click node_search_service "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/search/service.ts"
click node_search_normalize "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/search/normalize.ts"
click node_account_ui "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/account/page.tsx"
click node_auth_routes "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/auth/login/route.ts"
click node_auth_service "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/auth.ts"
click node_favorites_api "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/favorites/route.ts"
click node_visit_api "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/visit/route.ts"
click node_stats_api "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/stats/route.ts"
click node_admin_ui "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/admin/AdminDashboard.tsx"
click node_admin_api "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/admin/catalog/route.ts"
click node_monetization "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/monetization/consent.ts"
click node_ads_integration "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/monetization/ManualAd.tsx"
click node_download_ui "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/download/DownloadExperience.tsx"
click node_download_routes "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/downloads/requests/route.ts"
click node_download_http "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/http.ts"
click node_download_service "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/service.ts"
click node_download_rules "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/rules.ts"
click node_download_network "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/network.ts"
click node_browser_manager "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/browser/manager.ts"
click node_browser_engine "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/browser/engine.ts"
click node_provider_bzzhr "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/providers/bzzhr.ts"
click node_provider_http "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/providers/public-http.ts"
click node_storage "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/storage.ts"
click node_database "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/db.ts"
click node_locale "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/locale.ts"
click node_cover "https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/CoverImage.tsx"

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_catalog_ui,node_catalog_views,node_catalog_landing,node_search_api,node_queries,node_search_service,node_search_normalize toneBlue
class node_account_ui,node_auth_routes,node_auth_service,node_favorites_api,node_visit_api,node_stats_api toneAmber
class node_download_ui,node_download_routes,node_download_http,node_download_service,node_download_rules,node_download_network,node_browser_manager,node_browser_engine,node_provider_bzzhr,node_provider_http,node_storage toneMint
class node_admin_ui,node_admin_api,node_monetization,node_ads_integration toneRose
class node_database,node_locale,node_cover,node_visitor,node_bot,node_adsense toneIndigo
```

## Components

### Catalog experience

- [Catalog pages](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Browse and details](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/apps/%5Bslug%5D/page.tsx): `src/app/apps/[slug]/page.tsx`
- [Catalog presentation](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/catalog/presentation.ts): `src/components/catalog/presentation.ts`
- [Search endpoint](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/search/route.ts): `src/app/api/search/route.ts`
- [Catalog queries](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/queries.ts): `src/lib/queries.ts`
- [Search ranking](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/search/service.ts): `src/lib/search/service.ts`
- [Query normalization](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/search/normalize.ts): `src/lib/search/normalize.ts`

### Accounts and metrics

- [Account pages](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/account/page.tsx): `src/app/account/page.tsx`
- [Authentication routes](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Sessions and credentials](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Saved favorites](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/favorites/route.ts): `src/app/api/favorites/route.ts`
- [Visitor registration](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/visit/route.ts): `src/app/api/visit/route.ts`
- [Owner statistics](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/stats/route.ts): `src/app/api/stats/route.ts`

### Download delivery

- [Download experience](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/download/DownloadExperience.tsx): `src/components/download/DownloadExperience.tsx`
- [Download endpoints](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/downloads/requests/route.ts): `src/app/api/downloads/requests/route.ts`
- [Download request handling](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/http.ts): `src/lib/downloads/http.ts`
- [Download orchestration](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/service.ts): `src/lib/downloads/service.ts`
- [Download rules](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/rules.ts): `src/lib/downloads/rules.ts`
- [Network safeguards](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/network.ts): `src/lib/downloads/network.ts`
- [Browser provider manager](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/browser/manager.ts): `src/lib/downloads/browser/manager.ts`
- [Provider browser engine](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/browser/engine.ts): `src/lib/downloads/browser/engine.ts`
- [BZZHR provider](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/providers/bzzhr.ts): `src/lib/downloads/providers/bzzhr.ts`
- [Public HTTP provider](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/providers/public-http.ts): `src/lib/downloads/providers/public-http.ts`
- [Delivery storage](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/downloads/storage.ts): `src/lib/downloads/storage.ts`

### Owner operations

- [Admin workspace](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/admin/AdminDashboard.tsx): `src/components/admin/AdminDashboard.tsx`
- [Admin endpoints](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/app/api/admin/catalog/route.ts): `src/app/api/admin/catalog/route.ts`
- [Ad consent and gates](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/monetization/consent.ts): `src/lib/monetization/consent.ts`
- [Ad serving](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/monetization/ManualAd.tsx): `src/components/monetization/ManualAd.tsx`

### Shared platform

- [PostgreSQL](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Locale services](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/lib/locale.ts): `src/lib/locale.ts`
- [Catalog imagery](https://github.com/waleednjlaty/waleed-zone-wab/blob/main/src/components/CoverImage.tsx): `src/components/CoverImage.tsx`

### Other components

- **Visitor**
- **Telegram bot**
- **Google AdSense**

## Connections

- Visitor → Catalog pages: browses (evidence: `README.md`)
- Visitor → Search endpoint: searches (evidence: `src/app/api/search/route.ts`)
- Search endpoint → Catalog queries: requests listings (evidence: `src/app/api/search/route.ts`)
- Catalog queries → Search ranking: ranks candidates (evidence: `src/lib/queries.ts`)
- Search ranking → Query normalization: normalizes query (evidence: `src/lib/search/service.ts`)
- Catalog pages → Browse and details: opens titles (evidence: `README.md`)
- Browse and details → Catalog presentation: renders catalog data
- Catalog queries → PostgreSQL: reads listings (evidence: `src/lib/queries.ts`)
- Browse and details → Catalog imagery: shows artwork
- Visitor → Account pages: manages account (evidence: `README.md`)
- Account pages → Authentication routes: submits credentials
- Authentication routes → Sessions and credentials: authenticates (evidence: `src/app/api/auth/login/route.ts`)
- Sessions and credentials → PostgreSQL: stores sessions (evidence: `src/lib/auth.ts`)
- Visitor → Saved favorites: saves favorites (evidence: `README.md`)
- Saved favorites → Sessions and credentials: checks user (evidence: `src/app/api/favorites/route.ts`)
- Saved favorites → Catalog queries: reads catalog (evidence: `src/app/api/favorites/route.ts`)
- Visitor → Visitor registration: registers visit (evidence: `src/app/api/visit/route.ts`)
- Visitor registration → PostgreSQL: records aggregate (evidence: `src/app/api/visit/route.ts`)
- Owner statistics → PostgreSQL: reads totals (evidence: `src/app/api/stats/route.ts`)
- Admin workspace → Admin endpoints: manages catalog
- Admin workspace → Owner statistics: views reports (evidence: `README.md`)
- Admin endpoints → PostgreSQL: updates catalog
- Ad consent and gates → Ad serving: gates serving (evidence: `README.md`)
- Ad serving → Google AdSense: serves ads (evidence: `README.md`)
- Visitor → Download experience: requests download (evidence: `README.md`)
- Download experience → Download endpoints: calls endpoints
- Download endpoints → Download request handling: dispatches request (evidence: `src/app/api/downloads/requests/route.ts`)
- Download request handling → Download orchestration: orchestrates (evidence: `src/lib/downloads/http.ts`)
- Download request handling → Download rules: validates request (evidence: `src/lib/downloads/http.ts`)
- Download request handling → Network safeguards: checks network (evidence: `src/lib/downloads/http.ts`)
- Download orchestration → Download rules: applies rules (evidence: `src/lib/downloads/service.ts`)
- Download orchestration → Delivery storage: prepares delivery (evidence: `src/lib/downloads/service.ts`)
- Browser provider manager → Provider browser engine: runs provider flow (evidence: `src/lib/downloads/browser/manager.ts`)
- Provider browser engine → BZZHR provider: resolves provider (evidence: `src/lib/downloads/browser/engine.ts`)
- Provider browser engine → Public HTTP provider: validates URLs (evidence: `src/lib/downloads/browser/engine.ts`)
- Telegram bot → PostgreSQL: publishes applications (evidence: `README.md`)
- Catalog pages → Locale services: localizes interface
