How ameyasingh23/la-maison-de-miniso works
Purpose and Runtime Shape
La Maison de Miniso is a personal AI wardrobe and styling system: a Flutter client manages clothing, generated outfits, scheduling, and archives; a FastAPI backend owns identity, persistence, media processing, and AI integrations. Primary client entry point: flutter/lib/main.dart. Backend ASGI entry points: backend/app/main.py for local Uvicorn and backend/api/index.py for Vercel deployment.
Client Application Shell
Flutter is organized by feature, with routing and shared platform concerns separated from screens. flutter/lib/app/router.dart defines navigation; flutter/lib/core/network/api_client.dart is the backend boundary; flutter/lib/core/storage/secure_token_storage.dart persists credentials. Authentication gating and Google sign-in live in flutter/lib/features/auth/presentation/auth_gate.dart and flutter/lib/features/auth/presentation/google_sign_in_screen.dart.
Backend HTTP and Authorization Boundary
FastAPI assembles versioned routes through backend/app/api/v1/router.py; route modules expose auth, wardrobe items, outfits, calendar, and maintenance operations under backend/app/api/v1/routes/. Dependencies in backend/app/api/deps.py enforce request-level concerns such as authenticated user/database access, while backend/app/core/security.py and backend/app/core/config.py centralize token/security and environment-backed settings. The client receives only API base URL and OAuth identifiers; secrets remain backend-side.
Persistent Domain Model
PostgreSQL is the system of record, accessed via SQLAlchemy session/base infrastructure in backend/app/db/session.py and backend/app/db/base.py, with schema evolution in backend/alembic/versions/. Core entities are users, clothing items, outfits, outfit-item layout, calendar entries, archive state, idempotency records, and Cloudinary deletion jobs, represented under backend/app/db/models/, notably clothing_item.py, outfit.py, and calendar_entry.py. API schemas in backend/app/schemas/ form the serialization/validation boundary around these records.
Wardrobe Ingestion and Image Lifecycle
The wardrobe flow begins in client upload/editing UI (flutter/lib/features/wardrobe/presentation/upload_screen.dart, cutout_editor_screen.dart) and calls its repository (flutter/lib/features/wardrobe/data/wardrobe_repository.dart). Backend item endpoints persist metadata and coordinate media work through backend/app/api/v1/routes/items.py. Cloudinary hosting/background removal is isolated in backend/app/services/cloudinary_service.py and bg_removal_service.py; durable deletion jobs plus cloudinary_reconciler.py support eventual cleanup/reconciliation rather than coupling database mutations directly to remote deletion.
AI Tagging and Outfit Generation
Uploaded garments can be AI-tagged via backend/app/services/gemini_tagger.py, producing structured item attributes for the wardrobe. Outfit requests originate from flutter/lib/features/outfits/presentation/outfit_generator_screen.dart, pass through flutter/lib/features/outfits/data/outfit_repository.dart, and are handled by backend/app/api/v1/routes/outfits.py. The backend combines saved wardrobe data, user mood/occasion inputs, and weather context (backend/app/services/weather_service.py) before using the LLM integration in backend/app/services/groq_outfit_generator.py; generated compositions and item layouts are persisted as outfits.
Planning, Retention, and Operational Guarantees
Calendar scheduling is a distinct domain flow between flutter/lib/features/calendar/presentation/calendar_screen.dart and backend/app/api/v1/routes/calendar.py. Archive/restore behavior is exposed in the profile UI (flutter/lib/features/profile/presentation/archive_screen.dart) and supported by archive-oriented database migrations. Mutation safety is explicitly supported by backend/app/services/idempotency.py and backend/app/db/models/idempotency_record.py, important for mobile retries and remote media side effects.
Main entry points: items.py Domain routes · main.dart App shell & routing · cloudinary_service.py Item media workflow · groq_outfit_generator.py Outfit generation
Components 21
Flutter client
- App shell & routing · Starts the client and defines navigation.
flutter/lib/main.dart - Auth gate & Google sign-in
flutter/lib/features/auth/presentation/auth_gate.dart - API client
flutter/lib/core/network/api_client.dart - Secure token storage
flutter/lib/core/storage/secure_token_storage.dart - Wardrobe upload & editor
flutter/lib/features/wardrobe/presentation/upload_screen.dart - Wardrobe repository
flutter/lib/features/wardrobe/data/wardrobe_repository.dart - Outfit generator
flutter/lib/features/outfits/presentation/outfit_generator_screen.dart - Calendar & archive UI
flutter/lib/features/calendar/presentation/calendar_screen.dart
FastAPI boundary
- ASGI application · Local Uvicorn entry point; Vercel uses a parallel adapter.
backend/app/main.py - Versioned API router
backend/app/api/v1/router.py - Domain routes · Item endpoints represent the auth, outfit, calendar, and maintenance route modules.
backend/app/api/v1/routes/items.py - Auth & request dependencies
backend/app/api/deps.py
Backend services
- Item media workflow · Coordinates item metadata, uploads, tagging, and deletion cleanup.
backend/app/services/cloudinary_service.py - Outfit generation · Combines wardrobe, inputs, weather, and LLM output.
backend/app/services/groq_outfit_generator.py - Weather context
backend/app/services/weather_service.py - Cloudinary · Remote image hosting and background removal.
- Gemini tagging · Produces structured garment attributes.
backend/app/services/gemini_tagger.py - Groq LLM
Persistent domain
- PostgreSQL domain records · Users, wardrobe, outfits, schedules, archives, jobs, and idempotency records.
backend/app/db/models/clothing_item.py - SQLAlchemy session
backend/app/db/session.py - Schema migrations
backend/alembic/versions/20260720_07_add_archives.py
Connections 24
- App shell & routing → Auth gate & Google sign-in: gates access
- Auth gate & Google sign-in → Secure token storage: stores credentials
- App shell & routing → Wardrobe upload & editor: navigates
- App shell & routing → Outfit generator: navigates
- App shell & routing → Calendar & archive UI: navigates
- Wardrobe upload & editor → Wardrobe repository: uses
- Wardrobe repository → API client: calls
- Outfit generator → API client: requests generation
- Calendar & archive UI → API client: schedules and archives
- API client → ASGI application: HTTPS API
- ASGI application → Versioned API router: mounts
- Versioned API router → Domain routes: dispatches
- Domain routes → Auth & request dependencies: enforces identity
- Domain routes → Item media workflow: item mutations
- Domain routes → Outfit generation: generation requests
- Domain routes → SQLAlchemy session: reads and writes
- SQLAlchemy session → PostgreSQL domain records: persists
- Schema migrations → PostgreSQL domain records: evolves schema
- Item media workflow → Cloudinary: uploads and reconciles
- Item media workflow → Gemini tagging: tags garments
- Item media workflow → PostgreSQL domain records: records items and deletion jobs
- Outfit generation → Weather context: gets context
- Outfit generation → Groq LLM: generates composition
- Outfit generation → PostgreSQL domain records: loads wardrobe and saves outfits