How tentsundue/fashion-finder works
Purpose and principal workflow
Fashion Finder is a visual clothing-discovery product: an API consumer submits an image path and optional brand/category filters, the server embeds the image and searches catalog image embeddings for similar products, returning paginated product details, variants, and sizes. The implemented web client provides browsing/upload/result presentation pieces, but the sampled code does not establish a browser-to-API search call.
Components
Client experience
• Browser User — repository path: null. Loads and interacts with the single-page fashion-discovery UI.
• React Mount — client/src/main.tsx. Creates the React root, applies Chakra’s provider/theme context, and renders the application shell.
• SPA Shell — client/src/App.tsx. Owns BrowserRouter setup and currently mounts the navigation plus the root Home route.
• Home Discovery Screen — client/src/pages/Home/Home.tsx. The routed discovery-screen boundary exists, though its implementation was not sampled.
• Global Navigation — client/src/components/Navbar/Navbar.tsx. Provides home, brand, category, and color-mode navigation controls.
• Image Upload Control — client/src/components/Dropzone/Dropzone.tsx. Accepts up to five PNG/JPEG files and emits accepted files to its parent callback.
• Product Result Card — client/src/components/ProductBox/ProductBox.tsx. Displays product price, ratings, brand treatment, image variants, and opens a product-details dialog from a ProductInfo value.
• Variant Image Carousel — client/src/components/ImageCarousel/ImageCarousel.tsx. Maintains selected-slide state and renders product color-to-image mappings in horizontal or vertical modes.
• Product Detail Dialog — client/src/components/ProductInfoModal/ProductInfoModal.tsx. Is instantiated by each product card; dialog internals were not sampled.
API and retrieval
• API Consumer — repository path: null. Initiates the demonstrated principal workflow by calling the HTTP search endpoint.
• FastAPI API Host — server/main.py. Creates the FastAPI application and registers separately prefixed products and search routers.
• Similarity Search API — server/api/routes/search.py. Accepts image-path similarity searches and listing/filter requests; its main search embeds the query, then uses SQL CTEs to rank products by nearest related image while aggregating color/image variants and sizes.
• Search API Contracts — server/schemas/search.py. Defines the request and response models imported by the similarity endpoints.
• Product Catalog API — server/api/routes/products.py. Is a separately registered products-routing boundary, but its handlers were not sampled.
• Database Session Provider — server/db/session.py. Constructs a SQLAlchemy engine/session factory and yields a request-scoped session that is closed afterward.
• CLIP Embedding Adapter — server/services/clip_model.py. Supplies embed_image, directly invoked by the search route; README documents OpenCLIP/PyTorch as the intended ML implementation, but the adapter body was not sampled.
• PostgreSQL/pgvector Catalog Database — repository path: null. Stores products, product images and embeddings, colors, and sizes; the query uses pgvector cosine-distance operations and returns stored S3 image URLs.
Offline ingestion and alternate retrieval
• Clothing Website Scraper — repository path: null. A separately maintained scraper documented in the README produces vendor metadata and downloaded images for manual transfer into this project.
• Local Scraped-Image Staging — repository path: null. Runtime image files matching the uploader’s recursive JPEG glob and naming convention.
• S3 Image Publisher — scripts/upload/upload_images.py. Parses four-part image filenames and uploads each image to a deterministic products/{brand}/{product}/{color}.jpg object key.
• Amazon S3 Product Image Storage — repository path: null. Receives uploaded product images and is the documented source for catalog image URLs.
• Development FAISS Retrieval — server/services/search_engine.py. A standalone/testing alternative to pgvector that optionally predicts a category, embeds a local query image, queries category FAISS indexes, and resolves result positions through CSV metadata.
• Local Metadata Dataset — data/metadata.csv. Is loaded by the FAISS retrieval module to translate nearest-neighbor indices into product records.
• Local FAISS Index Artifacts — repository path: null. Runtime category index files read by the development retrieval path; their generated files are not present in the supplied tree.
Relationships
• Browser User -> React Mount: loads the client application; evidence: the mount creates a React root from the browser DOM.
• React Mount -> SPA Shell: renders the application inside Chakra provider/theme context; evidence: it renders App.
• SPA Shell -> Global Navigation: mounts the navigation for all routed views; evidence: it renders Navbar inside BrowserRouter.
• SPA Shell -> Home Discovery Screen: routes / to the Home element; evidence: the declared root route renders Home.
• Global Navigation -> SPA Shell: requests client-side home, category, and brand navigation; evidence: it uses router links and useNavigate.
• Product Result Card -> Variant Image Carousel: renders its product’s color-to-image mapping; evidence: it passes color_to_s3_url and product name.
• Product Result Card -> Product Detail Dialog: instantiates the dialog when the card is used as its trigger; evidence: it renders the modal inside Dialog.Root.
• API Consumer -> FastAPI API Host: sends an HTTP request initiating product similarity search; evidence: the host registers the search router under /search.
• FastAPI API Host -> Similarity Search API: dispatches /search requests to the search router; evidence: router inclusion with the search prefix.
• FastAPI API Host -> Product Catalog API: dispatches /products requests to the products router; evidence: router inclusion with the products prefix.
• Similarity Search API -> Search API Contracts: declares typed similarity/filter inputs and response models; evidence: endpoint annotations import these models.
• Similarity Search API -> CLIP Embedding Adapter: computes the query image embedding; evidence: it calls embed_image(request.image_path).
• Similarity Search API -> Database Session Provider: requests a database dependency; evidence: endpoints declare Depends(get_db).
• Database Session Provider -> PostgreSQL/pgvector Catalog Database: opens and yields SQLAlchemy sessions against the configured database URL; evidence: engine and sessionmaker construction.
• Similarity Search API -> PostgreSQL/pgvector Catalog Database: executes parameterized vector-ranking and product-aggregation SQL through its injected session; evidence: db.execute(...).mappings().all().
• Similarity Search API -> FastAPI API Host: returns products plus pagination metadata or an HTTP error; evidence: endpoint return dictionaries and exception handling.
• FastAPI API Host -> API Consumer: serializes and sends the endpoint response; evidence: FastAPI response-model registration.
• Clothing Website Scraper -> Local Scraped-Image Staging: produces downloaded vendor images for manual transfer; evidence: README’s documented scraper workflow.
• S3 Image Publisher -> Local Scraped-Image Staging: scans staged JPEG paths and parses their filenames; evidence: recursive globbing and four-part filename validation.
• S3 Image Publisher -> Amazon S3 Product Image Storage: uploads each accepted image to a product/brand/color object key; evidence: Boto3 upload_file.
• Development FAISS Retrieval -> CLIP Embedding Adapter: embeds each local query image; evidence: it invokes embed_image.
• Development FAISS Retrieval -> Local FAISS Index Artifacts: reads one index per selected or predicted category and performs nearest-neighbor search; evidence: FAISS index loading and search.
• Development FAISS Retrieval -> Local Metadata Dataset: resolves returned FAISS indices into metadata rows; evidence: CSV loading and positional selection.
Coverage limits
The sampled client code shows no fetch/upload bridge from the Home or Dropzone UI to the API, and the Results page was not sampled. Product-route handlers, CLIP initialization/model lifecycle, catalog-loading logic, and embedding/index build scripts were also unavailable. The image uploader imports a backend.config module not present in the tree, so its executable configuration wiring cannot be confirmed.
Main entry points: search.py Similarity Search API · main.py FastAPI API Host · App.tsx SPA Shell · search_engine.py Development FAISS Retrieval
Components 23
Client Experience
Browser-based fashion discovery interface.
- Browser User · Loads and interacts with the fashion-discovery UI.
- React Mount
client/src/main.tsx - SPA Shell
client/src/App.tsx - Home Discovery Screen · Routed discovery-screen boundary.
client/src/pages/Home/Home.tsx - Global Navigation
client/src/components/Navbar/Navbar.tsx - Product Result Card
client/src/components/ProductBox/ProductBox.tsx - Variant Image Carousel
client/src/components/ImageCarousel/ImageCarousel.tsx - Product Detail Dialog · Dialog internals were not sampled.
client/src/components/ProductInfoModal/ProductInfoModal.tsx
API and Retrieval
HTTP API, embedding, and catalog search services.
- API Consumer · Initiates HTTP similarity searches.
- FastAPI API Host
server/main.py - Similarity Search API · Embeds queries and ranks catalog products.
server/api/routes/search.py - Search API Contracts
server/schemas/search.py - Product Catalog API · Products-routing boundary; handlers were not sampled.
server/api/routes/products.py - CLIP Embedding Adapter · Provides image embeddings.
server/services/clip_model.py
Catalog Persistence
Database-backed product catalog and image storage.
- Database Session Provider · Creates request-scoped SQLAlchemy sessions.
server/db/session.py - PostgreSQL/pgvector Catalog Database · Stores products, images, embeddings, colors, and sizes.
- Amazon S3 Product Image Storage · Stores catalog product images and supplies image URLs.
Offline Ingestion
Scraped image staging and S3 publishing.
- Clothing Website Scraper · Produces vendor metadata and downloaded images.
- Local Scraped-Image Staging · Staged runtime JPEG image files.
- S3 Image Publisher · Uploads accepted images using deterministic object keys.
scripts/upload/upload_images.py
Development Retrieval
Local FAISS-based testing retrieval path.
- Development FAISS Retrieval · Testing retrieval over local category indexes.
server/services/search_engine.py - Local Metadata Dataset · Maps FAISS positions to product records.
data/metadata.csv - Local FAISS Index Artifacts · Runtime category index files.
Connections 23
- Browser User → React Mount: loads app
- React Mount → SPA Shell: renders · Renders the application inside the Chakra provider and theme context.
- SPA Shell → Global Navigation: mounts navigation
- SPA Shell → Home Discovery Screen: routes /
- Global Navigation → SPA Shell: navigates · Requests client-side home, category, and brand navigation.
- Product Result Card → Variant Image Carousel: renders variants
- Product Result Card → Product Detail Dialog: opens details
- API Consumer → FastAPI API Host: searches · Sends an HTTP request initiating product similarity search.
- FastAPI API Host → Similarity Search API: dispatches /search
- FastAPI API Host → Product Catalog API: dispatches /products
- Similarity Search API → Search API Contracts: uses contracts
- Similarity Search API → CLIP Embedding Adapter: embeds query
- Similarity Search API → Database Session Provider: requests session
- Database Session Provider → PostgreSQL/pgvector Catalog Database: opens session
- Similarity Search API → PostgreSQL/pgvector Catalog Database: ranks products · Executes vector-ranking and product-aggregation SQL.
- Similarity Search API → FastAPI API Host: returns results · Returns products, pagination metadata, or an HTTP error.
- FastAPI API Host → API Consumer: sends response
- Clothing Website Scraper → Local Scraped-Image Staging: produces images · Produces downloaded vendor images for manual transfer.
- S3 Image Publisher → Local Scraped-Image Staging: scans images · Scans staged JPEG paths and parses filenames.
- S3 Image Publisher → Amazon S3 Product Image Storage: uploads images
- Development FAISS Retrieval → CLIP Embedding Adapter: embeds query
- Development FAISS Retrieval → Local FAISS Index Artifacts: searches indexes
- Development FAISS Retrieval → Local Metadata Dataset: resolves metadata