# ramonsantospinto/app_delivery architecture

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

- Interactive diagram: https://gitdiagram.com/ramonsantospinto/app_delivery
- Repository: https://github.com/ramonsantospinto/app_delivery

## Overview

#### Purpose and Entry Points
Vakinha Burguer is a Flutter/Dart mobile food-delivery client: users authenticate, browse products, configure an order, choose payment, and submit it to a REST backend. Runtime startup is `lib/main.dart`, which launches the application shell in `lib/app/dw_delivery_app.dart`. Android embeds Flutter through `android/app/src/main/kotlin/br/com/academiadoflutter/vakinhaburguer/dw_delivery_app/MainActivity.kt`.

#### Application Composition and Navigation
The app is organized by feature pages, each generally owning its page, controller, state, and router. The flow begins at splash, then routes into authentication or the delivery experience:
- `lib/app/pages/splash/splash_page.dart`
- `lib/app/pages/auth/login/login_router.dart`
- `lib/app/pages/home/home_router.dart`
- `lib/app/pages/order/order_router.dart`

Feature routers are the navigation boundary between screens; controllers coordinate screen events and repository calls.

#### Dependency and Global Runtime Layer
Application-wide bindings and shared runtime services are assembled in `lib/app/core/provider/application_binding.dart`. Shared widget context is exposed by `lib/app/core/global/global.context.dart`. UI state uses a mix of Provider/BLoC-related packages and generated state artifacts, visible in feature state files such as:
- `lib/app/pages/auth/login/login_state.dart`
- `lib/app/pages/home/home_state2.dart`
- `lib/app/pages/order/order_state.dart`

The generated `*.g.dart` files indicate code-generated state/matching support.

#### Network, Environment, and Authentication Boundary
HTTP communication is centralized on a custom Dio client at `lib/app/core/rest_client/custom_dio.dart`; authentication headers/token behavior is separated into `lib/app/core/rest_client/interceptors/auth_interceptor.dart`. Backend configuration is sourced through `lib/app/core/config/env/env.dart`, with `.env` supplying environment values. Repository-specific failures and authorization failures are represented by:
- `lib/app/core/exceptions/repository_exception.dart`
- `lib/app/core/exceptions/unauthorized_exception.dart`

The documented backend is `json_rest_server`; requests should remain behind repositories rather than page/controllers.

#### Domain Repositories and Models
Repositories define the client-side API boundary for authentication, catalog retrieval, and order submission, with abstract contracts plus Dio-backed implementations:
- `lib/app/repositories/auth/auth_repository.dart`
- `lib/app/repositories/auth/auth_repository_impl.dart`
- `lib/app/repositories/products/products_repository_impl.dart`
- `lib/app/repositories/order/order_repository_impl.dart`

Core entities are `AuthModel`, `ProductModel`, and `PaymentTypeModel` under `lib/app/models/`. Order payload assembly is explicitly represented by `lib/app/dto/order_dto.dart` and `lib/app/dto/order_product_dto.dart`, separating backend request shape from UI/domain models.

#### Customer and Ordering Flow
Authentication controllers handle login/registration and hand off to the product catalog:
- `lib/app/pages/auth/login/login_controller.dart`
- `lib/app/pages/auth/register/register_controller.dart`
- `lib/app/pages/home/home_controller.dart`

Home renders product selection and shopping-bag state through `lib/app/pages/home/home_page.dart` and `lib/app/pages/home/widgets/shopping_bag_widget.dart`. Product detail adjusts a selected product before order composition in `lib/app/pages/product_detail/product_detail_controller.dart`. The order controller builds the delivery/payment request and drives confirmation:
- `lib/app/pages/order/order_controller.dart`
- `lib/app/pages/order/order_page.dart`
- `lib/app/pages/order/order_completed_page.dart`

#### Presentation System and Platform Assets
Shared theming, reusable delivery controls, loading, and user-message behavior live below `lib/app/core/ui/`, notably `lib/app/core/ui/theme/theme_config.dart`, `lib/app/core/ui/widgets/delivery_button.dart`, and `lib/app/core/ui/base_state/base_state.dart`. Flutter assets include fonts and images under `assets/`; Android Gradle and manifest files provide the mobile packaging layer under `android/app/`.

Main entry points: [`lib/app/pages/home/home_controller.dart`](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/home/home_controller.dart) (Catalog & bag), [`lib/app/pages/order/order_controller.dart`](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/order/order_controller.dart) (Checkout & confirmation), [`lib/app/core/rest_client/custom_dio.dart`](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/rest_client/custom_dio.dart) (REST client), [`lib/app/pages/splash/splash_page.dart`](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/splash/splash_page.dart) (Feature navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime &amp; platform"]
  node_android["Android host<br/>Kotlin entry point<br/>[MainActivity.kt]"]
  node_main["Flutter startup<br/>Dart entry point<br/>[main.dart]"]
  node_app_shell["Application shell<br/>Flutter app"]
end

subgraph group_presentation["Feature presentation"]
  node_navigation["Feature navigation<br/>routers<br/>[splash_page.dart]"]
  node_auth["Authentication<br/>feature controllers"]
  node_catalog["Catalog &amp; bag<br/>home feature"]
  node_product_detail["Product configuration<br/>detail controller"]
  node_order["Checkout &amp; confirmation<br/>order feature"]
  node_ui_state["UI state &amp; shared UI<br/>presentation support<br/>[base_state.dart]"]
end

subgraph group_application["Application services"]
  node_bindings{{"Application binding<br/>dependency assembly"}}
end

subgraph group_data["Data &amp; backend boundary"]
  node_auth_repo["Auth repository<br/>repository implementation"]
  node_products_repo["Products repository<br/>repository implementation"]
  node_order_repo["Order repository<br/>repository implementation"]
  node_order_dto["Order payloads<br/>request DTOs<br/>[order_dto.dart]"]
  node_models["Domain models<br/>client entities"]
  node_rest_client{{"REST client<br/>custom Dio client<br/>[custom_dio.dart]"}}
  node_environment["Environment config<br/>backend configuration<br/>[env.dart]"]
  node_backend[("json_rest_server<br/>REST backend")]
end

node_android -->|"hosts Flutter"| node_main
node_main -->|"launches"| node_app_shell
node_app_shell -->|"initializes"| node_bindings
node_app_shell -->|"starts flow"| node_navigation
node_bindings -.->|"provides"| node_auth_repo
node_bindings -.->|"provides"| node_products_repo
node_bindings -.->|"provides"| node_order_repo
node_navigation -->|"routes to"| node_auth
node_navigation -->|"routes to"| node_catalog
node_navigation -->|"routes to"| node_order
node_auth -->|"authenticates"| node_auth_repo
node_auth -->|"on success"| node_catalog
node_catalog -->|"loads products"| node_products_repo
node_catalog -->|"selects product"| node_product_detail
node_product_detail -->|"adds configured item"| node_order
node_catalog -->|"checks out bag"| node_order
node_order -->|"assembles request"| node_order_dto
node_order -->|"submits order"| node_order_repo
node_auth_repo -.->|"maps auth"| node_models
node_products_repo -.->|"maps catalog"| node_models
node_order_repo -->|"sends payload"| node_order_dto
node_auth_repo -->|"uses"| node_rest_client
node_products_repo -->|"uses"| node_rest_client
node_order_repo -->|"uses"| node_rest_client
node_environment -.->|"configures"| node_rest_client
node_rest_client -->|"REST requests"| node_backend
node_ui_state -.->|"supports screens"| node_auth
node_ui_state -.->|"supports screens"| node_catalog
node_ui_state -.->|"supports screens"| node_order

click node_android "https://github.com/ramonsantospinto/app_delivery/blob/main/android/app/src/main/kotlin/br/com/academiadoflutter/vakinhaburguer/dw_delivery_app/MainActivity.kt"
click node_main "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/main.dart"
click node_app_shell "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/dw_delivery_app.dart"
click node_bindings "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/provider/application_binding.dart"
click node_navigation "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/splash/splash_page.dart"
click node_auth "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/auth/login/login_controller.dart"
click node_catalog "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/home/home_controller.dart"
click node_product_detail "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/product_detail/product_detail_controller.dart"
click node_order "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/order/order_controller.dart"
click node_ui_state "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/ui/base_state/base_state.dart"
click node_auth_repo "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/repositories/auth/auth_repository_impl.dart"
click node_products_repo "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/repositories/products/products_repository_impl.dart"
click node_order_repo "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/repositories/order/order_repository_impl.dart"
click node_order_dto "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/dto/order_dto.dart"
click node_rest_client "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/rest_client/custom_dio.dart"
click node_environment "https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/config/env/env.dart"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_android,node_main,node_app_shell toneBlue
class node_navigation,node_auth,node_catalog,node_product_detail,node_order,node_ui_state toneAmber
class node_bindings toneMint
class node_auth_repo,node_products_repo,node_order_repo,node_order_dto,node_models,node_rest_client,node_environment,node_backend toneRose
```

## Components

### Runtime & platform

- [Android host](https://github.com/ramonsantospinto/app_delivery/blob/main/android/app/src/main/kotlin/br/com/academiadoflutter/vakinhaburguer/dw_delivery_app/MainActivity.kt): Kotlin entry point · Embeds the Flutter runtime. · `android/app/src/main/kotlin/br/com/academiadoflutter/vakinhaburguer/dw_delivery_app/MainActivity.kt`
- [Flutter startup](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/main.dart): Dart entry point · `lib/main.dart`
- [Application shell](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/dw_delivery_app.dart): Flutter app · `lib/app/dw_delivery_app.dart`

### Feature presentation

- [Feature navigation](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/splash/splash_page.dart): routers · Routes splash, authentication, catalog, and ordering screens. · `lib/app/pages/splash/splash_page.dart`
- [Authentication](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/auth/login/login_controller.dart): feature controllers · Login and registration hand off to the catalog. · `lib/app/pages/auth/login/login_controller.dart`
- [Catalog & bag](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/home/home_controller.dart): home feature · Displays products and maintains shopping-bag selection. · `lib/app/pages/home/home_controller.dart`
- [Product configuration](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/product_detail/product_detail_controller.dart): detail controller · Adjusts the selected product before ordering. · `lib/app/pages/product_detail/product_detail_controller.dart`
- [Checkout & confirmation](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/pages/order/order_controller.dart): order feature · Builds and submits delivery and payment requests. · `lib/app/pages/order/order_controller.dart`
- [UI state & shared UI](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/ui/base_state/base_state.dart): presentation support · Provider/BLoC state, theme, controls, loading, and messages. · `lib/app/core/ui/base_state/base_state.dart`

### Application services

- [Application binding](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/provider/application_binding.dart): dependency assembly · Registers application-wide dependencies. · `lib/app/core/provider/application_binding.dart`

### Data & backend boundary

- [Auth repository](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/repositories/auth/auth_repository_impl.dart): repository implementation · `lib/app/repositories/auth/auth_repository_impl.dart`
- [Products repository](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/repositories/products/products_repository_impl.dart): repository implementation · `lib/app/repositories/products/products_repository_impl.dart`
- [Order repository](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/repositories/order/order_repository_impl.dart): repository implementation · `lib/app/repositories/order/order_repository_impl.dart`
- [Order payloads](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/dto/order_dto.dart): request DTOs · Separates order request shape from UI models. · `lib/app/dto/order_dto.dart`
- **Domain models**: client entities · Authentication, product, and payment entities.
- [REST client](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/rest_client/custom_dio.dart): custom Dio client · Central HTTP boundary with authentication interception. · `lib/app/core/rest_client/custom_dio.dart`
- [Environment config](https://github.com/ramonsantospinto/app_delivery/blob/main/lib/app/core/config/env/env.dart): backend configuration · `lib/app/core/config/env/env.dart`
- **json_rest_server**: REST backend

## Connections

- Android host → Flutter startup: hosts Flutter
- Flutter startup → Application shell: launches
- Application shell → Application binding: initializes
- Application shell → Feature navigation: starts flow
- Application binding → Auth repository: provides
- Application binding → Products repository: provides
- Application binding → Order repository: provides
- Feature navigation → Authentication: routes to
- Feature navigation → Catalog & bag: routes to
- Feature navigation → Checkout & confirmation: routes to
- Authentication → Auth repository: authenticates
- Authentication → Catalog & bag: on success
- Catalog & bag → Products repository: loads products
- Catalog & bag → Product configuration: selects product
- Product configuration → Checkout & confirmation: adds configured item
- Catalog & bag → Checkout & confirmation: checks out bag
- Checkout & confirmation → Order payloads: assembles request
- Checkout & confirmation → Order repository: submits order
- Auth repository → Domain models: maps auth
- Products repository → Domain models: maps catalog
- Order repository → Order payloads: sends payload
- Auth repository → REST client: uses
- Products repository → REST client: uses
- Order repository → REST client: uses
- Environment config → REST client: configures
- REST client → json_rest_server: REST requests
- UI state & shared UI → Authentication: supports screens
- UI state & shared UI → Catalog & bag: supports screens
- UI state & shared UI → Checkout & confirmation: supports screens
