Smart Closet is a local-first personal wardrobe MVP. It lets you upload clothing photos, save them in a digital closet, review mock AI-generated attributes, edit those attributes manually, and generate simple outfit suggestions from saved items.
The first version intentionally uses no paid APIs or cloud services. The backend includes a clearly separated mock analyzer so OpenAI Vision can be added later without reshaping the rest of the app.
- Upload clothing photos to local
/uploadsstorage. - Save item name, category, optional brand, and optional notes.
- Generate placeholder clothing attributes through
analyze_clothing_image(image_path). - Store wardrobe data in SQLite.
- Browse wardrobe cards with image, category, colors, formality, season, and tags.
- Filter by category, color, formality, and season.
- Edit AI-detected fields manually.
- Delete wardrobe items and their local image files.
- Resize and compress uploaded JPEG, PNG, and WebP files to local JPEGs.
- Generate three rule-based outfit suggestions.
- Add sample data to an empty wardrobe for quick local testing.
smart-closet/
backend/
app/
main.py FastAPI routes and upload handling
models.py SQLAlchemy database model
database.py SQLite engine/session setup
schemas.py Pydantic request/response schemas
image_analysis.py Mock analyzer, future AI integration point
recommendation.py Rule-based outfit logic
uploads/ Local image storage
tests/ Basic API tests
requirements.txt
README.md
frontend/
src/
api/ Typed API client
components/ Shared UI pieces
pages/ Wardrobe, upload, edit, outfit pages
App.tsx
main.tsx
package.json
README.md
README.md
From the repository root:
cd smart-closet/backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtcd ../frontend
npm installRun the backend:
cd smart-closet/backend
source .venv/bin/activate
uvicorn app.main:app --reload --host 127.0.0.1 --port 8000Run the frontend in another terminal:
cd smart-closet/frontend
npm run devOpen http://localhost:5173. The API is available at http://localhost:8000.
Run backend tests:
cd smart-closet/backend
source .venv/bin/activate
pytestRun the frontend production build:
cd smart-closet/frontend
npm run build- Start the backend and frontend with the run commands above.
- Open the wardrobe page and add sample data if the closet is empty.
- Upload a JPEG, PNG, or WebP clothing photo with a name and category.
- Open the saved item, review the mock AI attributes, and edit any incorrect fields.
- Generate outfit suggestions and review the match score, styling rationale, and possible weakness.
- Delete a test item from its detail page to confirm local cleanup.
Add current screenshots before publishing the repository:
docs/screenshots/wardrobe-dashboard.png- wardrobe grid with dashboard summarydocs/screenshots/upload-item.png- upload form with image previewdocs/screenshots/edit-item.png- item correction form and delete modaldocs/screenshots/outfit-recommendations.png- polished outfit recommendation cards
This project demonstrates a practical full-stack MVP with:
- A typed React + TypeScript frontend with reusable UI components.
- A FastAPI backend with SQLite persistence and local file storage.
- Safe-enough MVP upload handling with type checks, file size limits, image resizing, and compression.
- A replaceable AI boundary through
analyze_clothing_image(image_path). - Rule-based recommendation logic that returns explainable results instead of opaque scores.
- Manual correction workflows for imperfect automated analysis.
- Focused backend tests for the core user flows.
- Clear local setup and a structure that can grow toward deployment later.
Replace the body of backend/app/image_analysis.py::analyze_clothing_image(image_path) with a Vision API call. Keep the function signature and returned JSON shape stable:
{
"category": "...",
"dominant_color": "...",
"secondary_color": "...",
"pattern": "...",
"brand": "...",
"formality": "...",
"season": "...",
"style_tags": ["..."]
}Suggested flow:
- Read the local image file.
- Send it to an OpenAI vision-capable model with a schema-constrained prompt.
- Validate the JSON against the app's allowed values.
- Fall back to the mock analyzer or safe defaults on API errors.
- Keep the edit page because AI output will still need human correction.
- The analyzer is mock logic, not real image recognition.
- The recommendation engine is simple rule-based scoring.
- Images are stored locally and compressed, but they are not deduplicated.
- Uploads are limited to common raster formats for the MVP. SVG and GIF uploads are intentionally rejected.
- There is no authentication or multi-user support.
- SQLite is appropriate for the MVP, but production deployment should revisit storage, migrations, and backups.
- The frontend has no automated test suite yet.
- The app does not currently include weather, occasion planning, packing lists, or calendar-aware recommendations.
- Add migrations with Alembic when the schema starts changing regularly.
- Add real vision analysis behind
analyze_clothing_image. - Add outfit constraints such as occasion and weather.
- Add tests for analyzer fallback and recommendation edge cases.