# ameyasingh23/la-maison-de-miniso architecture

> Architecture diagram of the GitHub repository ameyasingh23/la-maison-de-miniso, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ameyasingh23/la-maison-de-miniso
- Repository: https://github.com/ameyasingh23/la-maison-de-miniso

## Overview

#### 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: [`backend/app/api/v1/routes/items.py`](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/api/v1/routes/items.py) (Domain routes), [`flutter/lib/main.dart`](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/main.dart) (App shell & routing), [`backend/app/services/cloudinary_service.py`](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/cloudinary_service.py) (Item media workflow), [`backend/app/services/groq_outfit_generator.py`](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/groq_outfit_generator.py) (Outfit generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Flutter client"]
  node_app["App shell &amp; routing<br/>Flutter<br/>[main.dart]"]
  node_auth_ui["Auth gate &amp; Google sign-in<br/>Flutter feature<br/>[auth_gate.dart]"]
  node_api_client["API client<br/>network boundary<br/>[api_client.dart]"]
  node_token_store["Secure token storage<br/>credential store"]
  node_wardrobe_ui["Wardrobe upload &amp; editor<br/>Flutter feature<br/>[upload_screen.dart]"]
  node_wardrobe_repo["Wardrobe repository<br/>client repository"]
  node_outfit_ui["Outfit generator<br/>Flutter feature"]
  node_calendar_ui["Calendar &amp; archive UI<br/>Flutter feature"]
end

subgraph group_api["FastAPI boundary"]
  node_asgi["ASGI application<br/>FastAPI entry<br/>[main.py]"]
  node_api_router["Versioned API router<br/>route assembly<br/>[router.py]"]
  node_routes["Domain routes<br/>HTTP endpoints<br/>[items.py]"]
  node_auth_deps["Auth &amp; request dependencies<br/>authorization<br/>[deps.py]"]
end

subgraph group_services["Backend services"]
  node_item_flow["Item media workflow<br/>backend service"]
  node_outfit_flow["Outfit generation<br/>backend service"]
  node_weather["Weather context<br/>integration<br/>[weather_service.py]"]
  node_cloudinary(("Cloudinary<br/>media platform"))
  node_gemini(("Gemini tagging<br/>AI integration<br/>[gemini_tagger.py]"))
  node_groq(("Groq LLM<br/>AI integration"))
end

subgraph group_data["Persistent domain"]
  node_postgres[("PostgreSQL domain records<br/>system of record<br/>[clothing_item.py]")]
  node_orm["SQLAlchemy session<br/>persistence layer<br/>[session.py]"]
  node_migrations["Schema migrations<br/>Alembic"]
end

node_app -->|"gates access"| node_auth_ui
node_auth_ui -->|"stores credentials"| node_token_store
node_app -->|"navigates"| node_wardrobe_ui
node_app -->|"navigates"| node_outfit_ui
node_app -->|"navigates"| node_calendar_ui
node_wardrobe_ui -->|"uses"| node_wardrobe_repo
node_wardrobe_repo -->|"calls"| node_api_client
node_outfit_ui -->|"requests generation"| node_api_client
node_calendar_ui -->|"schedules and archives"| node_api_client
node_api_client -->|"HTTPS API"| node_asgi
node_asgi -->|"mounts"| node_api_router
node_api_router -->|"dispatches"| node_routes
node_routes -->|"enforces identity"| node_auth_deps
node_routes -->|"item mutations"| node_item_flow
node_routes -->|"generation requests"| node_outfit_flow
node_routes -->|"reads and writes"| node_orm
node_orm -->|"persists"| node_postgres
node_migrations -->|"evolves schema"| node_postgres
node_item_flow -->|"uploads and reconciles"| node_cloudinary
node_item_flow -->|"tags garments"| node_gemini
node_item_flow -->|"records items and deletion jobs"| node_postgres
node_outfit_flow -->|"gets context"| node_weather
node_outfit_flow -->|"generates composition"| node_groq
node_outfit_flow -->|"loads wardrobe and saves outfits"| node_postgres

click node_app "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/main.dart"
click node_auth_ui "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/auth/presentation/auth_gate.dart"
click node_api_client "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/core/network/api_client.dart"
click node_token_store "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/core/storage/secure_token_storage.dart"
click node_wardrobe_ui "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/wardrobe/presentation/upload_screen.dart"
click node_wardrobe_repo "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/wardrobe/data/wardrobe_repository.dart"
click node_outfit_ui "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/outfits/presentation/outfit_generator_screen.dart"
click node_calendar_ui "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/calendar/presentation/calendar_screen.dart"
click node_asgi "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/main.py"
click node_api_router "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/api/v1/router.py"
click node_routes "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/api/v1/routes/items.py"
click node_auth_deps "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/api/deps.py"
click node_item_flow "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/cloudinary_service.py"
click node_outfit_flow "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/groq_outfit_generator.py"
click node_weather "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/weather_service.py"
click node_postgres "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/db/models/clothing_item.py"
click node_orm "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/db/session.py"
click node_migrations "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/alembic/versions/20260720_07_add_archives.py"
click node_gemini "https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/gemini_tagger.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_auth_ui,node_api_client,node_token_store,node_wardrobe_ui,node_wardrobe_repo,node_outfit_ui,node_calendar_ui toneBlue
class node_asgi,node_api_router,node_routes,node_auth_deps toneAmber
class node_item_flow,node_outfit_flow,node_weather,node_cloudinary,node_gemini,node_groq toneMint
class node_postgres,node_orm,node_migrations toneRose
```

## Components

### Flutter client

- [App shell & routing](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/main.dart): Flutter · Starts the client and defines navigation. · `flutter/lib/main.dart`
- [Auth gate & Google sign-in](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/auth/presentation/auth_gate.dart): Flutter feature · `flutter/lib/features/auth/presentation/auth_gate.dart`
- [API client](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/core/network/api_client.dart): network boundary · `flutter/lib/core/network/api_client.dart`
- [Secure token storage](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/core/storage/secure_token_storage.dart): credential store · `flutter/lib/core/storage/secure_token_storage.dart`
- [Wardrobe upload & editor](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/wardrobe/presentation/upload_screen.dart): Flutter feature · `flutter/lib/features/wardrobe/presentation/upload_screen.dart`
- [Wardrobe repository](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/wardrobe/data/wardrobe_repository.dart): client repository · `flutter/lib/features/wardrobe/data/wardrobe_repository.dart`
- [Outfit generator](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/outfits/presentation/outfit_generator_screen.dart): Flutter feature · `flutter/lib/features/outfits/presentation/outfit_generator_screen.dart`
- [Calendar & archive UI](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/flutter/lib/features/calendar/presentation/calendar_screen.dart): Flutter feature · `flutter/lib/features/calendar/presentation/calendar_screen.dart`

### FastAPI boundary

- [ASGI application](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/main.py): FastAPI entry · Local Uvicorn entry point; Vercel uses a parallel adapter. · `backend/app/main.py`
- [Versioned API router](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/api/v1/router.py): route assembly · `backend/app/api/v1/router.py`
- [Domain routes](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/api/v1/routes/items.py): HTTP endpoints · Item endpoints represent the auth, outfit, calendar, and maintenance route modules. · `backend/app/api/v1/routes/items.py`
- [Auth & request dependencies](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/api/deps.py): authorization · `backend/app/api/deps.py`

### Backend services

- [Item media workflow](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/cloudinary_service.py): backend service · Coordinates item metadata, uploads, tagging, and deletion cleanup. · `backend/app/services/cloudinary_service.py`
- [Outfit generation](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/groq_outfit_generator.py): backend service · Combines wardrobe, inputs, weather, and LLM output. · `backend/app/services/groq_outfit_generator.py`
- [Weather context](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/weather_service.py): integration · `backend/app/services/weather_service.py`
- **Cloudinary**: media platform · Remote image hosting and background removal.
- [Gemini tagging](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/services/gemini_tagger.py): AI integration · Produces structured garment attributes. · `backend/app/services/gemini_tagger.py`
- **Groq LLM**: AI integration

### Persistent domain

- [PostgreSQL domain records](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/db/models/clothing_item.py): system of record · Users, wardrobe, outfits, schedules, archives, jobs, and idempotency records. · `backend/app/db/models/clothing_item.py`
- [SQLAlchemy session](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/app/db/session.py): persistence layer · `backend/app/db/session.py`
- [Schema migrations](https://github.com/ameyasingh23/la-maison-de-miniso/blob/main/backend/alembic/versions/20260720_07_add_archives.py): Alembic · `backend/alembic/versions/20260720_07_add_archives.py`

## Connections

- 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
