# fabrice-fabio/rentapp architecture

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

- Interactive diagram: https://gitdiagram.com/fabrice-fabio/rentapp
- Repository: https://github.com/fabrice-fabio/rentapp

## Overview

##### Project Type and Purpose
- This is a cross-platform client application (mobile, web, desktop) built with Flutter.
- It follows Clean Architecture and uses Firebase as its backend.
- It implements the BLoC pattern for state management and integrates OpenStreetMap for map features.
- Primary purpose: allow users to browse, view details, and rent cars.

##### High-Level File Structure Analysis
- `android/`, `ios/`, `web/`, `linux/`, `macos/`, `windows/`: platform-specific build shells generated by Flutter.
- `lib/`: core application code, subdivided by Clean Architecture layers:
- `presentation/` (UI, BLoCs, pages, widgets)
- `domain/` (use cases, repository interfaces)
- `data/` (repository implementations, data sources, models)
- `injection_container.dart` (dependency injection)
- `main.dart` (app entry point)
- Firebase configuration (`firebase_options.dart`) and service account files under platform folders.
- Build and config files (`pubspec.yaml`, Gradle scripts, Xcode projects, CMakeLists).

##### Key Architectural Patterns
- Clean Architecture (Presentation → Domain → Data → External)
- BLoC for state management (Presentation layer)
- Dependency Injection via `injection_container.dart` (likely using get_it)
- Repository pattern to abstract data sources
- External service integration: Firebase Firestore & OpenStreetMap API

##### Core Components
A. Flutter Application Shell
– Platform Layers (Android, iOS, Web, Desktop)
– Single shared Flutter engine
B. Presentation Layer
– UI Pages (e.g., CarListScreen, MapsDetailsPage, OnboardingPage)
– Widgets (CarCard, MoreCard)
– BLoCs (CarBloc, CarEvent, CarState)
C. Domain Layer
– Use Cases (GetCars)
– Repository Interfaces (CarRepository)
– Entities/Models (Car)
D. Data Layer
– Repository Implementations (CarRepositoryImpl)
– Data Sources (FirebaseCarDataSource)
– Data Models (car.dart)
E. External Services
– Firebase Firestore / Auth / Storage
– OpenStreetMap service/API
F. Dependency Injection
– get_it container (`injection_container.dart`)

##### Relationships and Data Flow
1. User interacts with UI in Presentation
2. Presentation dispatches events to BLoC
3. BLoC calls Domain use cases (GetCars)
4. Use cases invoke Repository interface
5. Repository implementation routes calls to Data Source
6. Data Source communicates with Firebase or OpenStreetMap API
7. Data is returned up through models → entities → UI
8. All dependencies invert toward Domain interfaces via DI container

##### Elements
- Clear component names matching directory names or class names.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Flutter Shell
    subgraph "Flutter Application Shell"
        direction TB
        A["Android"]:::shell
        B["iOS"]:::shell
        C["Web"]:::shell
        D["Linux"]:::shell
        E["macOS"]:::shell
        F["Windows"]:::shell
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        UI1["CarListScreen"]:::presentation
        UI2["CarDetailsPage"]:::presentation
        UI3["MapsDetailsPage"]:::presentation
        UI4["OnboardingPage"]:::presentation
        W1["CarCard"]:::presentation
        W2["MoreCard"]:::presentation
        B1["CarBloc"]:::presentation
        B2["CarEvent"]:::presentation
        B3["CarState"]:::presentation
    end

    %% Dependency Injection
    DI["injection_container.dart"]:::injection

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        UC["GetCars"]:::domain
        RI["CarRepository"]:::domain
        E["Car Entity"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        RImpl["CarRepositoryImpl"]:::data
        DS["FirebaseCarDataSource"]:::data
        DM["Car Model"]:::data
    end

    %% External Services
    subgraph "External Services"
        direction TB
        FB["Firebase Firestore/Auth/Storage"]:::external
        OSM["OpenStreetMap API"]:::external
    end

    %% Connections
    UI1 -->|dispatch event| B1
    UI2 -->|dispatch event| B1
    UI3 -->|dispatch event| B1
    UI4 -->|dispatch event| B1
    W1 --> UI1
    W2 --> UI1
    UI3 -->|fetch map data| OSM
    B1 -->|call use case| UC
    UC -->|invoke interface| RI
    RI -->|to implementation| RImpl
    RImpl -->|fetch from| DS
    DS -->|request/response| FB
    DS -->|request/response| OSM
    DS -->|map to model| DM
    DM -->|to entity| E
    E -->|to UI| UI1
    DI -->|inject| B1
    DI -->|inject| UC
    DI -->|inject| RI
    DI -->|inject| RImpl
    DI -->|inject| DS

    %% Click Events
    click A "https://github.com/fabrice-fabio/rentapp/tree/main/android/"
    click B "https://github.com/fabrice-fabio/rentapp/tree/main/ios/"
    click C "https://github.com/fabrice-fabio/rentapp/tree/main/web/"
    click D "https://github.com/fabrice-fabio/rentapp/tree/main/linux/"
    click E "https://github.com/fabrice-fabio/rentapp/tree/main/macos/"
    click F "https://github.com/fabrice-fabio/rentapp/tree/main/windows/"
    click UI1 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/pages/car_list_screen.dart"
    click UI2 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/pages/car_details_page.dart"
    click UI3 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/pages/MapsDetailsPage.dart"
    click UI4 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/pages/onboarding_page.dart"
    click W1 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/widgets/car_card.dart"
    click W2 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/widgets/more_card.dart"
    click B1 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/bloc/car_bloc.dart"
    click B2 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/bloc/car_event.dart"
    click B3 "https://github.com/fabrice-fabio/rentapp/blob/main/lib/presentation/bloc/car_state.dart"
    click UC "https://github.com/fabrice-fabio/rentapp/blob/main/lib/domain/usecases/get_cars.dart"
    click RI "https://github.com/fabrice-fabio/rentapp/blob/main/lib/domain/repositories/car_repository.dart"
    click RImpl "https://github.com/fabrice-fabio/rentapp/blob/main/lib/data/repositories/car_repository_impl.dart"
    click DS "https://github.com/fabrice-fabio/rentapp/blob/main/lib/data/datasources/firebase_car_data_source.dart"
    click DM "https://github.com/fabrice-fabio/rentapp/blob/main/lib/data/models/car.dart"
    click DI "https://github.com/fabrice-fabio/rentapp/blob/main/lib/injection_container.dart"
    click M "https://github.com/fabrice-fabio/rentapp/blob/main/lib/main.dart"
    click FO "https://github.com/fabrice-fabio/rentapp/blob/main/lib/firebase_options.dart"
    click G1 "https://github.com/fabrice-fabio/rentapp/blob/main/android/app/google-services.json"
    click G2 "https://github.com/fabrice-fabio/rentapp/blob/main/ios/Runner/GoogleService-Info.plist"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef domain fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef shell fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef injection fill:#FFB6C1,stroke:#333,stroke-width:1px
```
