# rizaadi/valorantlab architecture

> Architecture diagram of the GitHub repository rizaadi/valorantlab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rizaadi/valorantlab
- Repository: https://github.com/rizaadi/valorantlab

## Overview

##### Project Overview & Main Components
- Following key components:
- Flutter Frontend: The Flutter application that includes the main entry point (lib/main.dart, lib/app.dart) and utilizes flavor files (lib/main_dev.dart, lib/flavors.dart) to manage different environments.
- Feature Modules: Notably, features are split into different sub-projects (e.g., features/agent and features/home). Each of these follows a layered structure (presentation, domain, data) per Clean Architecture.
- Core and Shared Libraries: The project includes centralized components in packages/core (constants, dependency injection with Get It, routes, styles, network, utilities) and shared modules (dependencies and i18n) that are consumed across features.
- Platform-Specific Code: Android and iOS directories contain native project configurations, build scripts, and resource files.
- Dependency Management & Automation: Tools like Melos (project bootstrap/multi-package management), Commitlint, Husky, and flavor management (Flutter Flavorizr) which are integral to the build and release process.

##### Layers & Relationships (Clean Architecture)
- Presentation Layer:
- Represents the UI components (screens and widgets).
- Located under each feature’s presentation folder (features/agent/lib/presentation/ and features/home/lib/presentation).
- Managed using Bloc State Management, with blocs (agent_bloc, agent_detail_bloc) coordinating user events and UI state.
- Domain Layer:
- Contains business logic (usecases, entities, and repository interfaces) for each feature.
- For example, in features/agent/lib/domain, you have usecases (get_agent_detail_usecase, get_agents_usecase) and entity definitions.
- Data Layer:
- Manages data sourcing and mapping. It is split into remote (HTTP-related API calls) and local data sources (using Isar Database).
- Includes mappers to convert between raw JSON, domain objects, and local storage models.
- The repositories (feature-specific implementations) link to the domain layer.
- Core/Shared Modules:
- These include global configurations, dependency injection (service locator pattern with Get It), network utilities, and style constants. They facilitate shared concerns across the presentation, domain, and data layers.

##### Architectural Patterns & Design Principles
- Clean Architecture: Ensuring separation of concerns between UI, business logic, and data.
- Modularization: Each feature (e.g., Agent, Home) is self-contained and managed separately, promoting independent development and testing.
- Dependency Injection: Using Get It and DI modules within packages/core to inject dependencies throughout the app.
- State Management: Utilizing Bloc to handle the state between UI and business logic.
- Platform Separation: Dividing configuration and resources between Android and iOS.

## Diagram (Mermaid)

```mermaid
flowchart TD

  %% Flutter Application
  subgraph "Flutter Application"
    A_F("Flutter Frontend"):::frontend
    F_C("Flavor Config"):::frontend
    A_F -->|"configures"| F_C
  end

  %% Feature Modules: Agent
  subgraph "Agent Module"
    AG_Entry("Agent Module Entry"):::feature
    AG_P("Agent Presentation (AgentScreen)"):::feature
    AG_D("Agent Domain (Usecases)"):::feature
    AG_Data("Agent Data"):::feature
    AG_Entry -->|"renders"| AG_P
    AG_P -->|"delegates to"| AG_D
    AG_D -->|"fetches from"| AG_Data
  end

  %% Feature Modules: Home
  subgraph "Home Module"
    HM_Entry("Home Module Entry"):::feature
    HM_P("Home Presentation (HomeScreen)"):::feature
    HM_D("Home Domain"):::feature
    HM_Data("Home Data"):::feature
    HM_Entry -->|"renders"| HM_P
    HM_P -->|"delegates to"| HM_D
    HM_D -->|"fetches from"| HM_Data
  end

  %% Core and Shared Modules
  subgraph "Core & Shared Modules"
    CORE("Core Libraries"):::core
    CORE1("Core (core.dart)"):::core
    SERVICE("Dependency Injection (Service Locator)"):::core
    ROUTER("Routes (App Router)"):::core
    SHARED("Shared Dependencies"):::core
    I18N("Shared i18n"):::core
    CORE --> CORE1
    CORE1 --> SERVICE
    SERVICE --> ROUTER
  end

  %% Platform Specific
  subgraph "Platform Specific"
    AND("Android Native"):::platform
    IOS("iOS Native"):::platform
  end

  %% Automation & Dependency Management
  subgraph "Automation & Dependency Management"
    AUTO("Automation Tools"):::automation
  end

  %% Inter-Module Connections
  A_F -->|"initiates"| AG_Entry
  A_F -->|"initiates"| HM_Entry
  SERVICE -->|"injects into"| AG_D
  SERVICE -->|"injects into"| HM_D
  I18N -->|"localizes"| A_F
  AND -->|"integrates with"| A_F
  IOS -->|"integrates with"| A_F
  AUTO -->|"manages"| CORE

  %% Styles
  classDef frontend fill:#f4cccc,stroke:#333,stroke-width:2px;
  classDef feature fill:#d9ead3,stroke:#333,stroke-width:2px;
  classDef core fill:#c9daf8,stroke:#333,stroke-width:2px;
  classDef platform fill:#fff2cc,stroke:#333,stroke-width:2px;
  classDef automation fill:#ead1dc,stroke:#333,stroke-width:2px;

  %% Click Events for Flutter Frontend
  click A_F "https://github.com/rizaadi/valorantlab/blob/main/lib/main.dart"
  click A_F "https://github.com/rizaadi/valorantlab/blob/main/lib/main_dev.dart"
  click A_F "https://github.com/rizaadi/valorantlab/blob/main/lib/app.dart"
  click A_F "https://github.com/rizaadi/valorantlab/blob/main/lib/flavors.dart"

  %% Click Events for Agent Module
  click AG_Entry "https://github.com/rizaadi/valorantlab/tree/main/features/agent/lib"
  click AG_Entry "https://github.com/rizaadi/valorantlab/blob/main/features/agent/lib/agent.dart"
  click AG_P "https://github.com/rizaadi/valorantlab/blob/main/features/agent/lib/presentation/agent/screen/agent_screen.dart"
  click AG_D "https://github.com/rizaadi/valorantlab/blob/main/features/agent/lib/domain/usecases/get_agents_usecase.dart"

  %% Click Events for Home Module
  click HM_Entry "https://github.com/rizaadi/valorantlab/tree/main/features/home/lib"
  click HM_Entry "https://github.com/rizaadi/valorantlab/blob/main/features/home/lib/home.dart"
  click HM_P "https://github.com/rizaadi/valorantlab/blob/main/features/home/lib/presentation/home_screen.dart"

  %% Click Events for Core & Shared Modules
  click CORE "https://github.com/rizaadi/valorantlab/tree/main/packages/core"
  click CORE1 "https://github.com/rizaadi/valorantlab/blob/main/packages/core/lib/core.dart"
  click SERVICE "https://github.com/rizaadi/valorantlab/blob/main/packages/core/lib/di/service_locator.dart"
  click ROUTER "https://github.com/rizaadi/valorantlab/blob/main/packages/core/lib/routes/app_router.dart"
  click SHARED "https://github.com/rizaadi/valorantlab/blob/main/shared/dependencies/lib/dependencies.dart"
  click I18N "https://github.com/rizaadi/valorantlab/blob/main/shared/i18n/lib/i18n.dart"

  %% Click Events for Platform Specific
  click AND "https://github.com/rizaadi/valorantlab/blob/main/android/app/src/main/kotlin/com/example/valorantlab/MainActivity.kt"
  click AND "https://github.com/rizaadi/valorantlab/blob/main/android/app/src/main/AndroidManifest.xml"
  click IOS "https://github.com/rizaadi/valorantlab/blob/main/ios/Runner/AppDelegate.swift"
  click IOS "https://github.com/rizaadi/valorantlab/blob/main/ios/Runner/Info.plist"

  %% Click Events for Automation & Dependency Management
  click AUTO "https://github.com/rizaadi/valorantlab/blob/main/melos.yaml"
  click AUTO "https://github.com/rizaadi/valorantlab/tree/main/.husky/commit-msg"
  click AUTO "https://github.com/rizaadi/valorantlab/tree/main/.husky/pre-commit"
  click AUTO "https://github.com/rizaadi/valorantlab/blob/main/commitlint.yaml"
```
