# jsgithubchannel/deepsea2 architecture

> Architecture diagram of the GitHub repository jsgithubchannel/deepsea2, 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/jsgithubchannel/deepsea2
- Repository: https://github.com/jsgithubchannel/deepsea2

## Overview

##### Main Components
- Frontend / Presentation Layer: Represented by the Flutter UI components inside lib/presentation. This includes pages (such as home_page, login_screen, etc.), screens for the map, quizzes, and the achievement “도감”.
- Data Layer: Includes models (lib/data/models) and repositories (lib/data/repositories). This part encapsulates data structures and how information is fetched, stored, or managed.
- Services: Under lib/services (e.g., auth_service, identification_service), these externalize business operations, like handling authentication or AI-based image identification.
- Routes and Navigation: Highlighted by the various routing files in lib/app and lib/core/routes that manage screen transitions.
- Platform-Specific Layers: Although built with Flutter, the native integration for Android (android/ folder), iOS (ios/ folder), and even desktop (linux, macos, windows) should be abstractly noted as deployment targets.
- Assets & Configuration: Files under assets (fonts, labels.txt) and configuration files like firebase.json, pubspec.yaml, and gradle/xcode configs denote external dependencies and settings.

##### Relationships and Data Flow
- The UI components in the Presentation layer send user interactions (e.g., jellyfish photo upload) to the Controllers.
- Controllers, depicted as smaller nodes, process user actions and delegate to Data Repositories and Services.
- Repositories fetch or update data models and trigger the identification service (which applies AI logic) or authentication service.
- Routes and Navigation modules manage which screens are presented at each point.

##### Architectural Patterns and Design Principles
- Clear separation of concerns is maintained, where each layer (presentation, business, data) interacts through well-defined interfaces.
- Cross-platform design: The multiple directories for Android, iOS, web, and desktop platforms highlight that the same core code (in lib/) is reused across platforms.

##### Following Elements
- From Presentation → Controllers: User interactions.
- From Controllers → Data/Services: Data fetching, AI identification, and reporting actions.
- UI components (e.g., rectangles with rounded corners)
- Core controllers (smaller, perhaps a slightly different shade or a subtle border style to indicate their “smaller” size relative to other modules)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend / Presentation Layer
    subgraph "Frontend / Presentation Layer"
        P1["UI Screens (lib/presentation)"]:::presentation
    end

    %% Controllers (Business Logic) - depicted with smaller nodes
    subgraph "Controllers (Business Logic)"
        C1["Core Controllers (lib/core/controllers)"]:::controllers
        C2["Presentation Controllers (lib/presentation/controllers)"]:::controllers
    end

    %% Data Layer
    subgraph "Data Layer"
        DM["Data Models (lib/data/models)"]:::models
        DR["Data Repositories (lib/data/repositories)"]:::repositories
    end

    %% Services
    subgraph "Services"
        S1["Auth Service (lib/services)"]:::services
        S2["Identification Service (lib/services)"]:::services
    end

    %% Routes and Navigation
    subgraph "Routes and Navigation"
        R1["App Routes (lib/app)"]:::routes
        R2["App Pages (lib/core/routes)"]:::routes
    end

    %% Platform-Specific Adapters
    subgraph "Platform-Specific Adapters"
        A1["Android (android/)"]:::platforms
        A2["iOS (ios/)"]:::platforms
        A3["Linux (linux/)"]:::platforms
        A4["macOS (macos/)"]:::platforms
        A5["Windows (windows/)"]:::platforms
    end

    %% Assets & Configuration
    subgraph "Assets & Configuration"
        AC["Assets & Config (assets, firebase.json, pubspec.yaml)"]:::assets
    end

    %% Data Flow Connections
    P1 -->|"User_interaction"| C1
    P1 -->|"User_interaction"| C2

    C1 -->|"DataCall"| DR
    C2 -->|"DataCall"| DR

    DR -->|"Fetch_Data"| DM
    DR -->|"Update_Data"| DM

    DR -->|"Return_Data"| C1
    DR -->|"Return_Data"| C2

    C1 -->|"ServiceCall"| S1
    C1 -->|"ServiceCall"| S2
    C2 -->|"ServiceCall"| S1
    C2 -->|"ServiceCall"| S2

    S1 -->|"Response"| C1
    S1 -->|"Response"| C2
    S2 -->|"Response"| C1
    S2 -->|"Response"| C2

    C1 -.->|"Navigate"| R1
    C1 -.->|"Navigate"| R2
    C2 -.->|"Navigate"| R1
    C2 -.->|"Navigate"| R2

    R1 -->|"Screen_Transition"| P1
    R2 -->|"Screen_Transition"| P1

    P1 -->|"Deployed_on"| A1
    P1 -->|"Deployed_on"| A2
    P1 -->|"Deployed_on"| A3
    P1 -->|"Deployed_on"| A4
    P1 -->|"Deployed_on"| A5

    S1 -->|"Runs_on"| A1
    S2 -->|"Runs_on"| A1

    AC -.->|"Config_for"| P1

    %% Click Events
    click P1 "https://github.com/jsgithubchannel/deepsea2/tree/main/lib/presentation"
    click C1 "https://github.com/jsgithubchannel/deepsea2/tree/main/lib/core/controllers"
    click C2 "https://github.com/jsgithubchannel/deepsea2/blob/main/lib/presentation/controllers/home_controller.dart"
    click DM "https://github.com/jsgithubchannel/deepsea2/tree/main/lib/data/models"
    click DR "https://github.com/jsgithubchannel/deepsea2/tree/main/lib/data/repositories"
    click S1 "https://github.com/jsgithubchannel/deepsea2/blob/main/lib/services/auth_service.dart"
    click S2 "https://github.com/jsgithubchannel/deepsea2/blob/main/lib/services/identification_service.dart"
    click R1 "https://github.com/jsgithubchannel/deepsea2/blob/main/lib/app/app_routes.dart"
    click R2 "https://github.com/jsgithubchannel/deepsea2/blob/main/lib/core/routes/app_pages.dart"
    click A1 "https://github.com/jsgithubchannel/deepsea2/tree/main/android/"
    click A2 "https://github.com/jsgithubchannel/deepsea2/tree/main/ios/"
    click A3 "https://github.com/jsgithubchannel/deepsea2/tree/main/linux/"
    click A4 "https://github.com/jsgithubchannel/deepsea2/tree/main/macos/"
    click A5 "https://github.com/jsgithubchannel/deepsea2/tree/main/windows/"
    click AC "https://github.com/jsgithubchannel/deepsea2/tree/main/assets/"

    %% Style Definitions
    classDef presentation fill:#bbf,stroke:#333,stroke-width:2px;
    classDef controllers fill:#cfc,stroke:#333,stroke-width:2px,font-size:10px;
    classDef models fill:#fcf,stroke:#333,stroke-width:2px;
    classDef repositories fill:#fdd,stroke:#333,stroke-width:2px;
    classDef services fill:#ffd,stroke:#333,stroke-width:2px;
    classDef routes fill:#dfd,stroke:#333,stroke-width:2px;
    classDef platforms fill:#ddf,stroke:#333,stroke-width:2px;
    classDef assets fill:#eef,stroke:#333,stroke-width:2px;
```
