# eunseong-jo/capstone architecture

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

- Interactive diagram: https://gitdiagram.com/eunseong-jo/capstone
- Repository: https://github.com/eunseong-jo/capstone

## Overview

Swappy is a personalized skincare-commerce app: users create a skin profile through Q&A or photo analysis, then browse skin-fit recommendations and ingredient-based cheaper alternatives; budget routines and a profile-aware chatbot extend that journey. The graph preserves the README’s major capabilities and the central backend, persistence, and frontend layers. Relationships are limited to README-documented behavior and source-index references; some implementation details were not sampled, so uncertain links are omitted.

Main entry points: [`backend/app/api/chat.py`](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/chat.py) (Chat API), [`backend/app/main.py`](https://github.com/eunseong-jo/capstone/blob/main/backend/app/main.py) (FastAPI Router), [`backend/app/api/diagnosis.py`](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/diagnosis.py) (Diagnosis API), [`frontend/src/App.tsx`](https://github.com/eunseong-jo/capstone/blob/main/frontend/src/App.tsx) (App Navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User App"]
  node_app["App Navigation<br/>[App.tsx]"]
  node_webapi["API Client<br/>[client.ts]"]
  node_authstate["Auth State<br/>[auth.ts]"]
  node_diagnosisui["Diagnosis Screens<br/>[index.tsx]"]
  node_profileui["Home and Profile<br/>[index.tsx]"]
end

subgraph group_profile["Skin Profiling"]
  node_diagnosisapi["Diagnosis API<br/>[diagnosis.py]"]
  node_diagnosis["Skin Type Diagnosis<br/>[diagnosis.py]"]
  node_photoapi["Skin Photo API<br/>[skin_photo.py]"]
  node_photo["Photo Analysis<br/>[skin_photo.py]"]
  node_facecheck["Photo Validation<br/>[face_gate.py]"]
end

subgraph group_catalog["Product Intelligence"]
  node_productsapi["Product API<br/>[products.py]"]
  node_recommendapi["Recommendation API<br/>[recommendations.py]"]
  node_similarity["Ingredient Similarity<br/>[similarity.py]"]
  node_skinfit["Skin Fit Scoring<br/>[skin_fit.py]"]
  node_budget["Budget Routines<br/>[budget_guide.py]"]
end

subgraph group_assistant["Personal AI"]
  node_chatapi["Chat API<br/>[chat.py]"]
  node_rag["Product RAG<br/>[rag.py]"]
  node_personalcontext["Personal Context"]
  node_memory["AI Memory<br/>[memory.py]"]
  node_llm["LLM Providers<br/>[llm.py]"]
  node_fallback["Chat Fallback<br/>[chat_fallback.py]"]
end

subgraph group_platform["API and Data"]
  node_api["FastAPI Router<br/>[main.py]"]
  node_dbsession["DB Sessions<br/>[session.py]"]
  node_productdata["Product Models<br/>[product.py]"]
  node_userdata["User Models<br/>[user.py]"]
  node_personaldata["Personal Models<br/>[personal.py]"]
  node_cache["Cache and Limits<br/>[cache.py]"]
  node_weatherapi["Weather API<br/>[weather.py]"]
end

node_user(("Skincare Shopper"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_diagnosisui
node_app -->|"routes to"| node_profileui
node_diagnosisui -.->|"requests diagnosis"| node_webapi
node_profileui -.->|"requests products"| node_webapi
node_webapi -.->|"HTTP requests"| node_api
node_api -->|"registers router"| node_diagnosisapi
node_api -->|"registers router"| node_productsapi
node_api -->|"registers router"| node_recommendapi
node_api -->|"registers router"| node_chatapi
node_api -->|"registers router"| node_weatherapi
node_diagnosisapi -->|"uses"| node_diagnosis
node_photoapi -->|"validates photo"| node_facecheck
node_photoapi -->|"analyzes photo"| node_photo
node_diagnosisapi -->|"combines photo scores"| node_photo
node_productsapi -->|"serves similar products"| node_similarity
node_recommendapi -->|"uses skin fit"| node_skinfit
node_budget -->|"shares scoring"| node_skinfit
node_chatapi -->|"retrieves products"| node_rag
node_chatapi -->|"loads context"| node_personalcontext
node_chatapi -->|"uses memory"| node_memory
node_chatapi -->|"requests response"| node_llm
node_chatapi -->|"falls back"| node_fallback
node_rag -->|"filters by fit"| node_skinfit
node_diagnosisapi -->|"uses session"| node_dbsession
node_productsapi -->|"queries products"| node_productdata
node_chatapi -->|"loads user"| node_userdata
node_chatapi -->|"reads memory"| node_personaldata
node_chatapi -->|"uses cache"| node_cache
node_llm -.->|"calls providers"| node_user
node_photo -.->|"sends analysis request"| node_user
node_weatherapi -.->|"fetches weather"| node_user

click node_app "https://github.com/eunseong-jo/capstone/blob/main/frontend/src/App.tsx"
click node_webapi "https://github.com/eunseong-jo/capstone/blob/main/frontend/src/api/client.ts"
click node_authstate "https://github.com/eunseong-jo/capstone/blob/main/frontend/src/context/auth.ts"
click node_diagnosisui "https://github.com/eunseong-jo/capstone/blob/main/frontend/src/pages/Onboarding/index.tsx"
click node_profileui "https://github.com/eunseong-jo/capstone/blob/main/frontend/src/pages/Home/index.tsx"
click node_diagnosisapi "https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/diagnosis.py"
click node_diagnosis "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/diagnosis.py"
click node_photoapi "https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/skin_photo.py"
click node_photo "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/skin_photo.py"
click node_facecheck "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/face_gate.py"
click node_productsapi "https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/products.py"
click node_recommendapi "https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/recommendations.py"
click node_similarity "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/similarity.py"
click node_skinfit "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/skin_fit.py"
click node_budget "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/budget_guide.py"
click node_chatapi "https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/chat.py"
click node_rag "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/rag.py"
click node_personalcontext "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/personal_context.py"
click node_memory "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/memory.py"
click node_llm "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/llm.py"
click node_fallback "https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/chat_fallback.py"
click node_api "https://github.com/eunseong-jo/capstone/blob/main/backend/app/main.py"
click node_dbsession "https://github.com/eunseong-jo/capstone/blob/main/backend/app/db/session.py"
click node_productdata "https://github.com/eunseong-jo/capstone/blob/main/backend/app/models/product.py"
click node_userdata "https://github.com/eunseong-jo/capstone/blob/main/backend/app/models/user.py"
click node_personaldata "https://github.com/eunseong-jo/capstone/blob/main/backend/app/models/personal.py"
click node_cache "https://github.com/eunseong-jo/capstone/blob/main/backend/app/core/cache.py"
click node_weatherapi "https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/weather.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_app,node_webapi,node_authstate,node_diagnosisui,node_profileui toneBlue
class node_diagnosisapi,node_diagnosis,node_photoapi,node_photo,node_facecheck toneAmber
class node_productsapi,node_recommendapi,node_similarity,node_skinfit,node_budget toneMint
class node_chatapi,node_rag,node_personalcontext,node_memory,node_llm,node_fallback toneRose
class node_api,node_dbsession,node_productdata,node_userdata,node_personaldata,node_cache,node_weatherapi,node_user toneIndigo
```

## Components

### User App

- [App Navigation](https://github.com/eunseong-jo/capstone/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/eunseong-jo/capstone/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Auth State](https://github.com/eunseong-jo/capstone/blob/main/frontend/src/context/auth.ts): `frontend/src/context/auth.ts`
- [Diagnosis Screens](https://github.com/eunseong-jo/capstone/blob/main/frontend/src/pages/Onboarding/index.tsx): `frontend/src/pages/Onboarding/index.tsx`
- [Home and Profile](https://github.com/eunseong-jo/capstone/blob/main/frontend/src/pages/Home/index.tsx): `frontend/src/pages/Home/index.tsx`

### Skin Profiling

- [Diagnosis API](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/diagnosis.py): `backend/app/api/diagnosis.py`
- [Skin Type Diagnosis](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/diagnosis.py): `backend/app/services/diagnosis.py`
- [Skin Photo API](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/skin_photo.py): `backend/app/api/skin_photo.py`
- [Photo Analysis](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/skin_photo.py): `backend/app/services/skin_photo.py`
- [Photo Validation](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/face_gate.py): `backend/app/services/face_gate.py`

### Product Intelligence

- [Product API](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/products.py): `backend/app/api/products.py`
- [Recommendation API](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/recommendations.py): `backend/app/api/recommendations.py`
- [Ingredient Similarity](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/similarity.py): `backend/app/services/similarity.py`
- [Skin Fit Scoring](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/skin_fit.py): `backend/app/services/skin_fit.py`
- [Budget Routines](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/budget_guide.py): `backend/app/services/budget_guide.py`

### Personal AI

- [Chat API](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Product RAG](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/rag.py): `backend/app/services/rag.py`
- [Personal Context](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/personal_context.py): `backend/app/services/personal_context.py`
- [AI Memory](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/memory.py): `backend/app/services/memory.py`
- [LLM Providers](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/llm.py): `backend/app/services/llm.py`
- [Chat Fallback](https://github.com/eunseong-jo/capstone/blob/main/backend/app/services/chat_fallback.py): `backend/app/services/chat_fallback.py`

### API and Data

- [FastAPI Router](https://github.com/eunseong-jo/capstone/blob/main/backend/app/main.py): `backend/app/main.py`
- [DB Sessions](https://github.com/eunseong-jo/capstone/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Product Models](https://github.com/eunseong-jo/capstone/blob/main/backend/app/models/product.py): `backend/app/models/product.py`
- [User Models](https://github.com/eunseong-jo/capstone/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Personal Models](https://github.com/eunseong-jo/capstone/blob/main/backend/app/models/personal.py): `backend/app/models/personal.py`
- [Cache and Limits](https://github.com/eunseong-jo/capstone/blob/main/backend/app/core/cache.py): `backend/app/core/cache.py`
- [Weather API](https://github.com/eunseong-jo/capstone/blob/main/backend/app/api/weather.py): `backend/app/api/weather.py`

### Other components

- **Skincare Shopper**

## Connections

- Skincare Shopper → App Navigation: uses (evidence: `frontend/src/App.tsx`)
- App Navigation → Diagnosis Screens: routes to (evidence: `frontend/src/App.tsx`)
- App Navigation → Home and Profile: routes to (evidence: `frontend/src/App.tsx`)
- Diagnosis Screens → API Client: requests diagnosis
- Home and Profile → API Client: requests products
- API Client → FastAPI Router: HTTP requests
- FastAPI Router → Diagnosis API: registers router (evidence: `backend/app/main.py`)
- FastAPI Router → Product API: registers router (evidence: `backend/app/main.py`)
- FastAPI Router → Recommendation API: registers router (evidence: `backend/app/main.py`)
- FastAPI Router → Chat API: registers router (evidence: `backend/app/main.py`)
- FastAPI Router → Weather API: registers router (evidence: `backend/app/main.py`)
- Diagnosis API → Skin Type Diagnosis: uses (evidence: `backend/app/api/diagnosis.py`)
- Skin Photo API → Photo Validation: validates photo (evidence: `README.md`)
- Skin Photo API → Photo Analysis: analyzes photo (evidence: `README.md`)
- Diagnosis API → Photo Analysis: combines photo scores (evidence: `README.md`)
- Product API → Ingredient Similarity: serves similar products (evidence: `README.md`)
- Recommendation API → Skin Fit Scoring: uses skin fit (evidence: `README.md`)
- Budget Routines → Skin Fit Scoring: shares scoring (evidence: `README.md`)
- Chat API → Product RAG: retrieves products (evidence: `backend/app/api/chat.py`)
- Chat API → Personal Context: loads context (evidence: `backend/app/api/chat.py`)
- Chat API → AI Memory: uses memory (evidence: `backend/app/api/chat.py`)
- Chat API → LLM Providers: requests response (evidence: `backend/app/api/chat.py`)
- Chat API → Chat Fallback: falls back (evidence: `backend/app/api/chat.py`)
- Product RAG → Skin Fit Scoring: filters by fit (evidence: `backend/app/services/rag.py`)
- Diagnosis API → DB Sessions: uses session (evidence: `backend/app/api/diagnosis.py`)
- Product API → Product Models: queries products
- Chat API → User Models: loads user (evidence: `backend/app/api/chat.py`)
- Chat API → Personal Models: reads memory (evidence: `backend/app/api/chat.py`)
- Chat API → Cache and Limits: uses cache (evidence: `backend/app/api/chat.py`)
- LLM Providers → Skincare Shopper: calls providers (evidence: `README.md`)
- Photo Analysis → Skincare Shopper: sends analysis request (evidence: `README.md`)
- Weather API → Skincare Shopper: fetches weather (evidence: `README.md`)
