How nsk-syam/myig works
1. This repo is a split frontend/backend product for an outfit-finding app: a React/Vite web app in src, a Supabase backend in supabase, and an iOS wrapper under ios built with Capacitor. The architecture is centered on image-based search, account/entitlement management, and saved results.
2. The main UI lives in src/pages and src/components. Index, SearchResults, Saved, Account, AnalyticsPage, and legal pages form the public-facing and authenticated surfaces. src/components/app contains app-specific screens like HomeScreen, PremiumHomePage, AccountScreen, quota UI, and native-bridge abstractions.
3. The app’s state and side effects are pushed into hooks and libs rather than page components. src/hooks handles mobile detection, saved products, and search-access state; src/lib contains the domain logic for auth, analytics, search access, app access, market/product matching, image handling, and Supabase integration.
4. Authentication and user identity are handled through Supabase, with client setup in src/integrations/supabase. The frontend likely signs users in, then uses auth, appAccess, and searchAccess helpers to determine what features are available and whether search quotas apply.
5. Search entitlement is a major backend boundary. The app reads access state through edge functions such as access-state, guest-access-state, issue-app-token, sync-entitlement, and consume-search. This suggests a server-enforced quota and premium-access model rather than purely client-side gating.
6. The core product pipeline is image-to-results. User images are uploaded through upload-image, Instagram-style links are processed via extract-instagram, and outfit analysis happens in analyze-outfit. The results are then turned into product suggestions by search-products, with proxy-product-image used to safely fetch or relay external product imagery.
7. Saved items are treated as first-class data. use-saved-products and savedProducts in the client connect to backend persistence, while migrations like saved_products_auth indicate authenticated storage with access controls. This is a separate boundary from search results, which may be transient.
8. Analytics is a dedicated subsystem. The client emits events through analytics, and the backend ingests them with ingest-analytics and aggregates them with analytics-summary. The presence of an AnalyticsPage indicates analytics are also surfaced in-app, likely for internal or admin visibility.
9. The backend is Supabase-native and database-driven. Migrations define schema, security hardening, analytics events, signed-in search limits, and guest search access. That means authorization is enforced both in Postgres policies and in edge-function logic, not just in React.
10. There is a native iOS packaging layer, but it appears to reuse the same web app. capacitor.config.ts and the Xcode project under ios/App indicate the React app is bundled into a Capacitor shell, with Swift AppDelegate and storyboard assets only providing the native container and launch/splash behavior.
11. SEO and marketing are part of the delivery surface. public includes static landing pages, blog content, redirects, sitemap, robots, and app-manifest files, while scripts/generate_og_image.py suggests automated social preview generation. This implies the site serves both acquisition pages and the authenticated app from the same codebase.
12. Tests cover both UI and backend/domain boundaries. There are Vitest tests for auth, analytics, access control, product images, search products, SEO pages, and several component pages, plus Playwright config for browser-level flows. That indicates the repository is organized around validating both the client experience and the Supabase-backed business rules.
Main entry points: lib Domain logic · pages App routes · migrations Database schema · scripts Build scripts
Components 18
Frontend app
React/Vite UI and client-side domain logic
- Web shell · React entrypoint and app bootstrap
src/main.tsx - App routes · Primary public and authenticated screens
src/pages - Public pages · Landing, SEO, and policy pages
src/pages/Index.tsx - Search results · Outfit result presentation and follow-up actions
src/pages/SearchResults.tsx - Account area · Account, saved items, and analytics surfaces
src/pages/Account.tsx - App screens · Home, premium, quota, and native-bridge screens
src/components/app - UI chrome · Navigation, hero, footer, and shared presentation components
src/components - State hooks · Mobile detection, saved products, and search access hooks
src/hooks - Domain logic · Auth, access, analytics, search, product, and market helpers
src/lib - Supabase client · Frontend Supabase integration and typed client
src/integrations/supabase/client.ts
Supabase backend
Edge functions and database migrations
- Access APIs · Entitlements, tokens, and quota enforcement
supabase/functions - Search pipeline · Image ingestion, analysis, extraction, and product search
supabase/functions/analyze-outfit/index.ts - Analytics API · Event ingestion and analytics summaries
supabase/functions/ingest-analytics/index.ts - Account ops · Account deletion and user-data cleanup
supabase/functions/delete-account/index.ts - Database schema · Security, saved products, analytics, and search access schema
supabase/migrations
iOS wrapper
Capacitor shell for the web app
- iOS shell · Native container around the shared web app
ios/App/App/AppDelegate.swift
Delivery surface
Public marketing and SEO assets
- Static site · SEO pages, redirects, robots, sitemap, and app manifest
public - Build scripts · OG image generation and iOS packaging scripts
scripts
Connections 20
- Web shell → App routes: boots · Renders the SPA and mounts routed pages
- App routes → Public pages: serves · Public landing, blog, privacy, and terms pages
- App routes → Search results: navigates · Shows analyzed outfit and product matches
- App routes → Account area: navigates · Account, saved items, and analytics surfaces
- App routes → App screens: uses · Mobile and premium app experiences
- UI chrome → App routes: frames · Shared navigation and page-level composition
- State hooks → Domain logic: derives from · Hooks wrap business logic and access checks
- Domain logic → Supabase client: queries · Reads auth state and app data from Supabase
- Domain logic → Access APIs: calls · Checks access, app entitlement, and quota state
- Domain logic → Search pipeline: calls · Submits images and requests outfit/product results
- Domain logic → Analytics API: emits · Sends analytics events and summaries
- Domain logic → Account ops: calls · Coordinates account deletion and cleanup
- Access APIs → Database schema: enforced by · Server-side access rules and search limits live in the database
- Search pipeline → Database schema: stores via · Uses persisted schema for saved/search-related data
- Analytics API → Database schema: aggregates from · Analytics events are stored and summarized in Postgres
- Supabase client → Database schema: targets · Frontend client reads the schema defined by migrations
- iOS shell → Web shell: wraps · Capacitor embeds the shared web application
- Static site → Public pages: publishes · Marketing and SEO content is served from the public directory
- Build scripts → iOS shell: packages · Release tooling supports native app builds
- Build scripts → Static site: generates · Scripts support SEO and preview asset generation