# gtun/enclothed architecture

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

- Interactive diagram: https://gitdiagram.com/gtun/enclothed
- Repository: https://github.com/gtun/enclothed

## Overview

enclothed is a multi-user wardrobe web app with a companion CLI: garment photos become validated, searchable wardrobe records, then text-based outfit suggestions and wardrobe answers use those records. Users can also mend details, recreate photographed looks, manage style and garment state, and share expiring snapshots. The graph separates the browser/CLI entry points, wardrobe and AI workflows, and shared infrastructure. Several frontend feature modules and backend modules are unsampled; their capabilities are retained from the README, while uncertain call links are omitted or marked unverified.

Main entry points: [`src/enclothed/api.py`](https://github.com/gtun/enclothed/blob/main/src/enclothed/api.py) (Web API), [`src/enclothed/llm.py`](https://github.com/gtun/enclothed/blob/main/src/enclothed/llm.py) (LLM gateway), [`src/enclothed/db.py`](https://github.com/gtun/enclothed/blob/main/src/enclothed/db.py) (Wardrobe database), [`src/enclothed/intake.py`](https://github.com/gtun/enclothed/blob/main/src/enclothed/intake.py) (Photo intake)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_browser["Web interface<br/>[main.js]"]
  node_cli["Command line<br/>[main.py]"]
  node_api["Web API<br/>[api.py]"]
end

subgraph group_wardrobe["Wardrobe management"]
  node_intake["Photo intake<br/>[intake.py]"]
  node_drafts["Review drafts<br/>[drafts.py]"]
  node_editing["Garment editing<br/>[editing.js]"]
  node_mend["Fill blank fields<br/>[mend.py]"]
  node_sets["Sets and retirement<br/>[combo.js]"]
  node_shares["Public snapshots<br/>[shares.py]"]
end

subgraph group_styling["Outfits and looks"]
  node_outfit["Outfit generation<br/>[outfit.py]"]
  node_builder["Outfit builder<br/>[builder.js]"]
  node_mimic["Look recreation<br/>[mimic.py]"]
  node_style["Style preferences<br/>[style.js]"]
end

subgraph group_assistant["Wardrobe assistant"]
  node_insights["Ask wardrobe<br/>[insights.py]"]
  node_sandbox["Read-only sandbox<br/>[sandbox.py]"]
end

subgraph group_platform["Shared platform"]
  node_usage["AI usage reporting<br/>[usage.py]"]
  node_auth["Identity and access<br/>[auth.py]"]
  node_models["Validated domain models<br/>[models.py]"]
  node_photos["Photo storage<br/>[photos.py]"]
  node_llm["LLM gateway<br/>[llm.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_db[("Wardrobe database<br/>[db.py]")]
end

node_person(("Wardrobe user"))
node_ai{{"AI provider"}}

node_person -->|"uses"| node_browser
node_person -->|"uses"| node_cli
node_browser -.->|"sends requests"| node_api
node_cli -->|"tags garments"| node_intake
node_api -->|"resolves user"| node_auth
node_api -->|"reads and writes"| node_db
node_api -.->|"handles intake"| node_intake
node_api -->|"invokes"| node_mend
node_api -->|"invokes"| node_mimic
node_api -->|"serves shares"| node_shares
node_api -->|"invokes"| node_insights
node_api -->|"requests outfits"| node_outfit
node_api -->|"reads usage"| node_usage
node_intake -->|"tags photos"| node_llm
node_intake -->|"saves garment"| node_db
node_drafts -->|"uses tagging"| node_intake
node_editing -.->|"updates fields"| node_api
node_mend -->|"fills blanks"| node_llm
node_mend -->|"loads photos"| node_photos
node_outfit -->|"generates suggestions"| node_llm
node_outfit -->|"saves outfits"| node_db
node_builder -.->|"requests generation"| node_api
node_mimic -->|"tags and matches"| node_llm
node_mimic -->|"saves look and outfits"| node_db
node_mimic -->|"uses look photos"| node_photos
node_style -.->|"stores preferences"| node_api
node_insights -->|"asks questions"| node_llm
node_insights -->|"uses query rules"| node_sandbox
node_shares -->|"stores snapshots"| node_db
node_shares -->|"copies photos"| node_photos
node_llm -->|"calls provider"| node_ai
node_llm -.->|"logs calls"| node_usage
node_llm -->|"validates outputs"| node_models
node_api -->|"validates requests"| node_models
node_api -->|"serves photos"| node_photos
node_auth -->|"looks up users"| node_db
node_auth -.->|"verifies identity"| node_ai

click node_browser "https://github.com/gtun/enclothed/blob/main/public/js/main.js"
click node_cli "https://github.com/gtun/enclothed/blob/main/src/enclothed/main.py"
click node_api "https://github.com/gtun/enclothed/blob/main/src/enclothed/api.py"
click node_intake "https://github.com/gtun/enclothed/blob/main/src/enclothed/intake.py"
click node_drafts "https://github.com/gtun/enclothed/blob/main/src/enclothed/drafts.py"
click node_editing "https://github.com/gtun/enclothed/blob/main/public/js/features/editing.js"
click node_mend "https://github.com/gtun/enclothed/blob/main/src/enclothed/mend.py"
click node_sets "https://github.com/gtun/enclothed/blob/main/public/js/features/combo.js"
click node_outfit "https://github.com/gtun/enclothed/blob/main/src/enclothed/outfit.py"
click node_builder "https://github.com/gtun/enclothed/blob/main/public/js/features/builder.js"
click node_mimic "https://github.com/gtun/enclothed/blob/main/src/enclothed/mimic.py"
click node_style "https://github.com/gtun/enclothed/blob/main/public/js/features/style.js"
click node_insights "https://github.com/gtun/enclothed/blob/main/src/enclothed/insights.py"
click node_sandbox "https://github.com/gtun/enclothed/blob/main/src/enclothed/sandbox.py"
click node_shares "https://github.com/gtun/enclothed/blob/main/src/enclothed/shares.py"
click node_usage "https://github.com/gtun/enclothed/blob/main/src/enclothed/usage.py"
click node_auth "https://github.com/gtun/enclothed/blob/main/src/enclothed/auth.py"
click node_models "https://github.com/gtun/enclothed/blob/main/src/enclothed/models.py"
click node_photos "https://github.com/gtun/enclothed/blob/main/src/enclothed/photos.py"
click node_llm "https://github.com/gtun/enclothed/blob/main/src/enclothed/llm.py"
click node_config "https://github.com/gtun/enclothed/blob/main/src/enclothed/config.py"
click node_db "https://github.com/gtun/enclothed/blob/main/src/enclothed/db.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_browser,node_cli,node_api,node_person toneBlue
class node_intake,node_drafts,node_editing,node_mend,node_sets,node_shares toneAmber
class node_outfit,node_builder,node_mimic,node_style toneMint
class node_insights,node_sandbox toneRose
class node_usage,node_auth,node_models,node_photos,node_llm,node_config,node_db,node_ai toneIndigo
```

## Components

### User interfaces

- [Web interface](https://github.com/gtun/enclothed/blob/main/public/js/main.js): `public/js/main.js`
- [Command line](https://github.com/gtun/enclothed/blob/main/src/enclothed/main.py): `src/enclothed/main.py`
- [Web API](https://github.com/gtun/enclothed/blob/main/src/enclothed/api.py): `src/enclothed/api.py`

### Wardrobe management

- [Photo intake](https://github.com/gtun/enclothed/blob/main/src/enclothed/intake.py): `src/enclothed/intake.py`
- [Review drafts](https://github.com/gtun/enclothed/blob/main/src/enclothed/drafts.py): `src/enclothed/drafts.py`
- [Garment editing](https://github.com/gtun/enclothed/blob/main/public/js/features/editing.js): `public/js/features/editing.js`
- [Fill blank fields](https://github.com/gtun/enclothed/blob/main/src/enclothed/mend.py): `src/enclothed/mend.py`
- [Sets and retirement](https://github.com/gtun/enclothed/blob/main/public/js/features/combo.js): `public/js/features/combo.js`
- [Public snapshots](https://github.com/gtun/enclothed/blob/main/src/enclothed/shares.py): `src/enclothed/shares.py`

### Outfits and looks

- [Outfit generation](https://github.com/gtun/enclothed/blob/main/src/enclothed/outfit.py): `src/enclothed/outfit.py`
- [Outfit builder](https://github.com/gtun/enclothed/blob/main/public/js/features/builder.js): `public/js/features/builder.js`
- [Look recreation](https://github.com/gtun/enclothed/blob/main/src/enclothed/mimic.py): `src/enclothed/mimic.py`
- [Style preferences](https://github.com/gtun/enclothed/blob/main/public/js/features/style.js): `public/js/features/style.js`

### Wardrobe assistant

- [Ask wardrobe](https://github.com/gtun/enclothed/blob/main/src/enclothed/insights.py): `src/enclothed/insights.py`
- [Read-only sandbox](https://github.com/gtun/enclothed/blob/main/src/enclothed/sandbox.py): `src/enclothed/sandbox.py`

### Shared platform

- [AI usage reporting](https://github.com/gtun/enclothed/blob/main/src/enclothed/usage.py): `src/enclothed/usage.py`
- [Identity and access](https://github.com/gtun/enclothed/blob/main/src/enclothed/auth.py): `src/enclothed/auth.py`
- [Validated domain models](https://github.com/gtun/enclothed/blob/main/src/enclothed/models.py): `src/enclothed/models.py`
- [Photo storage](https://github.com/gtun/enclothed/blob/main/src/enclothed/photos.py): `src/enclothed/photos.py`
- [LLM gateway](https://github.com/gtun/enclothed/blob/main/src/enclothed/llm.py): `src/enclothed/llm.py`
- [Runtime configuration](https://github.com/gtun/enclothed/blob/main/src/enclothed/config.py): `src/enclothed/config.py`
- [Wardrobe database](https://github.com/gtun/enclothed/blob/main/src/enclothed/db.py): `src/enclothed/db.py`

### Other components

- **Wardrobe user**
- **AI provider**

## Connections

- Wardrobe user → Web interface: uses
- Wardrobe user → Command line: uses
- Web interface → Web API: sends requests
- Command line → Photo intake: tags garments (evidence: `src/enclothed/main.py`)
- Web API → Identity and access: resolves user (evidence: `src/enclothed/api.py`)
- Web API → Wardrobe database: reads and writes (evidence: `src/enclothed/api.py`)
- Web API → Photo intake: handles intake
- Web API → Fill blank fields: invokes (evidence: `src/enclothed/api.py`)
- Web API → Look recreation: invokes (evidence: `src/enclothed/api.py`)
- Web API → Public snapshots: serves shares (evidence: `src/enclothed/api.py`)
- Web API → Ask wardrobe: invokes (evidence: `src/enclothed/api.py`)
- Web API → Outfit generation: requests outfits (evidence: `src/enclothed/api.py`)
- Web API → AI usage reporting: reads usage (evidence: `src/enclothed/api.py`)
- Photo intake → LLM gateway: tags photos (evidence: `src/enclothed/intake.py`)
- Photo intake → Wardrobe database: saves garment (evidence: `src/enclothed/intake.py`)
- Review drafts → Photo intake: uses tagging (evidence: `src/enclothed/drafts.py`)
- Garment editing → Web API: updates fields
- Fill blank fields → LLM gateway: fills blanks (evidence: `src/enclothed/mend.py`)
- Fill blank fields → Photo storage: loads photos (evidence: `src/enclothed/mend.py`)
- Outfit generation → LLM gateway: generates suggestions (evidence: `src/enclothed/outfit.py`)
- Outfit generation → Wardrobe database: saves outfits (evidence: `src/enclothed/outfit.py`)
- Outfit builder → Web API: requests generation
- Look recreation → LLM gateway: tags and matches (evidence: `src/enclothed/mimic.py`)
- Look recreation → Wardrobe database: saves look and outfits (evidence: `src/enclothed/mimic.py`)
- Look recreation → Photo storage: uses look photos (evidence: `src/enclothed/mimic.py`)
- Style preferences → Web API: stores preferences
- Ask wardrobe → LLM gateway: asks questions (evidence: `src/enclothed/insights.py`)
- Ask wardrobe → Read-only sandbox: uses query rules (evidence: `src/enclothed/insights.py`)
- Public snapshots → Wardrobe database: stores snapshots (evidence: `src/enclothed/shares.py`)
- Public snapshots → Photo storage: copies photos (evidence: `src/enclothed/shares.py`)
- LLM gateway → AI provider: calls provider
- LLM gateway → AI usage reporting: logs calls
- LLM gateway → Validated domain models: validates outputs (evidence: `src/enclothed/llm.py`)
- Web API → Validated domain models: validates requests (evidence: `src/enclothed/api.py`)
- Web API → Photo storage: serves photos (evidence: `src/enclothed/api.py`)
- Identity and access → Wardrobe database: looks up users (evidence: `src/enclothed/auth.py`)
- Identity and access → AI provider: verifies identity
