# amrsalahdev/fooddelivery architecture

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

- Interactive diagram: https://gitdiagram.com/amrsalahdev/fooddelivery
- Repository: https://github.com/amrsalahdev/fooddelivery

## Overview

##### Project type and purpose
- This is a cross-platform mobile/desktop Food Delivery application built entirely in Flutter (Android, iOS, web, Windows, macOS, Linux).
- It follows a feature-driven folder layout and implements a Clean-Architecture-inspired layering (presentation → domain → data) with Bloc/Cubit for state management, go_router for navigation, and a set of core services (authentication, location, toast).

##### High-level file structure analysis
- “lib/” holds all Dart source:
– “app/widgets” → shared UI controls
– “features/…” → each feature has sub-folders:
- “ui/screens” for Widgets and Bloc classes (presentation layer)
- “ui/cubit” (for login/register features) or none (stateless screens)
- “domain/usecases”, “domain/repo” → business logic interfaces
- “data/repo” → repository implementations
– “core/” → cross-cutting code:
- “services” (AuthService, LocationService, ToastService)
- “routes” (go_router config)
- “di” (dependency injection container)
- “main.dart” → app entry point, initializes DI, sets up Routing & Theme.

##### Key README insights
- Feature list: onboarding, login, register, home, cart management, checkout, order tracking.
- Packages: flutter_bloc, equatable, go_router, carousel_slider, toastification, etc.
- Design patterns: Bloc/Cubit, Clean Architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Dependencies
    subgraph "External Systems" 
        direction TB
        RESTAPI["Restaurant Backend"]:::external
        PaymentAPI["Payment Gateway"]:::external
        MapsAPI["Maps API"]:::external
    end

    %% Core Services
    subgraph "Core Services" 
        direction TB
        AuthService["AuthService"]:::core
        LocationService["LocationService"]:::core
        ToastService["ToastService"]:::core
    end

    %% Domain Layer
    subgraph "Domain Layer" 
        direction TB
        LoginUseCase["LoginUseCase"]:::domain
        RegisterUseCase["RegisterUseCase"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer" 
        direction TB
        LoginRepoImpl["LoginRepoImpl"]:::data
        RegisterRepoImpl["RegisterRepoImpl"]:::data
        HTTPClient["HTTP Client"]:::data
    end

    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        subgraph OnboardingFeature
            direction TB
            OnboardingScreen["OnBoardingScreen"]:::presentation
        end
        subgraph LoginFeature
            direction TB
            LoginScreen["LoginScreen"]:::presentation
            LoginCubit["LoginCubit"]:::presentation
        end
        subgraph RegisterFeature
            direction TB
            RegisterScreen["RegisterScreen"]:::presentation
            RegisterCubit["RegisterCubit"]:::presentation
        end
        subgraph HomeFeature
            direction TB
            HomeScreen["HomeScreen"]:::presentation
        end
    end

    %% Routing & DI
    subgraph "App Initialization"
        direction TB
        AppEntry["main.dart"]:::core
        DIContainer["DI Container (di.dart, di.config.dart)"]:::core
        AppRouter["AppRouter (go_router)"]:::core
    end

    %% Platform & Engine
    subgraph "Flutter Engine & Platform Channels"
        direction TB
        Platform["Android/iOS/Web/Linux/macOS/Windows"]:::platform
    end

    %% Relationships
    Platform -->|"launches"| AppEntry
    AppEntry -->|"initializes"| DIContainer
    DIContainer --> AuthService
    DIContainer --> LocationService
    DIContainer --> ToastService
    DIContainer --> LoginUseCase
    DIContainer --> RegisterUseCase
    DIContainer --> LoginRepoImpl
    DIContainer --> RegisterRepoImpl
    DIContainer --> AppRouter

    %% Presentation to Domain
    LoginScreen -->|"dispatch event"| LoginCubit
    LoginCubit -->|"executes"| LoginUseCase
    RegisterScreen -->|"dispatch event"| RegisterCubit
    RegisterCubit -->|"executes"| RegisterUseCase

    %% Domain to Data
    LoginUseCase -->|"calls"| LoginRepoImpl
    RegisterUseCase -->|"calls"| RegisterRepoImpl

    %% Data to External & Core Services
    LoginRepoImpl -->|"HTTP calls"| HTTPClient
    RegisterRepoImpl -->|"HTTP calls"| HTTPClient
    HTTPClient --> RESTAPI
    HTTPClient --> PaymentAPI
    LocationService --> MapsAPI

    %% Routing
    AppRouter --> OnboardingScreen
    AppRouter --> LoginScreen
    AppRouter --> RegisterScreen
    AppRouter --> HomeScreen

    %% Toast Notifications
    ToastService --> LoginScreen
    ToastService --> RegisterScreen

    %% Click Events
    click Platform "https://github.com/amrsalahdev/fooddelivery/tree/main/android/"
    click Platform "https://github.com/amrsalahdev/fooddelivery/tree/main/ios/"
    click Platform "https://github.com/amrsalahdev/fooddelivery/tree/main/linux/"
    click Platform "https://github.com/amrsalahdev/fooddelivery/tree/main/macos/"
    click Platform "https://github.com/amrsalahdev/fooddelivery/tree/main/web/"
    click Platform "https://github.com/amrsalahdev/fooddelivery/tree/main/windows/"
    click AppEntry "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/main.dart"
    click DIContainer "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/core/di/di.dart"
    click DIContainer "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/core/di/di.config.dart"
    click AppRouter "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/core/routes/app_router.dart"
    click AuthService "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/core/services/auth_service.dart"
    click LocationService "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/core/services/location_service.dart"
    click ToastService "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/core/services/toast_service.dart"
    click LoginScreen "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/login/ui/screens/login_screen.dart"
    click LoginCubit "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/login/ui/cubit/login_cubit.dart"
    click LoginUseCase "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/login/domain/usecases/login_usecase.dart"
    click LoginRepoImpl "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/login/data/repo/login_repo_impl.dart"
    click RegisterScreen "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/register/ui/screens/register_screen.dart"
    click RegisterCubit "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/register/ui/cubit/register_cubit.dart"
    click RegisterUseCase "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/register/domain/usecases/register_usecase.dart"
    click RegisterRepoImpl "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/register/data/repo/register_repo_impl.dart"
    click OnboardingScreen "https://github.com/amrsalahdev/fooddelivery/blob/main/lib/features/onboarding/ui/screens/on_boarding_screen.dart"

    %% 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 core fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#FF6347,stroke:#333,stroke-width:1px
    classDef platform fill:#D3D3D3,stroke:#333,stroke-width:1px
```
