# axyratio/closetx architecture

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

- Interactive diagram: https://gitdiagram.com/axyratio/closetx
- Repository: https://github.com/axyratio/closetx

## Overview

ClosetX is a multi-vendor fashion marketplace mobile app with AI virtual try-on. The buyer journey runs from product discovery through cart, checkout, payment, order tracking, and reviews; seller and admin capabilities form separate operational branches. The map combines the documented product scope with the supplied source excerpts and tree. Several subsystems are represented at directory or router level because their implementation was not sampled, so uncertain internal calls are omitted.

Main entry points: [`client/app`](https://github.com/axyratio/closetx/tree/main/client/app) (ClosetX app), [`server/app/main.py`](https://github.com/axyratio/closetx/blob/main/server/app/main.py) (FastAPI application), [`client/api`](https://github.com/axyratio/closetx/tree/main/client/api) (API clients), [`server/app/db/database.py`](https://github.com/axyratio/closetx/blob/main/server/app/db/database.py) (PostgreSQL data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile app"]
  node_mobile["ClosetX app"]
  node_discovery["Browse and search"]
  node_cartui["Cart and checkout"]
  node_profileui["Orders and reviews"]
  node_sellerui["Seller workspace"]
  node_adminui["Admin workspace"]
  node_tryonui["Try-on screen<br/>[vton.tsx]"]
  node_clientapi["API clients"]
end

subgraph group_market["Marketplace"]
  node_marketapi["Catalog and marketplace APIs"]
  node_search["Product search<br/>[search_service.py]"]
  node_reviews["Review management<br/>[review_router.py]"]
end

subgraph group_commerce["Commerce operations"]
  node_commerceapi["Cart and order APIs"]
  node_checkout["Checkout logic"]
  node_payment["Stripe payment events<br/>[stripe_webhook.py]"]
  node_tasks["Order background tasks<br/>[order_tasks.py]"]
  node_stripe["Stripe"]
end

subgraph group_tryon["Virtual try-on"]
  node_vton["Try-on service<br/>[vton_service.py]"]
  node_model["IDM-VTON service"]
end

subgraph group_platform["Backend platform"]
  node_server["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth_router.py]"]
  node_authservice["Auth logic<br/>[auth_service.py]"]
  node_realtime["Realtime connections<br/>[socket_manager.py]"]
  node_database[("PostgreSQL data<br/>[database.py]")]
end

node_buyer(("Buyer"))
node_seller(("Seller"))
node_admin(("Admin"))

node_buyer -->|"uses"| node_mobile
node_seller -->|"uses"| node_mobile
node_admin -->|"uses"| node_mobile
node_mobile -->|"opens"| node_discovery
node_mobile -->|"opens"| node_cartui
node_mobile -->|"opens"| node_profileui
node_mobile -->|"opens"| node_sellerui
node_mobile -->|"opens"| node_adminui
node_mobile -->|"opens"| node_tryonui
node_discovery -->|"requests catalog"| node_clientapi
node_cartui -->|"requests cart and checkout"| node_clientapi
node_profileui -->|"requests orders and reviews"| node_clientapi
node_sellerui -->|"requests seller functions"| node_clientapi
node_adminui -->|"requests administration"| node_clientapi
node_tryonui -->|"requests try-on"| node_clientapi
node_clientapi -->|"calls API"| node_server
node_server -->|"mounts"| node_auth
node_server -->|"mounts"| node_marketapi
node_server -->|"mounts"| node_commerceapi
node_server -->|"mounts"| node_reviews
node_server -->|"mounts"| node_authservice
node_auth -->|"calls"| node_authservice
node_authservice -->|"reads and writes"| node_database
node_marketapi -->|"searches products"| node_search
node_search -->|"queries catalog"| node_database
node_reviews -->|"reads and writes"| node_database
node_commerceapi -->|"handles checkout"| node_checkout
node_checkout -->|"reads and writes"| node_database
node_checkout -->|"creates payment"| node_stripe
node_stripe -->|"sends webhook"| node_payment
node_payment -->|"updates payment and orders"| node_database
node_tasks -->|"updates order state"| node_database
node_tasks -->|"checks payment"| node_stripe
node_server -->|"mounts try-on routes"| node_vton
node_vton -.->|"submits prepared images"| node_model
node_server -->|"serves WebSockets"| node_realtime
node_realtime -->|"broadcasts updates"| node_buyer
node_realtime -->|"broadcasts updates"| node_seller

click node_mobile "https://github.com/axyratio/closetx/tree/main/client/app"
click node_discovery "https://github.com/axyratio/closetx/tree/main/client/app/(home)"
click node_cartui "https://github.com/axyratio/closetx/tree/main/client/app/(cart)"
click node_profileui "https://github.com/axyratio/closetx/tree/main/client/app/(profile)"
click node_sellerui "https://github.com/axyratio/closetx/tree/main/client/app/(seller)"
click node_adminui "https://github.com/axyratio/closetx/tree/main/client/app/(admin)"
click node_tryonui "https://github.com/axyratio/closetx/blob/main/client/app/(tabs)/vton.tsx"
click node_clientapi "https://github.com/axyratio/closetx/tree/main/client/api"
click node_server "https://github.com/axyratio/closetx/blob/main/server/app/main.py"
click node_auth "https://github.com/axyratio/closetx/blob/main/server/app/routes/auth_router.py"
click node_authservice "https://github.com/axyratio/closetx/blob/main/server/app/services/auth_service.py"
click node_marketapi "https://github.com/axyratio/closetx/tree/main/server/app/routes"
click node_search "https://github.com/axyratio/closetx/blob/main/server/app/services/search_service.py"
click node_reviews "https://github.com/axyratio/closetx/blob/main/server/app/routes/review_router.py"
click node_commerceapi "https://github.com/axyratio/closetx/tree/main/server/app/routes"
click node_checkout "https://github.com/axyratio/closetx/blob/main/server/app/services/checkout_service.py"
click node_payment "https://github.com/axyratio/closetx/blob/main/server/app/api/stripe_webhook.py"
click node_tasks "https://github.com/axyratio/closetx/blob/main/server/app/tasks/order_tasks.py"
click node_vton "https://github.com/axyratio/closetx/blob/main/server/app/services/vton_service.py"
click node_realtime "https://github.com/axyratio/closetx/blob/main/server/app/realtime/socket_manager.py"
click node_database "https://github.com/axyratio/closetx/blob/main/server/app/db/database.py"

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_mobile,node_discovery,node_cartui,node_profileui,node_sellerui,node_adminui,node_tryonui,node_clientapi toneBlue
class node_marketapi,node_search,node_reviews toneAmber
class node_commerceapi,node_checkout,node_payment,node_tasks,node_stripe toneMint
class node_vton,node_model toneRose
class node_server,node_auth,node_authservice,node_realtime,node_database,node_buyer,node_seller,node_admin toneIndigo
```

## Components

### Mobile app

- [ClosetX app](https://github.com/axyratio/closetx/tree/main/client/app): `client/app`
- [Browse and search](https://github.com/axyratio/closetx/tree/main/client/app/(home)): `client/app/(home)`
- [Cart and checkout](https://github.com/axyratio/closetx/tree/main/client/app/(cart)): `client/app/(cart)`
- [Orders and reviews](https://github.com/axyratio/closetx/tree/main/client/app/(profile)): `client/app/(profile)`
- [Seller workspace](https://github.com/axyratio/closetx/tree/main/client/app/(seller)): `client/app/(seller)`
- [Admin workspace](https://github.com/axyratio/closetx/tree/main/client/app/(admin)): `client/app/(admin)`
- [Try-on screen](https://github.com/axyratio/closetx/blob/main/client/app/(tabs)/vton.tsx): `client/app/(tabs)/vton.tsx`
- [API clients](https://github.com/axyratio/closetx/tree/main/client/api): `client/api`

### Marketplace

- [Catalog and marketplace APIs](https://github.com/axyratio/closetx/tree/main/server/app/routes): `server/app/routes`
- [Product search](https://github.com/axyratio/closetx/blob/main/server/app/services/search_service.py): `server/app/services/search_service.py`
- [Review management](https://github.com/axyratio/closetx/blob/main/server/app/routes/review_router.py): `server/app/routes/review_router.py`

### Commerce operations

- [Cart and order APIs](https://github.com/axyratio/closetx/tree/main/server/app/routes): `server/app/routes`
- [Checkout logic](https://github.com/axyratio/closetx/blob/main/server/app/services/checkout_service.py): `server/app/services/checkout_service.py`
- [Stripe payment events](https://github.com/axyratio/closetx/blob/main/server/app/api/stripe_webhook.py): `server/app/api/stripe_webhook.py`
- [Order background tasks](https://github.com/axyratio/closetx/blob/main/server/app/tasks/order_tasks.py): `server/app/tasks/order_tasks.py`
- **Stripe**

### Virtual try-on

- [Try-on service](https://github.com/axyratio/closetx/blob/main/server/app/services/vton_service.py): `server/app/services/vton_service.py`
- **IDM-VTON service**

### Backend platform

- [FastAPI application](https://github.com/axyratio/closetx/blob/main/server/app/main.py): `server/app/main.py`
- [Authentication](https://github.com/axyratio/closetx/blob/main/server/app/routes/auth_router.py): `server/app/routes/auth_router.py`
- [Auth logic](https://github.com/axyratio/closetx/blob/main/server/app/services/auth_service.py): `server/app/services/auth_service.py`
- [Realtime connections](https://github.com/axyratio/closetx/blob/main/server/app/realtime/socket_manager.py): `server/app/realtime/socket_manager.py`
- [PostgreSQL data](https://github.com/axyratio/closetx/blob/main/server/app/db/database.py): `server/app/db/database.py`

### Other components

- **Buyer**
- **Seller**
- **Admin**

## Connections

- Buyer → ClosetX app: uses
- Seller → ClosetX app: uses
- Admin → ClosetX app: uses
- ClosetX app → Browse and search: opens
- ClosetX app → Cart and checkout: opens
- ClosetX app → Orders and reviews: opens
- ClosetX app → Seller workspace: opens
- ClosetX app → Admin workspace: opens
- ClosetX app → Try-on screen: opens
- Browse and search → API clients: requests catalog
- Cart and checkout → API clients: requests cart and checkout
- Orders and reviews → API clients: requests orders and reviews
- Seller workspace → API clients: requests seller functions
- Admin workspace → API clients: requests administration
- Try-on screen → API clients: requests try-on
- API clients → FastAPI application: calls API
- FastAPI application → Authentication: mounts
- FastAPI application → Catalog and marketplace APIs: mounts
- FastAPI application → Cart and order APIs: mounts
- FastAPI application → Review management: mounts
- FastAPI application → Auth logic: mounts
- Authentication → Auth logic: calls
- Auth logic → PostgreSQL data: reads and writes
- Catalog and marketplace APIs → Product search: searches products
- Product search → PostgreSQL data: queries catalog
- Review management → PostgreSQL data: reads and writes
- Cart and order APIs → Checkout logic: handles checkout
- Checkout logic → PostgreSQL data: reads and writes
- Checkout logic → Stripe: creates payment
- Stripe → Stripe payment events: sends webhook
- Stripe payment events → PostgreSQL data: updates payment and orders
- Order background tasks → PostgreSQL data: updates order state
- Order background tasks → Stripe: checks payment
- FastAPI application → Try-on service: mounts try-on routes
- Try-on service → IDM-VTON service: submits prepared images
- FastAPI application → Realtime connections: serves WebSockets
- Realtime connections → Buyer: broadcasts updates
- Realtime connections → Seller: broadcasts updates
