# juandpt03/colibreria architecture

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

- Interactive diagram: https://gitdiagram.com/juandpt03/colibreria
- Repository: https://github.com/juandpt03/colibreria

## Overview

##### Project type and purpose
- This is a Flutter-based mobile application (“Colibreria”) targeting Android, iOS, Web, Linux, Windows, and macOS.
- It follows Clean Architecture to implement a client for searching and viewing technology books via an external API.

##### File structure
- Top-level platform folders (android/, ios/, linux/, macos/, windows/, web/) contain the platform-specific shell and build configs.
- lib/ is where all Dart code lives, subdivided into:
- src/core – cross-cutting concerns (config, constants, HTTP client, DI, theme, intl, error handling, utilities).
- src/features – grouped by feature (auth, home, shared), each with domain, data, and presentation subfolders.
- main.dart – app entry point.
- test/ holds unit tests for BLoCs and widgets.
- pubspec.yaml lists Flutter and 3rd-party dependencies (flutter_bloc, dio, get_it, go_router, etc.).

##### README for additional insights
- The README confirms Clean Architecture layering: presentation (UI & BLoC), domain (use cases & entities), data (models & data sources).
- It mentions key techs: Dio (HTTP), flutter_bloc + hydrated_bloc, go_router (routing), get_it (DI), cached_network_image, share_plus, url_launcher, and intl.

##### Elements
- Blue for Presentation
- Green for Domain
- Orange for Data
- Gray for Core Services
- Purple for External Systems
- Rounded rectangles for modules (features, core services)
- Clouds for external APIs

##### Detailed capture of essential architectural elements
- Break out each feature (auth, home, shared) into its own sub-component within each layer.
- Injector setup as the central hub wiring everything.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Platform Shells and Entry
    subgraph "Platform Shells" 
        direction TB
        Main["App Entry\nmain.dart"]:::core
        Android["Android\nMainActivity.kt"]:::core
        iOS["iOS\nAppDelegate.swift"]:::core
        Web["Web\nindex.html"]:::core
        Linux["Linux\nmain.cc"]:::core
        macOS["macOS\nAppDelegate.swift"]:::core
        Windows["Windows\nmain.cpp"]:::core
    end

    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        subgraph "Auth Feature" 
            direction TB
            AuthUI["Auth Screens & BLoC"]:::presentation
        end
        subgraph "Home Feature" 
            direction TB
            HomeUI["Home Screens & BLoC"]:::presentation
        end
        subgraph "Shared Feature" 
            direction TB
            SharedUI["Shared Widgets & BLoCs"]:::presentation
        end
    end

    %% Domain Layer
    subgraph "Domain Layer" 
        direction TB
        AuthDomain["Auth Repositories & Use Cases"]:::domain
        HomeDomain["Home Entities & Use Cases"]:::domain
        SharedDomain["Shared Entities"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer" 
        direction TB
        Models["Home Models"]:::data
        DataSource["ITBook Data Source"]:::data
        RepoImpl["Books Repository Impl"]:::data
    end

    %% Core Services
    subgraph "Core Services" 
        direction TB
        Injector["Dependency Injection"]:::core
        HTTPClient["HTTP Client"]:::core
        APIEndpoints["API Endpoints"]:::core
        Router["App Router"]:::core
        ErrorHandler["Error Handling"]:::core
        Logger["Logger & Utils"]:::core
        ThemeIntl["Theme & Intl"]:::core
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        API["Book API"]:::external
        LocalStorage["Local Persistence"]:::external
        ShareURL["Share & URL Launcher"]:::external
    end

    %% Connections
    Main -->|bootstraps| Injector
    Injector --> AuthUI
    Injector --> HomeUI
    Injector --> SharedUI

    AuthUI -->|"dispatch events"| AuthDomain
    HomeUI -->|"dispatch events"| HomeDomain
    SharedUI -->|"dispatch events"| SharedDomain

    AuthDomain -->|"use cases call"| RepoImpl
    HomeDomain -->|"use cases call"| RepoImpl
    SharedDomain -->|"entities used by"| AuthDomain

    RepoImpl --> DataSource
    DataSource --> HTTPClient
    HTTPClient --> API

    Injector --> HTTPClient
    Injector -->|configures| APIEndpoints
    Injector --> Router
    Router --> AuthUI
    Router --> HomeUI
    Router --> SharedUI

    Injector --> ErrorHandler
    Injector --> Logger
    Injector --> ThemeIntl

    Injector --> LocalStorage
    LocalStorage --> SharedUI
    SharedUI --> ShareURL

    %% Click Events
    click AuthUI "https://github.com/juandpt03/colibreria/tree/main/lib/src/features/auth/presentation"
    click HomeUI "https://github.com/juandpt03/colibreria/tree/main/lib/src/features/home/presentation"
    click SharedUI "https://github.com/juandpt03/colibreria/tree/main/lib/src/features/shared/presentation"
    click AuthDomain "https://github.com/juandpt03/colibreria/blob/main/lib/src/features/auth/domain/repositories/auth_repository.dart"
    click HomeDomain "https://github.com/juandpt03/colibreria/tree/main/lib/src/features/home/domain/entities"
    click HomeDomain "https://github.com/juandpt03/colibreria/blob/main/lib/src/features/home/domain/repositories/books_repository.dart"
    click HomeDomain "https://github.com/juandpt03/colibreria/blob/main/lib/src/features/home/domain/use_cases/books_use_cases.dart"
    click SharedDomain "https://github.com/juandpt03/colibreria/blob/main/lib/src/features/shared/domain/entities/user.dart"
    click Models "https://github.com/juandpt03/colibreria/tree/main/lib/src/features/home/data/models"
    click DataSource "https://github.com/juandpt03/colibreria/blob/main/lib/src/features/home/data/datasources/itbook_datasource.dart"
    click RepoImpl "https://github.com/juandpt03/colibreria/blob/main/lib/src/features/home/data/repositories/books_repository_impl.dart"
    click Injector "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/services/injector/injector.dart"
    click Injector "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/services/injector/injector_conf.dart"
    click HTTPClient "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/services/client/dio_http_client.dart"
    click HTTPClient "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/services/client/http_client.dart"
    click APIEndpoints "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/constants/api_endpoints.dart"
    click Router "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/router/app_router.dart"
    click Router "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/router/app_route.dart"
    click ErrorHandler "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/error/app_exeption.dart"
    click Logger "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/utils/logger.dart"
    click Logger "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/utils/debouncer.dart"
    click Logger "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/utils/env_loader.dart"
    click Logger "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/utils/url_launcher_handler.dart"
    click Logger "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/utils/share_handler.dart"
    click ThemeIntl "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/config/theme/app_theme.dart"
    click ThemeIntl "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/config/theme/text_theme.dart"
    click ThemeIntl "https://github.com/juandpt03/colibreria/blob/main/lib/src/core/config/intl/l10n.dart"
    click Main "https://github.com/juandpt03/colibreria/blob/main/lib/main.dart"
    click Android "https://github.com/juandpt03/colibreria/blob/main/android/app/src/main/kotlin/com/example/colibreria/MainActivity.kt"
    click iOS "https://github.com/juandpt03/colibreria/blob/main/ios/Runner/AppDelegate.swift"
    click Web "https://github.com/juandpt03/colibreria/blob/main/web/index.html"
    click Linux "https://github.com/juandpt03/colibreria/blob/main/linux/runner/main.cc"
    click macOS "https://github.com/juandpt03/colibreria/blob/main/macos/Runner/AppDelegate.swift"
    click Windows "https://github.com/juandpt03/colibreria/blob/main/windows/runner/main.cpp"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#0366D6,stroke-width:2px
    classDef domain fill:#DFF8E1,stroke:#2E8B57,stroke-width:2px
    classDef data fill:#FFE5B4,stroke:#FF8C00,stroke-width:2px
    classDef core fill:#E0E0E0,stroke:#7F7F7F,stroke-width:2px
    classDef external fill:#E5D1F5,stroke:#8A2BE2,stroke-width:2px
```
