停止猜測,開始聰明穿搭。AI 目錄化你的衣櫥,打造每日穿搭,規劃旅行打包,並提供專業造型建議——根據你擁有的服飾。
AI 翻譯
Stop guessing, start dressing smart. AI catalogues your wardrobe, builds daily outfits, plans travel packing, and gives expert styling advice — from clothes you own.
生活風格Python · TypeScriptGitHub @phanidhar09上線中營運者未確認
試用過了嗎? 點一下就好,不需要登入。
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證ClozeHive — 衣櫥智慧平台:數位衣櫃,FANI AI 造型師(LangGraph 代理 + MCP 工具),RAG 洞察搭配 pgvector,視覺管線,旅行打包。React + FastAPI 微服務。
AI 翻譯
ClozeHive — wardrobe intelligence platform: digital closet, FANI AI stylist (LangGraph agent + MCP tools), RAG insights with pgvector, vision pipeline, travel packing. React + FastAPI microservices.
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
A digital closet that thinks — outfit building, AI styling, travel packing, wear analytics, and RAG-grounded insights built on top of your own items and history.
1. Overview
2. Meet FANI
3. Feature highlights
4. Architecture
5. Core workflows
6. Service responsibilities
7. Domain map (api-gateway)
8. Technology stack
9. Quick start (Docker)
10. Local setup without Docker
11. Configuration
12. API surface (v1)
13. Testing & quality
14. Operations & health
15. Frontend routes
16. Documentation檢視完整 README ↗A digital closet that thinks — outfit building, AI styling, travel packing, wear analytics, and RAG-grounded insights built on top of your own items and history.
Launch the app → • Marketing site • Repository
ClozeHive is a wardrobe intelligence platform. Users build a digital closet, compose and save outfits, get AI-driven styling and packing help, and track how they actually wear their clothes over time. Every recommendation is grounded in the user's real items and history through a retrieval-augmented (RAG) pipeline backed by vector search.
The system is a domain-driven architecture:
Full environment, migration, GCP, and deployment detail lives in docs/ENVIRONMENT.md, docs/SERVICES.md, and docs/RUNBOOK.md. AI agents should read AGENTS.md for the operational contract.
FANI — Fashion AI Nurturing Individuality — is ClozeHive's built-in AI stylist. FANI powers outfit recommendations, the daily Tip of the Day, wardrobe-gap detection, conversational styling, travel packing, and Shop with FANI purchase advice.
The primary stylist experience is the full-screen chat at /ai-stylist (persisted sessions, structured outfit cards, closet context). The dashboard surfaces FANI nudges and Tip of the Day.
Outfit suggestions carry a 5-tier FANI rating — Needs Improvement → Average → Good → Excellent → Best Fit — each with a star count, a color badge, and a short stylist note.
| Area | What you get |
|---|---|
| Home | Daily FANI Tip of the Day (day-of-week rotation), Style at a Glance (Most Worn / Never Worn / Closet Gaps), quick-action grid, and Outfit of the Day with a 5-tier FANI rating. |
| Style onboarding | Guided style-profile flow (/onboarding/style-profile) that feeds FANI personalization and RAG context. |
| Closet | Full item CRUD with rich metadata, image storage (local disk or GCS), preview/confirm upload flows, similar-item search, availability flags, and AI background removal. |
| Closet match | Find items in your closet that pair with a reference piece (/closet-match). |
| Smart ingest | Upload a photo (incl. HEIC) → detection → background removal → structured item metadata, all in-process in the gateway. Bulk smart-ingest sessions for multi-photo review. |
| Outfits | Outfit builder, saved looks, outfit history (feeds RAG), and weekly planner with weather-aware day plans. |
| FANI AI Stylist | Structured stylist chat at /ai-stylist with SSE streaming, persisted history, and handoff from dashboard nudges. |
| Travel | Trips, weather-aware packing lists, packing-memory APIs, occasion planning, and FANI/agent packing tools. |
| Shop with FANI | Upload an in-store photo or paste a product URL → closet match, buy/skip verdict, outfit ideas, and optional add-to-closet (SSRF-guarded URL fetch). |
| Intelligence (RAG) | Fashion knowledge, closet similarity, purchase-gap detection, and a unified /rag/* surface backed by pgvector embeddings. |
| Analytics | Wear events (append-only), cost-per-wear, utilization, forgotten gems, and versatility scoring. |
| Profile & Settings | Display name, location & weather, FANI preferences, avatar, and privacy; navbar dropdown for Saved Outfits, Closet Insights, and Wardrobe Gaps. |
| Real-time | WebSocket notifications at /api/v1/ws (toast UI in the app shell). |
ClozeHive runs in two topologies that share one codebase. The gateway is the single owner of the wardrobe and intelligence domains and runs the vision pipeline in-process in both.
The frontend calls the gateway directly (VITE_API_URL). There is no nginx; the gateway serves the entire /api/v1 surface with SERVE_MIGRATED_DOMAIN_ROUTES=true and runs all AI in-process.
flowchart LR
B[Browser SPA] -->|VITE_API_URL| GW[api-gateway :8000<br/>full /api/v1 surface<br/>+ in-process vision + AI]
GW -->|OpenAI / Gemini| LLM[LLM providers]
GW --> PG[(PostgreSQL + pgvector<br/>identity · wardrobe · embeddings)]
GW --> R[(Redis<br/>cache)]
GW --> RS[(redis-state<br/>OAuth · refresh · rate-limit)]
GW --> GCS[(GCS / uploads)]
docker compose up --build)The same services behind nginx. Vision and AI still run in-process inside the gateway, matching production.
flowchart TB
subgraph client [Client]
U[User Browser]
end
subgraph edge [Edge]
N["nginx :80 — single entrypoint"]
FE["frontend (Vite SPA)"]
end
subgraph app [Application]
GW["api-gateway :8000<br/>identity · wardrobe · intelligence · travel · platform<br/>+ in-process vision: analyze · smart-ingest · bg-removal<br/>+ in-process AI: chat · outfit · packing"]
end
subgraph state [State & Storage]
PG[(PostgreSQL + pgvector)]
RD[(Redis — cache)]
RS[(redis-state — sessions/OAuth/rate-limit)]
UP[(uploads volume / GCS)]
MP[mailpit — dev mail]
end
subgraph optional [Optional]
MIG["migrate (one-shot) — alembic upgrade head"]
end
U --> N
N -->|/| FE
N -->|/api/v1/* incl. vision & uploads| GW
N -->|/api/v1/ws upgrade| GW
GW --> PG & RD & RS & UP
GW -->|OpenAI / Gemini| LLM[LLM providers]
MIG --> PG
Key wiring
| Flow | How it works |
|---|---|
| Browser → API | SPA uses relative /api/v1; nginx (local) or the gateway directly (prod) handles all /api paths. |
| Auth & app data | The gateway owns auth/session and all core business routes, backed by Postgres + Redis. |
| Real-time | Browser WebSocket connects to /api/v1/ws; nginx upgrades and forwards to the gateway hub. |
| FANI chat / outfit / packing | Gateway assembles user + closet + RAG context and runs the model in-process (OpenAI/Gemini) behind the grounding gate + semantic cache. |
| Vision & embeddings | Detection, background removal, and embedding updates run in-process in the gateway (wardrobe domain). |
| Shopping check & RAG retrieval | Gateway in-process services + pgvector. |
| Shared state | Single Postgres DB for everything; Redis cache + redis-state for OAuth, refresh tokens, rate limits. |
What runs where
| Capability | Owner |
|---|---|
| Auth, profile, trips, analytics, WebSocket | api-gateway |
| Closet, outfits, planner, vision, embeddings | api-gateway (in-process) |
| FANI chat, outfit generation, packing lists | api-gateway (in-process, OpenAI/Gemini) |
| Shop with FANI, purchase gaps, fashion RAG | api-gateway + pgvector |
History: standalone
closet-service(:8003),vision-service(:8002), and theai-agent(:8001) +ai-worker(ARQ) services were all retired — the gateway already carried those routers and prod served them in-process, and the AI now runs in-process against OpenAI/Gemini. The wardrobe domain, vision pipeline, and all AI now live only in the api-gateway.
End-to-end paths (see docs/SERVICES.md for sequence diagrams):
POST /analyze-vision/stream (SSE per item) → user confirms → POST /save-analyzed-items → closet rows + background embedding update.POST /ai-chat/stream → gateway builds closet/RAG/style context → in-process model-routed completion (OpenAI/Gemini) behind the grounding gate → SSE tokens to browser.packing_service, closet-grounded; live OpenWeather forecast with static fallback) → packing-memory improves future lists.POST /shopping/check) or URL (POST /shopping/check-url) → closet similarity + buy/skip score → optional outfit ideas and add-to-closet./planner/*, backed by closet items and forecasts.| Service | Role |
|---|---|
frontend | React + Vite + TypeScript SPA. In Docker, host port defaults to 3001 → container 3000 (FRONTEND_HOST_PORT). Sentry + web-vitals RUM. |
nginx | Local only. Single entry on :80 — serves the SPA and proxies API, vision paths, uploads, and WebSocket upgrades to the gateway. |
services/api-gateway | The product backend. Owns identity, wardrobe, intelligence, travel, and platform domains; runs the vision pipeline and all FANI AI (chat/outfit/packing) in-process against OpenAI/Gemini; hosts the WebSocket notification hub. |
services/mcp/* | Optional/legacy MCP HTTP/SSE servers, not part of the default stack. |
infra/ | Postgres init, nginx config, GCP, and observability assets. |
mailpit | Dev-only SMTP catcher (:8025 UI) for password-reset emails. |
The gateway's API is organized into cohesive domains under services/api-gateway/app/api/v1/:
| Domain | Routers | Mounting |
|---|---|---|
| identity | auth, profile | Always |
| travel | weather; trips, packing_memory | weather always; trips when migrated* |
| platform | health, admin, ws, rum; analytics | health/ws always; analytics when migrated* |
| wardrobe | closet, closet_similarity, outfits, outfit_history, planner, smart_ingest, vision_pipeline | Migrated* |
| intelligence | ai, ai_chat, rag, fashion_rag, purchase_gaps, shopping_check, jobs | Migrated* |
| social | social | Phase 2 (not mounted; Groups page is a frontend stub) |
* Migrated domains mount when mount_migrated_routes is true — dev/test by default, and production via the explicit SERVE_MIGRATED_DOMAIN_ROUTES=true interlock in render.yaml.
| Layer | Choices |
|---|---|
| Frontend | React 18, Vite, TypeScript, Tailwind CSS, Zustand, Framer Motion; Vitest + Testing Library + Playwright (e2e). |
| Backend | Python 3.12, FastAPI, Pydantic, SQLAlchemy (async), Alembic. |
| AI / ML | In-process FANI (OpenAI + Gemini), RAG over pgvector embeddings, grounding gate + semantic cache. |
| Data & state | PostgreSQL + pgvector (single DB), Redis cache + redis-state (OAuth, refresh, rate limits). |
| Edge & infra | nginx (local edge), Docker Compose, Render (production), GCS for image storage, Mailpit for dev mail. |
| Observability | Prometheus /metrics, Sentry (frontend + backend), RUM via /api/v1/rum, optional LangSmith tracing. |
| Quality | pytest (domain-organized), Ruff, mypy, ESLint, GitHub Actions CI. |
# 1. Configure secrets
cp .env.example .env # then fill in keys (OpenAI, JWT, Google OAuth, …)
# 2. Start the stack (postgres, redis, redis-state, api-gateway,
# frontend, nginx, mailpit, + one-shot migrate)
make up # or: docker compose up --build [-d]
# 3. Verify
make health
The one-shot migrate service runs Alembic on startup, so the schema is applied automatically. Re-apply manually any time with make migrate.
| What | URL |
|---|---|
| Recommended entry (nginx) | http://localhost |
| Frontend (direct container map) | http://localhost:3001 (FRONTEND_HOST_PORT) |
| API gateway (direct) | http://localhost:8000 — /live, /ready, /health, /docs |
| OpenAPI / Swagger | http://localhost:8000/docs |
| Mailpit (dev mail UI) | http://localhost:8025 |
Ports: Postgres maps 5433 → 5432 and Redis 6382 → 6379 on the host by default (see
.env.example).redis-stateuses 6383.CORS:
ALLOWED_ORIGINSmust include the exact origin users open (e.g.http://localhostvshttp://localhost:3001).
You need PostgreSQL (with pgvector) and Redis, with matching DATABASE_URL / REDIS_URL / REDIS_STATE_URL.
npm --prefix frontend install
python3 -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r services/api-gateway/requirements-dev.txt
Run each process in its own terminal:
make dev-api # API gateway :8000 (includes in-process vision + AI)
make dev-frontend # Vite dev server :3000
Point VITE_API_URL at your gateway if the frontend origin differs from the API.
.env.example is the source of truth. The most commonly customized values:
| Variable | Notes |
|---|---|
OPENAI_API_KEY | Chat, embeddings, and most of the vision/analysis pipeline. |
GEMINI_API_KEY | Optional secondary provider for vision/analysis paths. |
JWT_SECRET | Strong random value in production (≥ 32 chars). |
DATABASE_URL | Postgres + pgvector; host dev often uses port 5433 per the example. |
REDIS_URL | Cache; host dev often uses 6382. |
REDIS_STATE_URL | Non-evictable Redis for OAuth state, refresh tokens, rate limits. |
INTERNAL_SERVICE_TOKEN | Shared secret for internal calls (e.g. account-data purge). |
ALLOWED_ORIGINS | Must list the real SPA origins. |
SERVE_MIGRATED_DOMAIN_ROUTES | Production interlock to mount wardrobe + intelligence domains. |
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET / GOOGLE_REDIRECT_URI | Google OAuth. |
GCS_BUCKET_NAME (+ credentials) | Cloud image storage (optional; falls back to local disk). |
VITE_API_URL / VITE_HIDE_NON_MVP | Frontend API origin and non-MVP feature gating. |
KAFKA_ENABLED | Optional event publishing (off by default; see docs/ENVIRONMENT.md). |
Never commit a real
.envor service-account JSON.
All routers mount under /api/v1 (services/api-gateway/app/api/v1/router.py):
/api/v1/ai-chat/*, SSE stream)/rag/*/api/v1/ws for notificationsBrowse the live, always-current contract at /docs (Swagger UI).
API gateway — pytest (SQLite/fakes for many suites), organized by domain under tests/:
cd services/api-gateway
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements-dev.txt
python3 -m pytest tests/ -v --tb=short
Frontend — Vitest + Testing Library:
cd frontend && npm ci && npm run test
From the repo root:
make test-api # gateway pytest
make test-frontend # Vitest
make test # both
make lint # ruff across Python services
Dependency audits:
npm audit --prefix frontend
pip install pip-audit && pip-audit -r services/api-gateway/requirements.txt
make help # all Makefile targets
make up # docker compose up -d --build
make stop # docker compose down (keep volumes)
make down-clean # confirm + down -v (DESTRUCTIVE)
make db-backup # dump Postgres before destructive ops
make logs # tail all service logs
make logs-api # tail gateway (also logs-agent, logs-worker)
make migrate # Alembic via the migrate container
make build-frontend # production Vite build
make smoke # compose validation + health
make health # container health checks
make clean # remove build artifacts
Gateway health endpoints:
| Endpoint | Meaning |
|---|---|
GET /live | Process is up. |
GET /ready | DB reachable (and Redis if REDIS_CHECK_ON_READY=true). |
GET /health | Aggregated JSON status. |
Production-oriented compose: see docker-compose.prod.yml and render.yaml; deploy/backup/restore/LetsEncrypt helpers live under scripts/.
OPENAI_API_KEY / GEMINI_API_KEY; restart api-gateway after changes. FANI runs in-process, so docker compose logs api-gateway has the AI traces.GEMINI_API_KEY / OpenAI quotas.ws://localhost/api/v1/ws?...) or align direct :8000 dev with ALLOWED_ORIGINS.make clean, then rebuild images or npm run build.| Route | Description |
|---|---|
/dashboard | Home — FANI Tip of the Day, Style at a Glance, Outfit of the Day, quick actions |
/closet | Browse and manage wardrobe items |
/closet-match | Pair a reference item with matches from your closet |
/outfit-builder | Mix & match items into outfits |
/saved-outfits | FANI-curated saved looks |
/upload | Scan & add clothing via vision analysis (replaces legacy /fashion-analysis) |
/ai-stylist | Full-screen FANI stylist chat (SSE, persisted history) |
/planner | Weekly weather-aware outfit calendar |
/travel | Travel packing planner |
/shopping-check | Shop with FANI — photo or product URL buy/skip advisor |
/analytics | Closet Insights — wear analytics & trends |
/purchase-gaps | Wardrobe Gaps — missing essentials |
/profile | Profile with avatar, stats, outfit history |
/profile?tab=settings | Settings — display name, location, FANI preferences, privacy |
/onboarding/style-profile | Style profile onboarding questionnaire |
/login, /signup, /oauth/callback | Authentication |
/forgot-password, /reset-password | Password reset flow |
/privacy, /terms | Legal pages |
Non-MVP (hidden when VITE_HIDE_NON_MVP=true): /ai-stylist-classic, /avatar, /groups.
The navbar avatar opens a dropdown (Saved Outfits, Closet Insights, Wardrobe Gaps, View Profile, Settings); the sidebar and mobile bottom nav cover primary navigation.
| Doc | Contents |
|---|---|
| docs/ENVIRONMENT.md | Environment variables, Docker, GCP, migrations, troubleshooting. |
| docs/SERVICES.md | Every wired service, workflows, and sequence diagrams. |
| docs/RUNBOOK.md | Operational runbook. |
| SECURITY.md | Security policy and reporting. |
| AGENTS.md | AI coding agent conventions and architecture cheat sheet. |
ClozeHive — your wardrobe, intelligently styled by FANI.
| Auth | JWT + refresh tokens, Google OAuth, and password reset (Mailpit in dev). |