# skieabad/blog_app architecture

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

- Interactive diagram: https://gitdiagram.com/skieabad/blog_app
- Repository: https://github.com/skieabad/blog_app

## Overview

##### Main Components
- Platform-specific Shells: Represent the native Android, iOS, and web projects which handle platform integrations. These are primarily in the “android”, “ios”, and “web” directories.
- Flutter Application Layer: The common application code found in “lib”, which is the heart of the project.
- Core Module: Under “lib/core”, include fundamental elements such as:
- Utilities (e.g., image_picker, show_loader, show_snackbar)
- Theming (app_palette, theme files)
- Error handling (exceptions, failure classes)
- Shared cubits for state management (e.g., app_user_cubit)
- Feature Modules: Within “lib/features” you have the “auth” and “blog” components:
- Each feature follows a layered structure:
- Data Layer: Contains data sources (e.g., the Supabase datasource for authentication), data models (user_model), and repository implementations.
- Domain Layer: Houses business logic abstractions like repository interfaces and use cases (e.g., user_sign_in_case, user_sign_up_case, current_user_case).
- Presentation Layer: Contains UI components (pages, widgets) and state management (e.g., bloc classes and events/states) that interact with the domain layer.
- Application Bootstrap: The entry point files like “lib/app.dart” and “lib/init_dependencies.dart” which initialize dependency injection and overall app configuration.

##### Relationships and Interactions
- Blocs/cubits to the use cases in the domain layer, demonstrating that UI actions trigger business logic processing.
- Further, indicate that the use cases rely on repository interfaces which are implemented in the data layer, where data sources (like Supabase) actually perform external service calls.
- “core” components (utilities, theming, error handling) used across both features and layers.

##### Architectural Patterns and Technologies
- Feature-based Modularization: Each major feature (auth and blog) follows the three-layer structure.
- State Management with Bloc/Cubit: The use of “bloc” and “cubits” folders shows state management patterns driving UI interactions.

##### Elements
- Callouts or annotations to mention important frameworks/technologies (Flutter, Clean Architecture, Bloc/Cubit pattern, dependency injection).

##### Additional Recommendations
- Use a modular view: Start with a high-level overview showing the main platform wrappers and the Flutter app, then drill down to illustrate the clean separation of concerns within the “lib” folder.
- Be explicit about dependencies: For instance, show how the auth feature’s use cases rely on both repository interfaces and underlying Supabase data services.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Platform-specific Shells
    A["Android Shell"]:::platform
    B["iOS Shell"]:::platform
    C["Web Shell"]:::platform

    %% Flutter Application Layer
    F["Flutter App (lib)"]:::flutter

    %% Connect platform shells to Flutter App
    A --> F
    B --> F
    C --> F

    %% Flutter Application Subgraphs
    subgraph "Flutter Application (lib)"
        %% Core Module
        subgraph "Core Module"
            UTIL["Utilities"]:::core
            THEME["Theming"]:::core
            ERR["Error Handling"]:::core
            CUBITS["Shared Cubits"]:::core
            ENT["Core Entities"]:::core
            USECASE["Core Use Case Base"]:::core
        end

        %% Feature Modules
        subgraph "Feature Modules"
            %% Auth Feature
            subgraph "Auth Feature"
                %% Presentation Layer
                subgraph "Presentation Layer"
                    AUTH_PAGES["Auth Pages"]:::authPres
                    AUTH_WIDGETS["Auth Widgets"]:::authPres
                    AUTH_BLOC["Auth Bloc"]:::authPres
                end
                %% Domain Layer
                subgraph "Domain Layer"
                    AUTH_USE["Auth Use Cases"]:::authDom
                    AUTH_REPO["Auth Repository Interface"]:::authDom
                end
                %% Data Layer
                subgraph "Data Layer"
                    AUTH_DS["Auth Datasources"]:::authData
                    AUTH_MODELS["Auth Models"]:::authData
                    AUTH_REPO_IMPL["Auth Repository Impl"]:::authData
                end
            end

            %% Blog Feature
            subgraph "Blog Feature"
                subgraph "Presentation Layer"
                    BLOG_PAGES["Blog Pages"]:::blogPres
                    BLOG_WIDGETS["Blog Widgets"]:::blogPres
                end
            end
        end

        %% Application Bootstrap
        subgraph "Application Bootstrap"
            APP["app.dart"]:::bootstrap
            INIT["init_dependencies.dart"]:::bootstrap
            MAIN["main.dart"]:::bootstrap
        end
    end

    %% Connections for Application Bootstrap
    APP -->|"initializes"| INIT
    INIT -->|"injects"| AUTH_REPO_IMPL

    %% Auth Feature Flow
    AUTH_PAGES -->|"triggers"| AUTH_BLOC
    AUTH_BLOC -->|"calls"| AUTH_USE
    AUTH_USE -->|"uses"| AUTH_REPO
    AUTH_REPO -->|"implemented by"| AUTH_REPO_IMPL
    AUTH_REPO_IMPL -->|"fetches from"| AUTH_DS
    AUTH_REPO_IMPL -->|"converts via"| AUTH_MODELS

    %% Styles
    classDef platform fill:#f9e79f,stroke:#b9770e,stroke-width:2px;
    classDef flutter fill:#aed6f1,stroke:#5499c7,stroke-width:2px;
    classDef core fill:#d5f5e3,stroke:#2ecc71,stroke-width:2px;
    classDef authPres fill:#d6eaf8,stroke:#5dade2,stroke-width:2px;
    classDef authDom fill:#d5f5e3,stroke:#58d68d,stroke-width:2px;
    classDef authData fill:#fadbd8,stroke:#e74c3c,stroke-width:2px;
    classDef blogPres fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef bootstrap fill:#f5eef8,stroke:#af7ac5,stroke-width:2px;

    %% Click Events for Platform-specific Shells
    click A "https://github.com/skieabad/blog_app/tree/main/android/"
    click B "https://github.com/skieabad/blog_app/tree/main/ios/"
    click C "https://github.com/skieabad/blog_app/tree/main/web/"

    %% Click Events for Flutter Application Layer
    click F "https://github.com/skieabad/blog_app/tree/main/lib/"

    %% Click Events for Core Module
    click UTIL "https://github.com/skieabad/blog_app/tree/main/lib/core/utils/"
    click THEME "https://github.com/skieabad/blog_app/tree/main/lib/core/theme/"
    click ERR "https://github.com/skieabad/blog_app/tree/main/lib/core/error/"
    click CUBITS "https://github.com/skieabad/blog_app/tree/main/lib/core/cubits/app_user/"
    click ENT "https://github.com/skieabad/blog_app/tree/main/lib/core/entities/"
    click USECASE "https://github.com/skieabad/blog_app/blob/main/lib/core/use_case/use_case.dart"

    %% Click Events for Auth Feature - Data Layer
    click AUTH_DS "https://github.com/skieabad/blog_app/tree/main/lib/features/auth/data/datasources/"
    click AUTH_MODELS "https://github.com/skieabad/blog_app/tree/main/lib/features/auth/data/models/"
    click AUTH_REPO_IMPL "https://github.com/skieabad/blog_app/tree/main/lib/features/auth/data/repositories/"

    %% Click Events for Auth Feature - Domain Layer
    click AUTH_REPO "https://github.com/skieabad/blog_app/blob/main/lib/features/auth/domain/repository/auth_repository.dart"
    click AUTH_USE "https://github.com/skieabad/blog_app/tree/main/lib/features/auth/domain/use_cases/"

    %% Click Events for Auth Feature - Presentation Layer
    click AUTH_BLOC "https://github.com/skieabad/blog_app/tree/main/lib/features/auth/presentation/bloc/"
    click AUTH_PAGES "https://github.com/skieabad/blog_app/tree/main/lib/features/auth/presentation/pages/"
    click AUTH_WIDGETS "https://github.com/skieabad/blog_app/tree/main/lib/features/auth/presentation/widgets/"

    %% Click Events for Blog Feature - Presentation Layer
    click BLOG_PAGES "https://github.com/skieabad/blog_app/tree/main/lib/features/blog/presentation/pages/"
    click BLOG_WIDGETS "https://github.com/skieabad/blog_app/tree/main/lib/features/blog/presentation/widgets/"

    %% Click Events for Application Bootstrap
    click APP "https://github.com/skieabad/blog_app/blob/main/lib/app.dart"
    click INIT "https://github.com/skieabad/blog_app/blob/main/lib/init_dependencies.dart"
    click MAIN "https://github.com/skieabad/blog_app/blob/main/lib/main.dart"
```
