YouCam API Skin AI & Apparel VTO Hackathon · Track 1 — Skin AI · Consumer skincare intelligence from selfie scan to routine, coach, and progress
Landing at / with Live status (demo vs live scan) · Privacy /privacy · Terms /terms
Sign up /signup · Log in /login · JWT session cookie (HTTP-only, 7-day TTL)
sessionStorage caches the latest scan for fast UI; Neon is the source of truth via GET /api/skinova/scans. Middleware blocks unauthenticated routes.
/api/auth/signup · login · logout · session — bcrypt passwords, JWT cookies via jose
run-skin-scan.ts → youcam.ts · validate image · file metadata · presigned upload · task create · poll · normalize ui_score → AnalysisResult
coach-scope guard → rag.ts hybrid retrieval → coach-llm.ts Qwen call → coach-validator · conversation history from Neon
run-personalization.ts (Fitzpatrick, skin tone, face analyzer) · run-skin-simulation.ts → poll · save to user_simulation_results
/api/skinova/scan · scan-status · simulation · simulation-status · coach · routine · scans · health · reset
scripts/ingest-knowledge.mjs embeds content/knowledge/skincare.json (38 chunks) into pgvector via DashScope text-embedding-v4
API_KEY, QWEN_API_KEY, DATABASE_URL server-only · never exposed to browser bundles · middleware.ts protects app routes
Primary scan flow — file metadata, presigned upload, task create, poll, ui_score normalization
Fitzpatrick Scale · Skin Tone · Face Analyzer — post-scan enrichment on Results
Progress page before/after preview — POST /api/skinova/simulation → poll → Neon user_simulation_results
Live when API_KEY set & SKINOVA_DEMO_MODE=false · Demo mock when credentials absent
Skin Coach replies — grounded system prompt (skinova-coach-qwen-v2) · temperature 0.2 · scan + RAG context in prompt
1536-dim embeddings for knowledge chunk retrieval and ingest (npm run knowledge:ingest)
Live AI when QWEN_API_KEY configured · Guided rule-based fallback if API unavailable
Account records — name, email, bcrypt password hash · created via signup
Skinova curated skincare knowledge (38 chunks) · vector(1536) hybrid RAG · per-user coach thread history
Scan history (preview_image_url, sample_id, analysis JSON) and AI/template routines — hydrated into session on return
Simulation preview URLs per scan · in-flight YouCam file IDs for re-simulation
Real YouCam tasks — file metadata, presigned upload, async poll, live ui_score normalization.
Representative mock analysis when SKINOVA_DEMO_MODE=true or no API_KEY — no units consumed.
Scope guard → hybrid RAG (vector + topic boost) → Qwen → validator. Answers cite knowledge + scan context only.
Deterministic education templates when Qwen is not configured or API errors occur.
Latest analysis in sessionStorage — powers Results, Routine, Coach personalization, Progress trends.
public/samples/ YouCam playground selfies · public/screenshots/ submission captures · brand assets.
POST /api/auth/signup|login → Neon users → HTTP-only JWT session cookie → middleware allows /dashboard, /scan, etc.POST /api/skinova/scan → YouCam file API + presigned PUT + task create → client polls GET /api/skinova/scan-status/[taskId] → Fitzpatrick + skin tone + face analyzer enrichment → AnalysisResult saved to Neon user_scans (with preview_image_url / sample_id) + sessionStorage → Results / Routine / Coach / Progress.POST /api/skinova/simulation → YouCam simulation task → poll GET /api/skinova/simulation-status/[taskId] → before/after preview saved to user_simulation_results.POST /api/skinova/coach with message + scan context → scope guard → embed query (Qwen) → retrieve knowledge_chunks (pgvector + topic boost) → Qwen chat completion with grounded prompt → validate → store in coach_messages → JSON answer to UI.GET /api/skinova/health reports mode (live/demo), scanReady, and coachReady without exposing secrets.content/knowledge/skincare.json → npm run knowledge:ingest -- --force → re-embed all chunks into Neon.DATABASE_URL, AUTH_SECRET, API_KEY, QWEN_API_KEY.app/components/* — scan-experience, results-experience, progress-experience, skin-simulation-panel, coach-experience, landing-live-status, app-shellapp/lib/youcam.ts · run-skin-scan.ts · run-personalization.ts · scan-session.ts · scan-steps.tsrun-skin-simulation.ts · simulation-db.ts · use-skin-simulation.tscoach-service.ts · coach-llm.ts · coach-contract.ts · coach-scope.ts · rag.ts · embeddings.tsdb.ts · auth.ts · scan-db.ts · simulation-db.ts · routine-db.ts · knowledge-db.tsscripts/setup-and-run.sh · youcam-smoke-test.mjs · coach-smoke-test.mjs · ingest-knowledge.mjs