# seungboan/try-on-hanbok architecture

> Architecture diagram of the GitHub repository seungboan/try-on-hanbok, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seungboan/try-on-hanbok
- Repository: https://github.com/seungboan/try-on-hanbok

## Overview

The project “Try On Hanbok” is a Flutter-based, cross-platform application that provides a virtual fitting experience for Hanbok (traditional Korean dress) using AI services. It comprises clearly separated frontend and backend components, with the frontend implemented in Flutter (targeting mobile, web, desktop) and the backend handled via Supabase services integrated under the supabase_services folder.

##### Main Components
- Frontend Application (Client):

- Backend Services:
- The supabase_services directory indicates the backend integration layer. This module includes Supabase configuration, services, and models for handling image storage, AI model invocation for virtual fittings, and user authentication.
- Relevant files like supabase_service.dart, inference_service.dart, and the configuration for environment variables denote its key role in interfacing with Supabase and possibly Edge Functions.

- External Services:
- Supabase is the third-party service providing database, storage, and authentication.
- AI processing for the virtual fitting function is implied through integration services in the supabase_services module.

##### Analyzing the Relationships and Interactions
- The Flutter frontend interacts with the Supabase backend through defined service interfaces (API calls, state management via hanbok_state.dart, etc.).
- Users trigger operations like image upload or design selection via the UI (lib/pages and lib/widgets) which, in result, communicate with the backend for processing (using the supabase_services functions).
- Data flows bidirectionally: user inputs (images, design selections) flow from the UI to the backend, and the processed results (virtual fitting images, status updates) are returned to the UI.
- The use of custom lint rules indicates adherence to specific naming and coding standards, which is part of the overall architectural discipline.

##### Architectural Patterns & Design Principles
- Clear Separation of Concerns: The project separates the UI layer (Flutter under lib/) from backend interactions (supabase_services).
- Modular Design: Distinct modules for client-side widgets, pages, constants, and backend services ensure maintainability and scalability.
- Cross-Platform Development: The project’s folder structure (android, ios, web, linux, macos, windows) emphasizes the cross-platform build nature of Flutter.

##### Relevant Technologies, Frameworks, and Libraries
- Flutter (UI toolkit for cross-platform development)
- Supabase (for backend services including user authentication, database management, storage, and possibly AI model invocation via Edge Functions)
- Dart (as the primary programming language, alongside specific toolchains for linting and analysis like analysis_options.yaml)
- Platform-specific build configurations (Gradle, Xcode, CMake for desktop platforms)

##### Elements
- Clear labels for each component:
- Supabase Backend Integration component and its sub-services (inference service, image storage, environment & configuration service).
- API calls from the Flutter app to the backend services.
- Visual Differentiation:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Subgraph
    subgraph "Frontend (Flutter Client) [Flutter/Dart]"
        direction TB
        K["Flutter App"]
        A["Pages"]:::frontend
        B["Widgets"]:::frontend
        C["Constants"]:::frontend
        K --- A
        K --- B
        K --- C
    end

    %% Backend Subgraph
    subgraph "Backend Services (Supabase Integration)"
        direction TB
        D["Supabase Config"]:::backend
        E["Hanbok State"]:::backend
        F["Supabase Service"]:::backend
        G["Inference Service"]:::backend
        H["Env Service"]:::backend
        I["Hanbok Image Model"]:::backend
        D --> F
        F --> E
        F --> G
        F --> H
        F --> I
    end

    %% External Service
    J["Supabase Platform"]:::external

    %% Connections between Frontend and Backend
    A -->|"sends_request"| F
    B -->|"user_action"| F
    F -->|"api_call"| J
    J -->|"response"| F
    E -->|"updates_UI"| A

    %% Click Events for Frontend Components
    click K "https://github.com/seungboan/try-on-hanbok/tree/main/lib/"
    click A "https://github.com/seungboan/try-on-hanbok/tree/main/lib/pages"
    click B "https://github.com/seungboan/try-on-hanbok/tree/main/lib/widgets"
    click C "https://github.com/seungboan/try-on-hanbok/tree/main/lib/constants"

    %% Click Events for Backend Components
    click D "https://github.com/seungboan/try-on-hanbok/blob/main/supabase_services/lib/constants/supabase_config.dart"
    click E "https://github.com/seungboan/try-on-hanbok/blob/main/supabase_services/lib/hanbok_state.dart"
    click F "https://github.com/seungboan/try-on-hanbok/blob/main/supabase_services/lib/services/supabase_service.dart"
    click G "https://github.com/seungboan/try-on-hanbok/blob/main/supabase_services/lib/services/inference_service.dart"
    click H "https://github.com/seungboan/try-on-hanbok/blob/main/supabase_services/lib/services/env_service.dart"
    click I "https://github.com/seungboan/try-on-hanbok/blob/main/supabase_services/lib/models/hanbok_image.dart"

    %% Styles definitions
    classDef frontend fill:#D1E8FF,stroke:#045,stroke-width:2px;
    classDef backend fill:#FFE0B3,stroke:#C66300,stroke-width:2px;
    classDef external fill:#C4F0C5,stroke:#008000,stroke-width:2px;
```
