# resourceful-nebil/flutter-clean-architecture-starter-kit-template architecture

> Architecture diagram of the GitHub repository resourceful-nebil/flutter-clean-architecture-starter-kit-template, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/resourceful-nebil/flutter-clean-architecture-starter-kit-template
- Repository: https://github.com/resourceful-nebil/flutter-clean-architecture-starter-kit-template

## Overview

##### Main Components

a) Presentation Layer (Top)
- UI Components (Screens & Widgets)
- State Management (Cubit/BLoC)

b) Domain Layer (Middle)
- Entities
- Use Cases
- Repository Interfaces

c) Data Layer (Bottom)
- Repository Implementations
- Data Sources (Remote & Local)
- Models

d) Core Infrastructure (Side)
- Network Info
- API Consumer
- Cache Helper
- Error Handling

**┌─────────────────────────────────────────────────────────────┐**
- Presentation Layer                        │
- ┤
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐         │
- User Screen  │  │Post Screen  │  │Template     │         │
- & Widgets    │  │             │  │Screen       │         │
- ┬──────┘  └──────┬──────┘  └──────┬──────┘         │
- ┌──────┴──────┐  ┌──────┴──────┐  ┌──────┴──────┐         │
- User Cubit   │  │Post Cubit   │  │Template     │         │
- Cubit        │         │
- ┬──────┘  └──────┬──────┘  └──────┬──────┘         │
- ┼───────────────┼───────────────┼────────────────┤
- Domain Layer                          │
- ┼───────────────┼───────────────┼────────────────┤
- ┌──────┴──────┐  ┌──────┴──────┐  ┌──────┴──────┐      │
- User Entity  │  │Post Entity  │  │Template     │      │
- & Use Cases  │  │& Use Cases  │  │Entity       │      │
- ┬──────┘  └──────┬──────┘  └──────┬──────┘      │
- ┼───────────────┼───────────────┼────────────────┤
- Data Layer                          │
- ┼───────────────┼───────────────┼────────────────┤
- ┌──────┴──────┐  ┌──────┴──────┐  ┌──────┴──────┐      │
- User Repo    │  │Post Repo    │  │Template     │      │
- Impl         │  │Impl         │  │Repo Impl    │      │
- ┬──────┘  └──────┬──────┘  └──────┬──────┘      │
- ┌──────┴──────┐  ┌──────┴──────┐  ┌──────┴──────┐      │
- Data Sources │  │Data Sources │  │Data Sources │      │
- Remote/Local │  │Remote/Local │  │Remote/Local │      │
- ┘  └─────────────┘  └─────────────┘      │
- ┘

- ┬───────┴──────────┬──────┘
- ┌──────┴──────┐     ┌─────┴─────┐
- Core Network │     │Core Cache │
- & API        │     │           │
- ┘     └───────────┘

##### Important Elements to Highlight

a) Dependencies Flow:
- Dependency injection paths

b) Data Flow:
- How data moves from API/Cache through repositories to UI
- Error handling paths

c) Feature Modules:
- Clearly separate User, Post, and Template features
- Shared core dependencies

##### Implementation Details

- Use standardized UML notation where appropriate
- Brief descriptions of key components
- Major interfaces and abstract classes
- Where dependency injection occurs

Remember to include the core utilities (network_info, api_consumer, cache_helper) as supporting infrastructure, showing how they interact with the main architectural components.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef presentation fill:#4A90E2,color:white
    classDef domain fill:#50C878,color:white
    classDef data fill:#FFA500,color:white
    classDef core fill:#808080,color:white
    
    %% Core Infrastructure
    subgraph Core
        NetworkInfo["Network Info"]:::core
        APIConsumer["API Consumer"]:::core
        CacheHelper["Cache Helper"]:::core
        ErrorHandling["Error Handling"]:::core
    end
    
    %% User Feature
    subgraph UserFeature
        %% Presentation Layer
        UserScreen["User Screen"]:::presentation
        UserWidgets["User Widgets"]:::presentation
        UserCubit["User Cubit"]:::presentation
        
        %% Domain Layer
        UserEntity["User Entity"]:::domain
        UserUseCases["User Use Cases"]:::domain
        UserRepository["User Repository Interface"]:::domain
        
        %% Data Layer
        UserRepoImpl["User Repository Implementation"]:::data
        UserRemoteDS["User Remote Data Source"]:::data
        UserLocalDS["User Local Data Source"]:::data
        UserModel["User Model"]:::data
    end
    
    %% Post Feature
    subgraph PostFeature
        %% Presentation Layer
        PostScreen["Post Screen"]:::presentation
        PostCubit["Post Cubit"]:::presentation
        
        %% Domain Layer
        PostEntity["Post Entity"]:::domain
        PostUseCases["Post Use Cases"]:::domain
        PostRepository["Post Repository Interface"]:::domain
        
        %% Data Layer
        PostRepoImpl["Post Repository Implementation"]:::data
        PostRemoteDS["Post Remote Data Source"]:::data
        PostLocalDS["Post Local Data Source"]:::data
        PostModel["Post Model"]:::data
    end
    
    %% Template Feature
    subgraph TemplateFeature
        %% Presentation Layer
        TemplateScreen["Template Screen"]:::presentation
        TemplateCubit["Template Cubit"]:::presentation
        
        %% Domain Layer
        TemplateEntity["Template Entity"]:::domain
        TemplateUseCases["Template Use Cases"]:::domain
        TemplateRepository["Template Repository Interface"]:::domain
        
        %% Data Layer
        TemplateRepoImpl["Template Repository Implementation"]:::data
        TemplateRemoteDS["Template Remote Data Source"]:::data
        TemplateLocalDS["Template Local Data Source"]:::data
        TemplateModel["Template Model"]:::data
    end
    
    %% Relationships
    UserScreen --> UserCubit
    UserWidgets --> UserCubit
    UserCubit --> UserUseCases
    UserUseCases --> UserRepository
    UserRepository --> UserRepoImpl
    UserRepoImpl --> UserRemoteDS & UserLocalDS
    UserRemoteDS & UserLocalDS --> UserModel
    UserModel --> UserEntity
    
    PostScreen --> PostCubit
    PostCubit --> PostUseCases
    PostUseCases --> PostRepository
    PostRepository --> PostRepoImpl
    PostRepoImpl --> PostRemoteDS & PostLocalDS
    PostRemoteDS & PostLocalDS --> PostModel
    PostModel --> PostEntity
    
    TemplateScreen --> TemplateCubit
    TemplateCubit --> TemplateUseCases
    TemplateUseCases --> TemplateRepository
    TemplateRepository --> TemplateRepoImpl
    TemplateRepoImpl --> TemplateRemoteDS & TemplateLocalDS
    TemplateRemoteDS & TemplateLocalDS --> TemplateModel
    TemplateModel --> TemplateEntity
    
    UserRemoteDS & PostRemoteDS & TemplateRemoteDS --> APIConsumer
    UserLocalDS & PostLocalDS & TemplateLocalDS --> CacheHelper
    APIConsumer --> NetworkInfo
    
    %% Click Events
    click NetworkInfo "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/core/connection/network_info.dart"
    click APIConsumer "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/core/databases/api/api_consumer.dart"
    click CacheHelper "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/core/databases/cache/cache_helper.dart"
    click ErrorHandling "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/tree/master/lib/core/errors/"
    click UserScreen "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/presentation/screens/user_screen.dart"
    click UserWidgets "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/tree/master/lib/features/user/presentation/widgets/"
    click UserCubit "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/presentation/cubit/user_cubit.dart"
    click UserEntity "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/domain/entities/user_entitiy.dart"
    click UserRepository "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/domain/repositories/user_repository.dart"
    click UserUseCases "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/domain/usecases/get_user.dart"
    click UserRepoImpl "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/data/repositories/user_repository_impl.dart"
    click UserRemoteDS "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/data/datasources/user_remote_data_source.dart"
    click UserLocalDS "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/data/datasources/user_local_data_source.dart"
    click UserModel "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/user/data/models/user_model.dart"
    click PostScreen "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/presentation/screens/post_screen.dart"
    click PostEntity "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/domain/entities/post_entitiy.dart"
    click PostRepository "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/domain/repositories/post_repository.dart"
    click PostUseCases "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/domain/usecases/get_post.dart"
    click PostRepoImpl "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/data/repositories/post_repository_impl.dart"
    click PostRemoteDS "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/data/datasources/post_remote_data_source.dart"
    click PostLocalDS "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/data/datasources/post_local_data_source.dart"
    click PostModel "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/post/data/models/post_model.dart"
    click TemplateScreen "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/presentation/screens/template_screen.dart"
    click TemplateEntity "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/domain/entities/template_entitiy.dart"
    click TemplateRepository "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/domain/repositories/template_repository.dart"
    click TemplateUseCases "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/domain/usecases/get_template.dart"
    click TemplateRepoImpl "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/data/repositories/template_repository_impl.dart"
    click TemplateRemoteDS "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/data/datasources/template_remote_data_source.dart"
    click TemplateLocalDS "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/data/datasources/template_local_data_source.dart"
    click TemplateModel "https://github.com/resourceful-nebil/Flutter-Clean-Architecture-Starter-Kit-Template/blob/master/lib/features/template/data/models/template_model.dart"
```
