How gopikrishnan20/skinchapters works
Purpose and System Shape
SkinChapters is a skincare-analysis platform: users scan skin, backend ML classifies skin type and conditions, and the system produces personalized AM/PM routines and product-oriented “chapters.” It is split into a Vite/React frontend and a Python backend with bundled trained model artifacts.
Frontend Entry and Application Shell
The client boots from frontend/src/main.tsx into the application root at frontend/src/App.tsx. It presents a multi-page user journey spanning marketing, authentication, scan/upload, analysis results, dashboard, profile, and curated chapters.
• frontend/src/main.tsx
• frontend/src/App.tsx
• frontend/src/pages/ScanPage.tsx
User Journey and Presentation Pages
The primary control flow is: landing/onboarding → sign-in/up → protected user experiences → scan → analysis/results → dashboard and recommendations. Scan and analysis-specific screens are distinct from general product discovery and account pages.
• frontend/src/pages/Index.tsx
• frontend/src/pages/SkinAnalysisPage.tsx
• frontend/src/pages/ResultsDashboardPage.tsx
• frontend/src/pages/ChaptersPage.tsx
Client Service Boundary
Frontend analysis requests are centralized in a service layer rather than embedded in page components, forming the browser-to-backend boundary. Authentication state and route access are handled separately through an auth context and protected-route wrapper.
• frontend/src/services/skinAnalysisService.ts
• frontend/src/services/AuthContext.js
• frontend/src/services/ProtectedRoute.tsx
Authentication Infrastructure
The frontend includes Firebase configuration, indicating Firebase is the material identity/authentication dependency. Backend analysis services appear logically separate from Firebase-managed client identity; the available tree does not establish server-side Firebase verification.
• frontend/src/lib/firebaseConfig.ts
• frontend/src/services/AuthContext.js
• frontend/src/pages/SignInPage.tsx
Backend API and Analysis Orchestration
The Python backend’s API entry point is backend/app/main.py. It likely receives scan input, invokes classification and utility processing, then delegates personalized routine construction. This is the core inference/request boundary between browser data and local ML assets.
• backend/app/main.py
• backend/app/utils.py
• backend/app/routine_generator.py
ML Inference Assets and Recommendation Output
Two persisted .h5 models separate skin-type prediction from skin-condition prediction. Their outputs are the inputs to routine generation, which should convert classifications into morning/night recommendations. Label CSVs provide class mapping for at least the condition model.
• backend/models/skin_type_model.h5
• backend/models/skin_condition_model.h5
• backend/data/skin_condition/skin_condition_labels.csv
• backend/app/routine_generator.py
Model Lifecycle and Data Boundary
Training is kept outside runtime application code. Separate training scripts consume local skin-type and skin-condition datasets and produce/update model artifacts used by the API. No hosted database, queue, or external model-serving infrastructure is evident in the repository tree.
• backend/training/train_skin_type.py
• backend/training/train_skin_condition.py
• backend/data/skin_type
• backend/data/skin_condition
Main entry points: main.py Analysis API · App.tsx Application shell · skin_condition_model.h5 Skin condition model · AuthContext.js Auth state and route guard
Components 18
React client
- Client bootstrap
frontend/src/main.tsx - Application shell
frontend/src/App.tsx - Onboarding and discovery · Landing, analysis, dashboard, and chapters experiences.
frontend/src/pages/Index.tsx - Skin scan upload
frontend/src/pages/ScanPage.tsx - Results dashboard
frontend/src/pages/ResultsDashboardPage.tsx - Analysis API client
frontend/src/services/skinAnalysisService.ts - Auth state and route guard
frontend/src/services/AuthContext.js - Firebase authentication
frontend/src/lib/firebaseConfig.ts
Python analysis API
- Analysis API · Receives scans and orchestrates inference and recommendations.
backend/app/main.py - Image and analysis utilities
backend/app/utils.py - Routine generator · Builds AM/PM routines from predicted skin attributes.
backend/app/routine_generator.py
ML lifecycle
- Skin type model
backend/models/skin_type_model.h5 - Skin condition model
backend/models/skin_condition_model.h5 - Condition labels
backend/data/skin_condition/skin_condition_labels.csv - Skin type training · Trains the skin-type artifact from local data.
backend/training/train_skin_type.py - Condition training · Trains the condition artifact from local data.
backend/training/train_skin_condition.py - Skin type dataset
backend/data/skin_type - Skin condition dataset
backend/data/skin_condition
Connections 19
- Client bootstrap → Application shell: mounts
- Application shell → Onboarding and discovery: routes
- Application shell → Skin scan upload: routes
- Application shell → Results dashboard: routes
- Auth state and route guard → Onboarding and discovery: protects user routes
- Auth state and route guard → Firebase authentication: uses identity
- Skin scan upload → Analysis API client: submits scan
- Analysis API client → Analysis API: analysis request
- Analysis API → Image and analysis utilities: processes input
- Analysis API → Skin type model: runs inference
- Analysis API → Skin condition model: runs inference
- Analysis API → Routine generator: passes classifications
- Skin condition model → Condition labels: maps classes
- Routine generator → Results dashboard: recommendations response
- Skin type dataset → Skin type training: training input
- Skin type training → Skin type model: produces
- Skin condition dataset → Condition training: training input
- Condition training → Skin condition model: produces
- Skin condition dataset → Condition labels: defines classes