# sujpatel/ai-agent-clothes-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/sujpatel/ai-agent-clothes-frontend
- Repository: https://github.com/sujpatel/ai-agent-clothes-frontend

## Overview

This is an Expo mobile wardrobe and outfit-assistance app. The principal flow is a user requesting a daily outfit, optionally refining it, and viewing the result; other routes support scanning clothes, managing wardrobe items, and tracking laundry. Shared contexts provide authentication, wardrobe state, and notifications, while API helpers attach credentials to backend requests. The map uses README-level product context and SOURCE INDEX references for unsampled route relationships; some route internals and backend behavior were not provided, so those links are omitted.

Main entry points: [`context/wardrobe-context.tsx`](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/context/wardrobe-context.tsx) (Wardrobe state), [`app/(tabs)/index.tsx`](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/index.tsx) (Outfit generation), [`config/api-fetch.ts`](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/config/api-fetch.ts) (Authenticated fetch), [`app/(tabs)/scan.tsx`](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/scan.tsx) (Clothing scan)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app_shell["App shell<br/>[_layout.tsx]"]
  node_today["Outfit generation<br/>[index.tsx]"]
  node_scan["Clothing scan<br/>[scan.tsx]"]
  node_style_profile["Style preferences"]
  node_login["Sign-in<br/>[login.tsx]"]
end

subgraph group_wardrobe["Wardrobe management"]
  node_explore["Wardrobe browse<br/>[explore.tsx]"]
  node_laundry_screen["Laundry tracking<br/>[laundry.tsx]"]
  node_item_edit["Item editing"]
  node_photo_display["Authenticated photos<br/>[loadable-photo.tsx]"]
  node_wardrobe_state["Wardrobe state"]
end

subgraph group_shared["Shared app services"]
  node_auth_state["Auth state<br/>[auth-context.tsx]"]
  node_toast["Notifications<br/>[toast-context.tsx]"]
  node_photo_source["Photo auth headers"]
end

subgraph group_infrastructure["API and authentication"]
  node_api_fetch["Authenticated fetch<br/>[api-fetch.ts]"]
  node_api_config["Backend address<br/>[api.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
end

node_user(("User"))
node_backend["Clothing backend"]
node_supabase["Supabase Auth"]

node_user -->|"requests outfit"| node_today
node_today -->|"fetches outfit"| node_api_fetch
node_today -->|"opens preferences"| node_style_profile
node_today -->|"loads item photos"| node_photo_source
node_today -->|"uses API address"| node_api_config
node_user -->|"scans clothing"| node_scan
node_scan -->|"updates wardrobe"| node_wardrobe_state
node_scan -->|"calls backend"| node_api_fetch
node_scan -->|"uses API address"| node_api_config
node_user -->|"browses items"| node_explore
node_explore -->|"reads wardrobe"| node_wardrobe_state
node_explore -->|"opens editor"| node_item_edit
node_explore -->|"renders photos"| node_photo_display
node_user -->|"tracks laundry"| node_laundry_screen
node_laundry_screen -->|"updates availability"| node_wardrobe_state
node_item_edit -->|"saves changes"| node_wardrobe_state
node_wardrobe_state -->|"sends item requests"| node_api_fetch
node_wardrobe_state -->|"uses API address"| node_api_config
node_wardrobe_state -->|"reports mutations"| node_toast
node_app_shell -->|"provides auth"| node_auth_state
node_app_shell -->|"provides notifications"| node_toast
node_app_shell -->|"provides wardrobe"| node_wardrobe_state
node_login -->|"signs in"| node_auth_state
node_auth_state -->|"uses client"| node_supabase_client
node_supabase_client -.->|"authenticates"| node_supabase
node_api_fetch -->|"gets session"| node_supabase_client
node_api_fetch -->|"sends requests"| node_backend
node_api_config -->|"identifies service"| node_backend
node_photo_display -->|"builds image source"| node_photo_source
node_photo_source -->|"reads session"| node_auth_state

click node_app_shell "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/_layout.tsx"
click node_today "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/index.tsx"
click node_scan "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/scan.tsx"
click node_explore "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/explore.tsx"
click node_laundry_screen "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/laundry.tsx"
click node_item_edit "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/components/edit-item-modal.tsx"
click node_photo_display "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/components/loadable-photo.tsx"
click node_wardrobe_state "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/context/wardrobe-context.tsx"
click node_style_profile "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/components/style-profile-modal.tsx"
click node_login "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/login.tsx"
click node_auth_state "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/context/auth-context.tsx"
click node_toast "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/context/toast-context.tsx"
click node_photo_source "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/hooks/use-authed-photo-source.ts"
click node_api_fetch "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/config/api-fetch.ts"
click node_api_config "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/config/api.ts"
click node_supabase_client "https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/config/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_shell,node_today,node_scan,node_style_profile,node_login,node_user toneBlue
class node_explore,node_laundry_screen,node_item_edit,node_photo_display,node_wardrobe_state toneAmber
class node_auth_state,node_toast,node_photo_source toneMint
class node_api_fetch,node_api_config,node_supabase_client toneRose
class node_backend,node_supabase toneIndigo
```

## Components

### App experience

- [App shell](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/_layout.tsx): `app/_layout.tsx`
- [Outfit generation](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Clothing scan](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/scan.tsx): `app/(tabs)/scan.tsx`
- [Style preferences](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/components/style-profile-modal.tsx): `components/style-profile-modal.tsx`
- [Sign-in](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/login.tsx): `app/login.tsx`

### Wardrobe management

- [Wardrobe browse](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/explore.tsx): `app/(tabs)/explore.tsx`
- [Laundry tracking](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/app/(tabs)/laundry.tsx): `app/(tabs)/laundry.tsx`
- [Item editing](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/components/edit-item-modal.tsx): `components/edit-item-modal.tsx`
- [Authenticated photos](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/components/loadable-photo.tsx): `components/loadable-photo.tsx`
- [Wardrobe state](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/context/wardrobe-context.tsx): `context/wardrobe-context.tsx`

### Shared app services

- [Auth state](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/context/auth-context.tsx): `context/auth-context.tsx`
- [Notifications](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/context/toast-context.tsx): `context/toast-context.tsx`
- [Photo auth headers](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/hooks/use-authed-photo-source.ts): `hooks/use-authed-photo-source.ts`

### API and authentication

- [Authenticated fetch](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/config/api-fetch.ts): `config/api-fetch.ts`
- [Backend address](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/config/api.ts): `config/api.ts`
- [Supabase client](https://github.com/sujpatel/ai-agent-clothes-frontend/blob/master/config/supabase.ts): `config/supabase.ts`

### Other components

- **User**
- **Clothing backend**
- **Supabase Auth**

## Connections

- User → Outfit generation: requests outfit (evidence: `app/(tabs)/index.tsx`)
- Outfit generation → Authenticated fetch: fetches outfit (evidence: `app/(tabs)/index.tsx`)
- Outfit generation → Style preferences: opens preferences (evidence: `app/(tabs)/index.tsx`)
- Outfit generation → Photo auth headers: loads item photos (evidence: `app/(tabs)/index.tsx`)
- Outfit generation → Backend address: uses API address (evidence: `app/(tabs)/index.tsx`)
- User → Clothing scan: scans clothing (evidence: `app/(tabs)/scan.tsx`)
- Clothing scan → Wardrobe state: updates wardrobe (evidence: `app/(tabs)/scan.tsx`)
- Clothing scan → Authenticated fetch: calls backend (evidence: `app/(tabs)/scan.tsx`)
- Clothing scan → Backend address: uses API address (evidence: `app/(tabs)/scan.tsx`)
- User → Wardrobe browse: browses items (evidence: `app/(tabs)/explore.tsx`)
- Wardrobe browse → Wardrobe state: reads wardrobe (evidence: `app/(tabs)/explore.tsx`)
- Wardrobe browse → Item editing: opens editor (evidence: `app/(tabs)/explore.tsx`)
- Wardrobe browse → Authenticated photos: renders photos (evidence: `app/(tabs)/explore.tsx`)
- User → Laundry tracking: tracks laundry (evidence: `app/(tabs)/laundry.tsx`)
- Laundry tracking → Wardrobe state: updates availability (evidence: `app/(tabs)/laundry.tsx`)
- Item editing → Wardrobe state: saves changes (evidence: `components/edit-item-modal.tsx`)
- Wardrobe state → Authenticated fetch: sends item requests (evidence: `context/wardrobe-context.tsx`)
- Wardrobe state → Backend address: uses API address (evidence: `context/wardrobe-context.tsx`)
- Wardrobe state → Notifications: reports mutations (evidence: `context/wardrobe-context.tsx`)
- App shell → Auth state: provides auth (evidence: `app/_layout.tsx`)
- App shell → Notifications: provides notifications (evidence: `app/_layout.tsx`)
- App shell → Wardrobe state: provides wardrobe (evidence: `app/_layout.tsx`)
- Sign-in → Auth state: signs in (evidence: `app/login.tsx`)
- Auth state → Supabase client: uses client (evidence: `context/auth-context.tsx`)
- Supabase client → Supabase Auth: authenticates
- Authenticated fetch → Supabase client: gets session (evidence: `config/api-fetch.ts`)
- Authenticated fetch → Clothing backend: sends requests (evidence: `config/api-fetch.ts`)
- Backend address → Clothing backend: identifies service (evidence: `config/api.ts`)
- Authenticated photos → Photo auth headers: builds image source (evidence: `components/loadable-photo.tsx`)
- Photo auth headers → Auth state: reads session (evidence: `hooks/use-authed-photo-source.ts`)
