# huda770/beautilyze architecture

> Architecture diagram of the GitHub repository huda770/beautilyze, 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/huda770/beautilyze
- Repository: https://github.com/huda770/beautilyze

## Overview

Beautilyze is a mobile skincare-analysis and routine-recommendation product backed by a Flask API. The main flow is a user choosing goals, categories and allergy exclusions, submitting a photo for skin-type estimation, then receiving explanations and a filtered routine. Accounts and model-development capabilities are separate branches. Edges reflect the README and shown imports/calls; unsampled mobile-to-API wiring is documented but not shown in excerpts, so those connections are marked unverified.

Main entry points: [`backend/app.py`](https://github.com/huda770/beautilyze/blob/main/backend/app.py) (Flask API), [`mobile/src/state/app-state.tsx`](https://github.com/huda770/beautilyze/blob/main/mobile/src/state/app-state.tsx) (Session state), [`backend/model_config.py`](https://github.com/huda770/beautilyze/blob/main/backend/model_config.py) (Model configuration), [`mobile/src/app/(tabs)/analyze.tsx`](https://github.com/huda770/beautilyze/blob/main/mobile/src/app/(tabs)/analyze.tsx) (Analyze screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_analyze["Analyze screen<br/>[analyze.tsx]"]
  node_profile["Profile screen<br/>[profile.tsx]"]
  node_report["Analysis report<br/>[report.tsx]"]
  node_routine_screen["Routine views<br/>[routine.tsx]"]
  node_app_state["Session state<br/>[app-state.tsx]"]
  node_api_config["API configuration<br/>[api.ts]"]
end

subgraph group_api["API and analysis"]
  node_flask["Flask API<br/>[app.py]"]
  node_face_check["Face validation<br/>[app.py]"]
  node_skin_classifier["Skin classifier<br/>[app.py]"]
  node_explanations["Result explanations<br/>[explanations.py]"]
end

subgraph group_recommendation["Recommendations"]
  node_recommend_engine["Routine ranking<br/>[recommend.py]"]
  node_product_catalogue["Product catalogue<br/>[products.py]"]
  node_product_db[("SQLite products<br/>[recommend.py]")]
  node_logic_data["Recommendation logic<br/>[RecLogic.csv]"]
end

subgraph group_accounts["Accounts"]
  node_auth_api["Authentication routes<br/>[accounts.py]"]
  node_account_db[("Accounts and sessions<br/>[accounts.py]")]
end

subgraph group_model["Model lifecycle"]
  node_model_config["Model configuration<br/>[model_config.py]"]
  node_training["Model training<br/>[train.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
  node_verification["Checkpoint verification<br/>[verify_model.py]"]
end

node_user(("User"))

node_user -->|"selects goals"| node_analyze
node_user -->|"manages account"| node_profile
node_analyze -.->|"stores options"| node_app_state
node_profile -.->|"sets preferences"| node_app_state
node_analyze -.->|"submits analysis"| node_api_config
node_api_config -.->|"targets API"| node_flask
node_flask -->|"validates photo"| node_face_check
node_flask -->|"classifies image"| node_skin_classifier
node_flask -->|"builds routine"| node_recommend_engine
node_flask -->|"gets explanations"| node_explanations
node_recommend_engine -->|"reads products"| node_product_db
node_recommend_engine -->|"reads ingredient rules"| node_logic_data
node_flask -->|"seeds catalogue"| node_product_catalogue
node_product_catalogue -->|"supplies catalogue"| node_product_db
node_flask -.->|"returns results"| node_report
node_report -.->|"updates session"| node_app_state
node_routine_screen -.->|"reads routine"| node_app_state
node_profile -.->|"uses account routes"| node_auth_api
node_auth_api -->|"reads and writes"| node_account_db
node_skin_classifier -.->|"uses classifier setup"| node_model_config
node_training -->|"uses shared setup"| node_model_config
node_evaluation -->|"uses shared setup"| node_model_config
node_verification -->|"checks checkpoint"| node_model_config

click node_analyze "https://github.com/huda770/beautilyze/blob/main/mobile/src/app/(tabs)/analyze.tsx"
click node_profile "https://github.com/huda770/beautilyze/blob/main/mobile/src/app/(tabs)/profile.tsx"
click node_report "https://github.com/huda770/beautilyze/blob/main/mobile/src/app/report.tsx"
click node_routine_screen "https://github.com/huda770/beautilyze/blob/main/mobile/src/app/(tabs)/routine.tsx"
click node_app_state "https://github.com/huda770/beautilyze/blob/main/mobile/src/state/app-state.tsx"
click node_api_config "https://github.com/huda770/beautilyze/blob/main/mobile/src/constants/api.ts"
click node_flask "https://github.com/huda770/beautilyze/blob/main/backend/app.py"
click node_face_check "https://github.com/huda770/beautilyze/blob/main/backend/app.py"
click node_skin_classifier "https://github.com/huda770/beautilyze/blob/main/backend/app.py"
click node_explanations "https://github.com/huda770/beautilyze/blob/main/backend/explanations.py"
click node_recommend_engine "https://github.com/huda770/beautilyze/blob/main/backend/recommend.py"
click node_product_catalogue "https://github.com/huda770/beautilyze/blob/main/backend/products.py"
click node_product_db "https://github.com/huda770/beautilyze/blob/main/backend/recommend.py"
click node_logic_data "https://github.com/huda770/beautilyze/blob/main/backend/RecLogic.csv"
click node_auth_api "https://github.com/huda770/beautilyze/blob/main/backend/accounts.py"
click node_account_db "https://github.com/huda770/beautilyze/blob/main/backend/accounts.py"
click node_model_config "https://github.com/huda770/beautilyze/blob/main/backend/model_config.py"
click node_training "https://github.com/huda770/beautilyze/blob/main/backend/train.py"
click node_evaluation "https://github.com/huda770/beautilyze/blob/main/backend/evaluate.py"
click node_verification "https://github.com/huda770/beautilyze/blob/main/backend/verify_model.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_analyze,node_profile,node_report,node_routine_screen,node_app_state,node_api_config,node_user toneBlue
class node_flask,node_face_check,node_skin_classifier,node_explanations toneAmber
class node_recommend_engine,node_product_catalogue,node_product_db,node_logic_data toneMint
class node_auth_api,node_account_db toneRose
class node_model_config,node_training,node_evaluation,node_verification toneIndigo
```

## Components

### Mobile app

- [Analyze screen](https://github.com/huda770/beautilyze/blob/main/mobile/src/app/(tabs)/analyze.tsx): `mobile/src/app/(tabs)/analyze.tsx`
- [Profile screen](https://github.com/huda770/beautilyze/blob/main/mobile/src/app/(tabs)/profile.tsx): `mobile/src/app/(tabs)/profile.tsx`
- [Analysis report](https://github.com/huda770/beautilyze/blob/main/mobile/src/app/report.tsx): `mobile/src/app/report.tsx`
- [Routine views](https://github.com/huda770/beautilyze/blob/main/mobile/src/app/(tabs)/routine.tsx): `mobile/src/app/(tabs)/routine.tsx`
- [Session state](https://github.com/huda770/beautilyze/blob/main/mobile/src/state/app-state.tsx): `mobile/src/state/app-state.tsx`
- [API configuration](https://github.com/huda770/beautilyze/blob/main/mobile/src/constants/api.ts): `mobile/src/constants/api.ts`

### API and analysis

- [Flask API](https://github.com/huda770/beautilyze/blob/main/backend/app.py): `backend/app.py`
- [Face validation](https://github.com/huda770/beautilyze/blob/main/backend/app.py): `backend/app.py`
- [Skin classifier](https://github.com/huda770/beautilyze/blob/main/backend/app.py): `backend/app.py`
- [Result explanations](https://github.com/huda770/beautilyze/blob/main/backend/explanations.py): `backend/explanations.py`

### Recommendations

- [Routine ranking](https://github.com/huda770/beautilyze/blob/main/backend/recommend.py): `backend/recommend.py`
- [Product catalogue](https://github.com/huda770/beautilyze/blob/main/backend/products.py): `backend/products.py`
- [SQLite products](https://github.com/huda770/beautilyze/blob/main/backend/recommend.py): `backend/recommend.py`
- [Recommendation logic](https://github.com/huda770/beautilyze/blob/main/backend/RecLogic.csv): `backend/RecLogic.csv`

### Accounts

- [Authentication routes](https://github.com/huda770/beautilyze/blob/main/backend/accounts.py): `backend/accounts.py`
- [Accounts and sessions](https://github.com/huda770/beautilyze/blob/main/backend/accounts.py): `backend/accounts.py`

### Model lifecycle

- [Model configuration](https://github.com/huda770/beautilyze/blob/main/backend/model_config.py): `backend/model_config.py`
- [Model training](https://github.com/huda770/beautilyze/blob/main/backend/train.py): `backend/train.py`
- [Model evaluation](https://github.com/huda770/beautilyze/blob/main/backend/evaluate.py): `backend/evaluate.py`
- [Checkpoint verification](https://github.com/huda770/beautilyze/blob/main/backend/verify_model.py): `backend/verify_model.py`

### Other components

- **User**

## Connections

- User → Analyze screen: selects goals
- User → Profile screen: manages account
- Analyze screen → Session state: stores options
- Profile screen → Session state: sets preferences
- Analyze screen → API configuration: submits analysis
- API configuration → Flask API: targets API
- Flask API → Face validation: validates photo (evidence: `backend/app.py`)
- Flask API → Skin classifier: classifies image (evidence: `backend/app.py`)
- Flask API → Routine ranking: builds routine (evidence: `backend/app.py`)
- Flask API → Result explanations: gets explanations (evidence: `backend/app.py`)
- Routine ranking → SQLite products: reads products (evidence: `backend/recommend.py`)
- Routine ranking → Recommendation logic: reads ingredient rules (evidence: `backend/recommend.py`)
- Flask API → Product catalogue: seeds catalogue (evidence: `backend/app.py`)
- Product catalogue → SQLite products: supplies catalogue (evidence: `backend/products.py`)
- Flask API → Analysis report: returns results
- Analysis report → Session state: updates session
- Routine views → Session state: reads routine
- Profile screen → Authentication routes: uses account routes
- Authentication routes → Accounts and sessions: reads and writes (evidence: `backend/accounts.py`)
- Skin classifier → Model configuration: uses classifier setup
- Model training → Model configuration: uses shared setup (evidence: `backend/train.py`)
- Model evaluation → Model configuration: uses shared setup (evidence: `backend/evaluate.py`)
- Checkpoint verification → Model configuration: checks checkpoint (evidence: `backend/verify_model.py`)
