# dxavsoul/barberdule architecture

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

- Interactive diagram: https://gitdiagram.com/dxavsoul/barberdule
- Repository: https://github.com/dxavsoul/barberdule

## Overview

##### Main Components
- Frontend (Flutter UI): Represented by the lib/presentation directory which contains screens (e.g., login, registration, home, barber-specific screens, customer-specific screens) and widgets. This component includes separate views for different user roles (barbers, barbershops, customers, and admin).
- Business Logic Layer (BLoC): Found under lib/logic/blocs. This layer manages state transitions, event handling, and business rules using distinct blocs for authentication, registration, appointment scheduling, profile management, map integration, and service management.
- Data Layer: Located in lib/data, it includes models (e.g., appointment, barber, customer, service), repositories (for auth, appointment, etc.), and constants. This encapsulates API calls and any Firebase interactions.
- Platform-Specific Configurations: Separate native code bases are in android, ios, and web directories. They include configuration files (Gradle, Xcode project files) for deploying the app on different platforms.
- Firebase Backend: While not physically present in the file structure, the project integrates Firebase (e.g., via lib/firebase_options.dart) to handle authentication, real-time data sync, and possibly cloud functions. Represent this as an external service.

##### Relationships and Interactions
- The UI components (presentation layer) send user events to the BLoC components.
- BLoCs process these events and rely on the Data Layer (via repositories) to fetch or update data.
- The data repositories interact with Firebase (and any RESTful APIs if applicable) to persist and retrieve information.
- Data flows from Firebase into repositories then propagate up through the BLoC layer to update UI components.

##### Technologies and Frameworks
- Flutter is the primary framework, serving as the cross-platform UI solution.
- Firebase provides backend services (e.g., authentication, real-time database or Firestore).
- The BLoC pattern is pivotal for state management.
- Native configurations for Android, iOS, and Web emphasize the multi-platform nature of the application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Layers"
        UI["Flutter UI (lib/presentation)"]:::frontend
        BLOC["BLoC Layer (lib/logic/blocs)"]:::bloc
        DATA["Data Layer (lib/data)"]:::data
        FIREBASE["Firebase Backend (lib/firebase_options.dart)"]:::firebase
    end

    subgraph "Platform Configurations"
        ANDROID["Android (android)"]:::platform
        IOS["iOS (ios)"]:::platform
        WEB["Web (web)"]:::platform
    end

    UI -->|"sendsEvents"| BLOC
    BLOC -->|"callsRepo"| DATA
    DATA -->|"interactsWith"| FIREBASE

    ANDROID -->|"deploysTo"| UI
    IOS -->|"deploysTo"| UI
    WEB -->|"deploysTo"| UI

    click UI "https://github.com/dxavsoul/barberdule/tree/main/lib/presentation"
    click BLOC "https://github.com/dxavsoul/barberdule/tree/main/lib/logic/blocs"
    click DATA "https://github.com/dxavsoul/barberdule/tree/main/lib/data"
    click FIREBASE "https://github.com/dxavsoul/barberdule/blob/main/lib/firebase_options.dart"
    click ANDROID "https://github.com/dxavsoul/barberdule/tree/main/android"
    click IOS "https://github.com/dxavsoul/barberdule/tree/main/ios"
    click WEB "https://github.com/dxavsoul/barberdule/tree/main/web"

    classDef frontend fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef bloc fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef data fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
    classDef firebase fill:#d1c4e9,stroke:#5e35b1,stroke-width:2px;
    classDef platform fill:#ffccbc,stroke:#ef6c00,stroke-width:2px;
```
