# uitdevpro1999/flutter_codebase_clean architecture

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

- Interactive diagram: https://gitdiagram.com/uitdevpro1999/flutter_codebase_clean
- Repository: https://github.com/uitdevpro1999/flutter_codebase_clean

## Overview

##### Project Type Analysis
This is a Flutter mobile application following Clean Architecture principles with multi-platform support (Android, iOS, web, desktop). The project emphasizes SOLID principles and Dependency Injection, using Bloc/Cubit for state management.

##### Main Architectural Components

A. Presentation Layer (UI)
- Features modules (auth, main, splash)
- Bloc/Cubit components
- Pages and widgets

B. Domain Layer
- Use cases
- Entities
- Repository interfaces

C. Data Layer
- Repository implementations
- Data sources
- Models (Request/Response)

D. Core Infrastructure
- Network handling
- Local storage
- Navigation
- Analytics
- Localization

##### A three-layer vertical division representing Clean Architecture
- ┌─────────────────────┐
- Presentation      │
- ┤
- Domain           │
- ┤
- Data             │
- ┘

##### Specific components

a. Core Infrastructure (as a side panel):
- Network Provider (Dio)
- Local Storage (SharedPreferences)
- Navigation Manager
- Analytics Manager
- Localization Manager

b. Feature Modules (in Presentation):
- Auth Feature
- Main Feature
- Splash Feature
Each with their respective:
- Pages
- Bloc/Cubit
- States

c. Domain Layer:
- Use Cases
- Repository Interfaces
- Entities

d. Data Layer:
- Repository Implementations
- Remote Data Sources
- Local Data Sources
- Models

##### Important Details
- Dependency Injection flow
- Error handling pathways
- Data transformation flow
- Feature-specific boundaries

##### Specific Implementation Notes
- How features are isolated and independent
- How the core layer provides common functionality
- Demonstrate the clean architecture dependency rule (dependencies point inward)
- Error handling and network exception flows

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this project unique, such as the feature-first organization and the clean architecture implementation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef presentation fill:#4A90E2,color:white
    classDef domain fill:#2ECC71,color:white
    classDef data fill:#E67E22,color:white
    classDef core fill:#9B59B6,color:white
    classDef external fill:#95A5A6,color:white

    %% Main Application Entry
    MainEntry["Main Entry"]:::presentation
    AppConfig["App Configuration"]:::presentation
    DI["Dependency Injection"]:::core

    %% Core Infrastructure
    subgraph CoreInfra["Core Infrastructure"]
        Network["Network Handler"]:::core
        LocalStorage["Local Storage"]:::core
        Navigation["Navigation Manager"]:::core
        Analytics["Analytics Manager"]:::core
        Localization["Localization Manager"]:::core
        ErrorHandling["Error Handler"]:::core
        BaseClasses["Base Classes"]:::core
    end

    %% Presentation Layer
    subgraph PresentationLayer["Presentation Layer"]
        AuthUI["Auth Feature UI"]:::presentation
        MainUI["Main Feature UI"]:::presentation
        SplashUI["Splash Feature UI"]:::presentation
        AppBloc["App-level Bloc"]:::presentation
    end

    %% Domain Layer
    subgraph DomainLayer["Domain Layer"]
        AuthDomain["Auth Domain"]:::domain
        UseCases["Use Cases"]:::domain
        Entities["Entities"]:::domain
        RepoInterfaces["Repository Interfaces"]:::domain
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        RepoImpl["Repository Implementations"]:::data
        DataSources["Data Sources"]:::data
        Models["Models"]:::data
    end

    %% Feature Modules
    subgraph Features["Feature Modules"]
        AuthFeature["Auth Feature"]:::presentation
        MainFeature["Main Feature"]:::presentation
        SplashFeature["Splash Feature"]:::presentation
        AppFeature["App Feature"]:::presentation
    end

    %% External Services
    Backend["Backend APIs"]:::external
    AnalyticsService["Analytics Services"]:::external
    PushNotification["Push Notifications"]:::external

    %% Relationships
    MainEntry --> AppConfig
    AppConfig --> DI
    DI --> CoreInfra
    DI --> Features

    PresentationLayer --> DomainLayer
    DomainLayer --> DataLayer
    DataLayer --> Backend

    CoreInfra --> AnalyticsService
    CoreInfra --> PushNotification

    %% Click Events
    click MainEntry "https://github.com/uitdevpro1999/flutter_codebase_clean/blob/master/lib/main.dart"
    click AppConfig "https://github.com/uitdevpro1999/flutter_codebase_clean/blob/master/lib/app.dart"
    click DI "https://github.com/uitdevpro1999/flutter_codebase_clean/blob/master/lib/injection_container.dart"
    click Network "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/core/network/"
    click LocalStorage "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/core/local_storage/"
    click Navigation "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/core/routes/"
    click Analytics "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/core/managers/analytics/"
    click Localization "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/core/localizations/"
    click ErrorHandling "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/core/error/"
    click BaseClasses "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/core/common/bases/"
    click AuthUI "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/presentation/"
    click MainUI "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/main/presentation/"
    click SplashUI "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/splash/presentation/"
    click AppBloc "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/app/presentation/bloc/"
    click AuthDomain "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/domain/"
    click UseCases "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/domain/usecases/"
    click Entities "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/domain/entities/"
    click RepoInterfaces "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/domain/repository/"
    click RepoImpl "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/data/repositories/"
    click DataSources "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/data/datasources/"
    click Models "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/data/models/"
    click AuthFeature "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/auth/"
    click MainFeature "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/main/"
    click SplashFeature "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/splash/"
    click AppFeature "https://github.com/uitdevpro1999/flutter_codebase_clean/tree/master/lib/features/app/"
```
