# pacharaponk/aphrodize architecture

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

- Interactive diagram: https://gitdiagram.com/pacharaponk/aphrodize
- Repository: https://github.com/pacharaponk/aphrodize

## Overview

Aphrodize combines a user-facing skin and wellness application with a modular ML workflow backend. The image-analysis path runs from capture through API submission, queued inference, the checked FFHQ-Wrinkle pipeline, and persisted results; account, product recommendations, UV, and Daily Health are distinct product capabilities. The README and source index support these branches, though several route and model implementations were not sampled, so uncertain connections are omitted.

Main entry points: [`backend/api/v1/router.py`](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/router.py) (Versioned API router), [`backend/workers/inference_worker.py`](https://github.com/pacharaponk/aphrodize/blob/main/backend/workers/inference_worker.py) (Inference worker), [`backend/services/analysis_service.py`](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/analysis_service.py) (Analysis workflow), [`backend/wrinkle/service.py`](https://github.com/pacharaponk/aphrodize/blob/main/backend/wrinkle/service.py) (Wrinkle orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User application"]
  node_capture["Image capture<br/>[page.tsx]"]
  node_frontend_api["Web API routes<br/>[route.ts]"]
  node_result_ui["Analysis results"]
  node_recommendation_ui["Recommendations UI"]
  node_uv_ui["UV experience<br/>[page.tsx]"]
  node_daily_ui["Daily Health UI"]
end

subgraph group_api["API and workflows"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_api_router["Versioned API router<br/>[router.py]"]
  node_auth_routes["Accounts and consent<br/>[auth.py]"]
  node_analysis_routes["Image analysis routes<br/>[analyses.py]"]
  node_inference_routes["Generic inference route<br/>[inference.py]"]
  node_product_routes["Product catalog routes<br/>[products.py]"]
  node_uv_routes["UV routes<br/>[uv.py]"]
  node_analysis_service["Analysis workflow"]
  node_inference_service["Inference enqueue"]
  node_uv_service["UV services<br/>[uv_service.py]"]
  node_uv_map["UV map service<br/>[uv_map_service.py]"]
end

subgraph group_inference["Image inference"]
  node_inference_worker["Inference worker"]
  node_wrinkle_service["Wrinkle orchestration<br/>[service.py]"]
  node_prediction["Prediction pipeline<br/>[prediction.py]"]
  node_modeling["Model loading<br/>[modeling.py]"]
  node_official_inference["Segmentation models<br/>[inference.py]"]
  node_confidence["Confidence policy<br/>[confidence.py]"]
  node_scoring["Wrinkle scoring<br/>[scoring.py]"]
end

subgraph group_platform["Platform services"]
  node_database[("Application database<br/>[models.py]")]
  node_minio[("Private object storage<br/>[minio_client.py]")]
  node_redis["ARQ job queues<br/>[redis_client.py]"]
  node_annotation["Annotation workflow"]
end

subgraph group_health["Daily Health"]
  node_daily_routes["Daily Health routes<br/>[daily_health.py]"]
  node_daily_service["Daily Health services"]
  node_daily_training["Daily Health training"]
end

node_user(("User"))
node_labelstudio["Label Studio"]

node_user -->|"submits photo"| node_capture
node_capture -.->|"sends analysis"| node_frontend_api
node_frontend_api -.->|"calls API"| node_analysis_routes
node_analysis_routes -.->|"creates analysis"| node_analysis_service
node_analysis_service -->|"stores workflow"| node_database
node_analysis_service -->|"reads and writes"| node_minio
node_analysis_service -->|"queues job"| node_redis
node_redis -->|"dispatches job"| node_inference_worker
node_inference_worker -->|"loads and saves"| node_database
node_inference_worker -.->|"loads image"| node_minio
node_inference_worker -->|"runs analysis"| node_wrinkle_service
node_wrinkle_service -->|"predicts image"| node_prediction
node_wrinkle_service -->|"applies policy"| node_confidence
node_wrinkle_service -->|"scores output"| node_scoring
node_prediction -->|"loads model"| node_modeling
node_modeling -->|"constructs network"| node_official_inference
node_inference_worker -->|"stores artifacts"| node_minio
node_inference_worker -->|"stages review"| node_annotation
node_annotation -->|"publishes tasks"| node_labelstudio
node_analysis_routes -.->|"returns analysis"| node_result_ui
node_user -->|"creates account"| node_auth_routes
node_api_app -->|"mounts routes"| node_api_router
node_api_router -->|"registers routes"| node_auth_routes
node_api_router -->|"registers routes"| node_analysis_routes
node_api_router -->|"registers routes"| node_inference_routes
node_api_router -->|"registers routes"| node_daily_routes
node_api_router -->|"registers routes"| node_product_routes
node_api_router -->|"registers routes"| node_uv_routes
node_inference_routes -->|"creates run"| node_inference_service
node_inference_service -->|"persists run"| node_database
node_inference_service -->|"enqueues job"| node_redis
node_user -->|"tracks health"| node_daily_ui
node_daily_ui -.->|"requests data"| node_daily_routes
node_daily_routes -.->|"uses services"| node_daily_service
node_daily_training -.->|"records training"| node_database
node_user -->|"views products"| node_recommendation_ui
node_recommendation_ui -.->|"requests catalog"| node_product_routes
node_user -->|"views UV"| node_uv_ui
node_uv_ui -.->|"requests UV data"| node_uv_routes
node_uv_routes -.->|"uses service"| node_uv_service
node_uv_routes -.->|"uses map service"| node_uv_map

click node_capture "https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/capture/page.tsx"
click node_frontend_api "https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/api/analysis/route.ts"
click node_result_ui "https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/capture/analysis-result.tsx"
click node_recommendation_ui "https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/recommendation/recommendation-panel.tsx"
click node_uv_ui "https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/uv-map/page.tsx"
click node_daily_ui "https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/clients/daily-health-dashboard.tsx"
click node_api_app "https://github.com/pacharaponk/aphrodize/blob/main/backend/main.py"
click node_api_router "https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/router.py"
click node_auth_routes "https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/auth.py"
click node_analysis_routes "https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/analyses.py"
click node_inference_routes "https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/inference.py"
click node_daily_routes "https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/daily_health.py"
click node_product_routes "https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/products.py"
click node_uv_routes "https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/uv.py"
click node_analysis_service "https://github.com/pacharaponk/aphrodize/blob/main/backend/services/analysis_service.py"
click node_inference_service "https://github.com/pacharaponk/aphrodize/blob/main/backend/services/inference_service.py"
click node_inference_worker "https://github.com/pacharaponk/aphrodize/blob/main/backend/workers/inference_worker.py"
click node_wrinkle_service "https://github.com/pacharaponk/aphrodize/blob/main/backend/wrinkle/service.py"
click node_prediction "https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/prediction.py"
click node_modeling "https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/modeling.py"
click node_official_inference "https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/official/inference.py"
click node_confidence "https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/confidence.py"
click node_scoring "https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/scoring.py"
click node_database "https://github.com/pacharaponk/aphrodize/blob/main/backend/core/db/models.py"
click node_minio "https://github.com/pacharaponk/aphrodize/blob/main/backend/libs/minio_client.py"
click node_redis "https://github.com/pacharaponk/aphrodize/blob/main/backend/libs/redis_client.py"
click node_annotation "https://github.com/pacharaponk/aphrodize/blob/main/backend/services/annotation_service.py"
click node_daily_service "https://github.com/pacharaponk/aphrodize/blob/main/backend/services/daily_health_dataset.py"
click node_daily_training "https://github.com/pacharaponk/aphrodize/blob/main/backend/services/daily_health_training.py"
click node_uv_service "https://github.com/pacharaponk/aphrodize/blob/main/backend/services/uv_service.py"
click node_uv_map "https://github.com/pacharaponk/aphrodize/blob/main/backend/services/uv_map_service.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_capture,node_frontend_api,node_result_ui,node_recommendation_ui,node_uv_ui,node_daily_ui,node_user toneBlue
class node_api_app,node_api_router,node_auth_routes,node_analysis_routes,node_inference_routes,node_product_routes,node_uv_routes,node_analysis_service,node_inference_service,node_uv_service,node_uv_map toneAmber
class node_inference_worker,node_wrinkle_service,node_prediction,node_modeling,node_official_inference,node_confidence,node_scoring toneMint
class node_database,node_minio,node_redis,node_annotation toneRose
class node_daily_routes,node_daily_service,node_daily_training,node_labelstudio toneIndigo
```

## Components

### User application

- [Image capture](https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/capture/page.tsx): `frontend/src/app/capture/page.tsx`
- [Web API routes](https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/api/analysis/route.ts): `frontend/src/app/api/analysis/route.ts`
- [Analysis results](https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/capture/analysis-result.tsx): `frontend/src/app/capture/analysis-result.tsx`
- [Recommendations UI](https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/recommendation/recommendation-panel.tsx): `frontend/src/app/recommendation/recommendation-panel.tsx`
- [UV experience](https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/uv-map/page.tsx): `frontend/src/app/uv-map/page.tsx`
- [Daily Health UI](https://github.com/pacharaponk/aphrodize/blob/main/frontend/src/app/clients/daily-health-dashboard.tsx): `frontend/src/app/clients/daily-health-dashboard.tsx`

### API and workflows

- [FastAPI application](https://github.com/pacharaponk/aphrodize/blob/main/backend/main.py): `backend/main.py`
- [Versioned API router](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/router.py): `backend/api/v1/router.py`
- [Accounts and consent](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/auth.py): `backend/api/v1/routes/auth.py`
- [Image analysis routes](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/analyses.py): `backend/api/v1/routes/analyses.py`
- [Generic inference route](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/inference.py): `backend/api/v1/routes/inference.py`
- [Product catalog routes](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/products.py): `backend/api/v1/routes/products.py`
- [UV routes](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/uv.py): `backend/api/v1/routes/uv.py`
- [Analysis workflow](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/analysis_service.py): `backend/services/analysis_service.py`
- [Inference enqueue](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/inference_service.py): `backend/services/inference_service.py`
- [UV services](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/uv_service.py): `backend/services/uv_service.py`
- [UV map service](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/uv_map_service.py): `backend/services/uv_map_service.py`

### Image inference

- [Inference worker](https://github.com/pacharaponk/aphrodize/blob/main/backend/workers/inference_worker.py): `backend/workers/inference_worker.py`
- [Wrinkle orchestration](https://github.com/pacharaponk/aphrodize/blob/main/backend/wrinkle/service.py): `backend/wrinkle/service.py`
- [Prediction pipeline](https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/prediction.py): `ai/ffhq_wrinkle/prediction.py`
- [Model loading](https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/modeling.py): `ai/ffhq_wrinkle/modeling.py`
- [Segmentation models](https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/official/inference.py): `ai/ffhq_wrinkle/official/inference.py`
- [Confidence policy](https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/confidence.py): `ai/ffhq_wrinkle/confidence.py`
- [Wrinkle scoring](https://github.com/pacharaponk/aphrodize/blob/main/ai/ffhq_wrinkle/scoring.py): `ai/ffhq_wrinkle/scoring.py`

### Platform services

- [Application database](https://github.com/pacharaponk/aphrodize/blob/main/backend/core/db/models.py): `backend/core/db/models.py`
- [Private object storage](https://github.com/pacharaponk/aphrodize/blob/main/backend/libs/minio_client.py): `backend/libs/minio_client.py`
- [ARQ job queues](https://github.com/pacharaponk/aphrodize/blob/main/backend/libs/redis_client.py): `backend/libs/redis_client.py`
- [Annotation workflow](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/annotation_service.py): `backend/services/annotation_service.py`

### Daily Health

- [Daily Health routes](https://github.com/pacharaponk/aphrodize/blob/main/backend/api/v1/routes/daily_health.py): `backend/api/v1/routes/daily_health.py`
- [Daily Health services](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/daily_health_dataset.py): `backend/services/daily_health_dataset.py`
- [Daily Health training](https://github.com/pacharaponk/aphrodize/blob/main/backend/services/daily_health_training.py): `backend/services/daily_health_training.py`

### Other components

- **User**
- **Label Studio**

## Connections

- User → Image capture: submits photo
- Image capture → Web API routes: sends analysis
- Web API routes → Image analysis routes: calls API
- Image analysis routes → Analysis workflow: creates analysis
- Analysis workflow → Application database: stores workflow (evidence: `backend/services/analysis_service.py`)
- Analysis workflow → Private object storage: reads and writes (evidence: `backend/services/analysis_service.py`)
- Analysis workflow → ARQ job queues: queues job (evidence: `backend/services/analysis_service.py`)
- ARQ job queues → Inference worker: dispatches job (evidence: `backend/workers/inference_worker.py`)
- Inference worker → Application database: loads and saves (evidence: `backend/workers/inference_worker.py`)
- Inference worker → Private object storage: loads image (evidence: `backend/workers/inference_worker.py`)
- Inference worker → Wrinkle orchestration: runs analysis (evidence: `backend/workers/inference_worker.py`)
- Wrinkle orchestration → Prediction pipeline: predicts image (evidence: `backend/wrinkle/service.py`)
- Wrinkle orchestration → Confidence policy: applies policy (evidence: `backend/wrinkle/service.py`)
- Wrinkle orchestration → Wrinkle scoring: scores output (evidence: `backend/wrinkle/service.py`)
- Prediction pipeline → Model loading: loads model (evidence: `ai/ffhq_wrinkle/prediction.py`)
- Model loading → Segmentation models: constructs network (evidence: `ai/ffhq_wrinkle/modeling.py`)
- Inference worker → Private object storage: stores artifacts (evidence: `backend/workers/inference_worker.py`)
- Inference worker → Annotation workflow: stages review (evidence: `backend/workers/inference_worker.py`)
- Annotation workflow → Label Studio: publishes tasks (evidence: `backend/services/annotation_service.py`)
- Image analysis routes → Analysis results: returns analysis
- User → Accounts and consent: creates account
- FastAPI application → Versioned API router: mounts routes (evidence: `backend/main.py`)
- Versioned API router → Accounts and consent: registers routes (evidence: `backend/api/v1/router.py`)
- Versioned API router → Image analysis routes: registers routes (evidence: `backend/api/v1/router.py`)
- Versioned API router → Generic inference route: registers routes (evidence: `backend/api/v1/router.py`)
- Versioned API router → Daily Health routes: registers routes (evidence: `backend/api/v1/router.py`)
- Versioned API router → Product catalog routes: registers routes (evidence: `backend/api/v1/router.py`)
- Versioned API router → UV routes: registers routes (evidence: `backend/api/v1/router.py`)
- Generic inference route → Inference enqueue: creates run (evidence: `backend/api/v1/routes/inference.py`)
- Inference enqueue → Application database: persists run (evidence: `backend/services/inference_service.py`)
- Inference enqueue → ARQ job queues: enqueues job (evidence: `backend/services/inference_service.py`)
- User → Daily Health UI: tracks health
- Daily Health UI → Daily Health routes: requests data
- Daily Health routes → Daily Health services: uses services
- Daily Health training → Application database: records training
- User → Recommendations UI: views products
- Recommendations UI → Product catalog routes: requests catalog
- User → UV experience: views UV
- UV experience → UV routes: requests UV data
- UV routes → UV services: uses service
- UV routes → UV map service: uses map service
