https://github.com/giuliobarde/AI-Wardrobe-Frontend
The AI-Wardrobe backend is built with FastAPI and provides a RESTful API for managing virtual wardrobes, user authentication, outfit generation, and AI-powered clothing recommendations. The backend uses Supabase for data storage and authentication services.
- Framework: FastAPI
- Database: Supabase
- Authentication: JWT-based auth via Supabase
- Image Storage: Supabase Storage
- LLM Integration: AI-powered outfit recommendations via Langchain
- User authentication and profile management
- Virtual wardrobe management with detailed clothing attributes
- AI-powered outfit recommendations based on weather, occasion, and user preferences
- RESTful API with comprehensive endpoint coverage
- Secure data handling with proper authentication
backend/
├── fastapi/
│ ├── api/
│ │ ├── Database/ # Database interaction modules
│ │ ├── llm/ # LLM integration for outfit recommendations
│ │ ├── routers/ # API route definitions
│ │ ├── Weather/ # Weather integration services
│ │ ├── main.py # FastAPI application entry point
│ │ ├── models.py # Pydantic data models
│ │ └── test.py # Test scripts
For more detailed information about the API endpoints, database schema, and development guidelines, see the docs directory.
- Python 3.8+
- Supabase account and project
Required environment variables:
SUPABASE_URL=your_supabase_url
SUPABASE_ROLE_KEY=your_supabase_service_role_key
OPENAI_API_KEY=your_openai_api_key
- Clone the repository
- Create a virtual environment:
python -m venv .venv - Activate the virtual environment
- Install dependencies:
pip install -r requirements.txt - Start the development server:
uvicorn api.main:app --reload
When running the server, interactive API documentation is available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
POST /sign-up/: Register a new userPOST /sign-in/: Authenticate a user and get session tokenGET /session/: Validate and get current session informationPOST /sign-out/: End the current user session
POST /add_clothing_item/: Add a new clothing item to user's wardrobeGET /clothing_items/: Get all clothing items for a userGET /clothing_item/{item_id}: Get details of a specific clothing itemPUT /update_clothing_item/{item_id}: Update a clothing itemDELETE /delete_clothing_item/{item_id}: Delete a clothing item
POST /create_outfit/: Create a new outfit from clothing itemsGET /outfits/: Get all outfits for a userGET /outfit/{outfit_id}: Get details of a specific outfitPUT /update_outfit/{outfit_id}: Update an outfitDELETE /delete_outfit/{outfit_id}: Delete an outfit
GET /profile/: Get user profile informationPUT /update_profile/: Update user profile information
POST /chat/: Get AI-powered outfit recommendations
Stores user authentication and profile information.
Stores information about individual clothing items including:
- Type (top, bottom, outerwear, etc.)
- Material
- Color
- Formality
- Pattern
- Fit
- Weather suitability
- Occasion suitability
- Image reference
Stores collections of clothing items that form complete outfits.
Stores user style preferences for AI recommendations.
The backend uses Supabase for authentication:
- User signs up/signs in through the API
- Supabase validates credentials and returns JWT
- JWT is used for subsequent authenticated requests
- Token validation happens through middleware
- Create appropriate Pydantic models in
models.py - Add database functions in the relevant module under
Database/ - Create route handlers in the appropriate router file
- Register the router in
main.pyif creating a new router
All endpoints should use proper exception handling with appropriate HTTP status codes.
Run tests using the test scripts in test.py.