# shuxrat4ik/wongeidwqiegzierw-pqle architecture

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

- Interactive diagram: https://gitdiagram.com/shuxrat4ik/wongeidwqiegzierw-pqle
- Repository: https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle

## Overview

This repository implements a digital-games marketplace: users browse and filter titles, manage a cart or wishlist, check out, and access owned games and downloads. It also includes account, admin catalog, and newsletter capabilities. The README provides no architecture detail; connections below are limited to relationships shown in sampled source or SOURCE INDEX references, so unsampled API behavior is represented cautiously.

Main entry points: [`lib/auth.tsx`](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/auth.tsx) (Account sessions), [`lib/supabase.ts`](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/supabase.ts) (Browser database client), [`lib/db.ts`](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/db.ts) (Catalog queries), [`app/page.tsx`](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/page.tsx) (Storefront)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront and discovery"]
  node_storefront["Storefront<br/>[page.tsx]"]
  node_pro_store["Pro catalog<br/>[page.tsx]"]
  node_game_detail["Game detail"]
  node_catalog_data["Catalog queries<br/>[db.ts]"]
  node_seed_catalog["Seed catalog<br/>[top-games.ts]"]
  node_game_card["Game cards<br/>[GameCard.tsx]"]
end

subgraph group_accounts["Accounts and collections"]
  node_auth_ui["Account sessions<br/>[auth.tsx]"]
  node_auth_page["Sign in and registration<br/>[page.tsx]"]
  node_library_page["Game library<br/>[page.tsx]"]
  node_wishlist_hook["Wishlist state<br/>[useWishlist.ts]"]
  node_collections["Seed collections"]
  node_supabase_browser["Browser database client<br/>[supabase.ts]"]
end

subgraph group_commerce["Commerce and delivery"]
  node_cart_hook["Cart state<br/>[useCart.ts]"]
  node_cart_page["Cart checkout entry<br/>[page.tsx]"]
  node_checkout["Checkout handler<br/>[route.ts]"]
  node_affiliate["Affiliate links<br/>[affiliate.ts]"]
  node_download_api["Download handler<br/>[route.ts]"]
  node_download_service["Signed downloads"]
  node_supabase_service["Service-role client<br/>[supabase-admin.ts]"]
end

subgraph group_operations["Catalog and engagement"]
  node_admin_games["Admin catalog API<br/>[route.ts]"]
  node_admin_access["Admin authorization<br/>[require-admin.ts]"]
  node_newsletter_engine["Newsletter engine"]
  node_newsletter_delivery["Newsletter delivery<br/>[sendNewsletter.ts]"]
end

node_shopper(("Shopper"))
node_supabase[("Supabase")]

node_shopper -->|"browses"| node_storefront
node_storefront -->|"fetches catalog"| node_catalog_data
node_storefront -->|"uses cart"| node_cart_hook
node_storefront -->|"uses wishlist"| node_wishlist_hook
node_pro_store -->|"fetches games"| node_catalog_data
node_pro_store -->|"filters fallback"| node_seed_catalog
node_game_detail -->|"reads collections"| node_collections
node_game_detail -->|"uses game data"| node_catalog_data
node_auth_page -->|"uses auth"| node_auth_ui
node_auth_ui -->|"reads session"| node_supabase_browser
node_cart_hook -->|"reads user"| node_auth_ui
node_cart_hook -->|"reads cart"| node_supabase_browser
node_cart_hook -->|"normalizes game rows"| node_catalog_data
node_cart_page -->|"uses auth"| node_auth_ui
node_cart_page -->|"uses database"| node_supabase_browser
node_cart_page -->|"uses game data"| node_catalog_data
node_shopper -->|"submits checkout"| node_checkout
node_checkout -->|"loads games"| node_supabase_service
node_checkout -->|"builds affiliate links"| node_affiliate
node_download_api -->|"creates client"| node_supabase_service
node_download_api -->|"requests signed download"| node_download_service
node_library_page -->|"uses auth"| node_auth_ui
node_library_page -->|"loads seed collections"| node_collections
node_wishlist_hook -->|"reads user"| node_auth_ui
node_wishlist_hook -->|"uses database"| node_supabase_browser
node_wishlist_hook -->|"uses seed collections"| node_collections
node_admin_games -->|"checks admin"| node_admin_access
node_admin_access -->|"uses service client"| node_supabase_service
node_newsletter_engine -->|"sends newsletter"| node_newsletter_delivery
node_supabase_browser -->|"connects"| node_supabase
node_supabase_service -->|"connects"| node_supabase

click node_storefront "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/page.tsx"
click node_pro_store "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/pro/page.tsx"
click node_game_detail "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/games/%5Bslug%5D/GameDetailClient.tsx"
click node_catalog_data "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/db.ts"
click node_seed_catalog "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/top-games.ts"
click node_game_card "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/components/GameCard.tsx"
click node_auth_ui "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/auth.tsx"
click node_auth_page "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/auth/page.tsx"
click node_cart_hook "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/hooks/useCart.ts"
click node_cart_page "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/cart/page.tsx"
click node_checkout "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/api/checkout/route.ts"
click node_affiliate "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/affiliate.ts"
click node_download_api "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/api/download/route.ts"
click node_download_service "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/server/download-service.ts"
click node_library_page "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/library/page.tsx"
click node_wishlist_hook "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/hooks/useWishlist.ts"
click node_collections "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/game-collections.ts"
click node_admin_games "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/api/admin/games/route.ts"
click node_admin_access "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/require-admin.ts"
click node_newsletter_engine "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/newsletterEngine.ts"
click node_newsletter_delivery "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/sendNewsletter.ts"
click node_supabase_browser "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/supabase.ts"
click node_supabase_service "https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/supabase-admin.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_storefront,node_pro_store,node_game_detail,node_catalog_data,node_seed_catalog,node_game_card toneBlue
class node_auth_ui,node_auth_page,node_library_page,node_wishlist_hook,node_collections,node_supabase_browser,node_supabase toneAmber
class node_cart_hook,node_cart_page,node_checkout,node_affiliate,node_download_api,node_download_service,node_supabase_service toneMint
class node_admin_games,node_admin_access,node_newsletter_engine,node_newsletter_delivery toneRose
class node_shopper toneIndigo
```

## Components

### Storefront and discovery

- [Storefront](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/page.tsx): `app/page.tsx`
- [Pro catalog](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/pro/page.tsx): `app/pro/page.tsx`
- [Game detail](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/games/%5Bslug%5D/GameDetailClient.tsx): `app/games/[slug]/GameDetailClient.tsx`
- [Catalog queries](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/db.ts): `lib/db.ts`
- [Seed catalog](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/top-games.ts): `lib/top-games.ts`
- [Game cards](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/components/GameCard.tsx): `components/GameCard.tsx`

### Accounts and collections

- [Account sessions](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/auth.tsx): `lib/auth.tsx`
- [Sign in and registration](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/auth/page.tsx): `app/auth/page.tsx`
- [Game library](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/library/page.tsx): `app/library/page.tsx`
- [Wishlist state](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/hooks/useWishlist.ts): `hooks/useWishlist.ts`
- [Seed collections](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/game-collections.ts): `lib/game-collections.ts`
- [Browser database client](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/supabase.ts): `lib/supabase.ts`

### Commerce and delivery

- [Cart state](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/hooks/useCart.ts): `hooks/useCart.ts`
- [Cart checkout entry](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/cart/page.tsx): `app/cart/page.tsx`
- [Checkout handler](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/api/checkout/route.ts): `app/api/checkout/route.ts`
- [Affiliate links](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/affiliate.ts): `lib/affiliate.ts`
- [Download handler](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/api/download/route.ts): `app/api/download/route.ts`
- [Signed downloads](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/server/download-service.ts): `lib/server/download-service.ts`
- [Service-role client](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/supabase-admin.ts): `lib/supabase-admin.ts`

### Catalog and engagement

- [Admin catalog API](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/app/api/admin/games/route.ts): `app/api/admin/games/route.ts`
- [Admin authorization](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/require-admin.ts): `lib/require-admin.ts`
- [Newsletter engine](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/newsletterEngine.ts): `lib/newsletterEngine.ts`
- [Newsletter delivery](https://github.com/shuxrat4ik/wongeidwqiegzierw-pqle/blob/main/lib/sendNewsletter.ts): `lib/sendNewsletter.ts`

### Other components

- **Shopper**
- **Supabase**

## Connections

- Shopper → Storefront: browses
- Storefront → Catalog queries: fetches catalog (evidence: `app/page.tsx`)
- Storefront → Cart state: uses cart (evidence: `app/page.tsx`)
- Storefront → Wishlist state: uses wishlist (evidence: `app/page.tsx`)
- Pro catalog → Catalog queries: fetches games (evidence: `app/pro/page.tsx`)
- Pro catalog → Seed catalog: filters fallback (evidence: `app/pro/page.tsx`)
- Game detail → Seed collections: reads collections (evidence: `app/games/[slug]/GameDetailClient.tsx`)
- Game detail → Catalog queries: uses game data (evidence: `app/games/[slug]/GameDetailClient.tsx`)
- Sign in and registration → Account sessions: uses auth (evidence: `app/auth/page.tsx`)
- Account sessions → Browser database client: reads session (evidence: `lib/auth.tsx`)
- Cart state → Account sessions: reads user (evidence: `hooks/useCart.ts`)
- Cart state → Browser database client: reads cart (evidence: `hooks/useCart.ts`)
- Cart state → Catalog queries: normalizes game rows (evidence: `hooks/useCart.ts`)
- Cart checkout entry → Account sessions: uses auth (evidence: `app/cart/page.tsx`)
- Cart checkout entry → Browser database client: uses database (evidence: `app/cart/page.tsx`)
- Cart checkout entry → Catalog queries: uses game data (evidence: `app/cart/page.tsx`)
- Shopper → Checkout handler: submits checkout
- Checkout handler → Service-role client: loads games (evidence: `app/api/checkout/route.ts`)
- Checkout handler → Affiliate links: builds affiliate links (evidence: `app/api/checkout/route.ts`)
- Download handler → Service-role client: creates client (evidence: `app/api/download/route.ts`)
- Download handler → Signed downloads: requests signed download (evidence: `app/api/download/route.ts`)
- Game library → Account sessions: uses auth (evidence: `app/library/page.tsx`)
- Game library → Seed collections: loads seed collections (evidence: `app/library/page.tsx`)
- Wishlist state → Account sessions: reads user (evidence: `hooks/useWishlist.ts`)
- Wishlist state → Browser database client: uses database (evidence: `hooks/useWishlist.ts`)
- Wishlist state → Seed collections: uses seed collections (evidence: `hooks/useWishlist.ts`)
- Admin catalog API → Admin authorization: checks admin (evidence: `app/api/admin/games/route.ts`)
- Admin authorization → Service-role client: uses service client (evidence: `lib/require-admin.ts`)
- Newsletter engine → Newsletter delivery: sends newsletter (evidence: `lib/newsletterEngine.ts`)
- Browser database client → Supabase: connects (evidence: `lib/supabase.ts`)
- Service-role client → Supabase: connects (evidence: `lib/supabase-admin.ts`)
