# dishantzaveri/ecoeats architecture

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

- Interactive diagram: https://gitdiagram.com/dishantzaveri/ecoeats
- Repository: https://github.com/dishantzaveri/ecoeats

## Overview

##### Project Type and Purpose
- EcoEats is a multi-platform food-delivery application whose goal is to optimize delivery routes for environmental sustainability.
- It consists of two user‐facing front ends (a Flutter mobile app and a React web app) and a cloud‐hosted backend that handles authentication, order management, route optimization (via HERE Routing APIs), data storage, and analytics.

##### File Structure
- Top level:
- app/ → Flutter project (Android & iOS targets)
- web/ → React single-page application (deployed via Firebase Hosting)
- README.md → high-level description
- app/lib/: Flutter UI screens (features/) + business logic (logic/repos, stores) + Firebase config (firebase_options.dart)
- web/src/: React components, pages, Redux store slices; Firebase config (web/src/firebase.js)
- Presence of google-services.json, Podfile, .firebaserc, firebase.json indicates Firebase Auth/Firestore/Hosting as part of the backend.

##### README for Additional Insights
- Mentions React (web), Flutter (mobile), Node.js backend, AWS hosting & database, HERE APIs.

##### Main Components & Their Relationships
a. Clients
- Mobile: Flutter app (modules: Auth, Onboarding, Map & Routing, Orders, Profile, Settings).
- Web: React SPA (components: Header/Footer/Layout, Pages for Home, FoodList, Cart, Checkout, Login/Register, Location).
b. Backend Services
- Firebase Auth → user authentication & profile management
- Firebase Firestore → orders, users, restaurants, riders, analytics data
- (Optional Node.js layer on AWS or Cloud Functions) → business-logic microservices, payment processing, subscription tiers
- HERE Routing API → external service called from backend (or directly from client logic/repos) for route optimization
c. Database & Storage
- Firestore (NoSQL) or AWS RDS/DynamoDB (depending on final choice)
- Firebase Storage or AWS S3 for images, assets
d. Hosting & Deployment
- Firebase Hosting for React web
- Google Play & AppStore for Flutter mobile
- AWS (EC2, Lambda, API Gateway) or Firebase Cloud Functions for backend compute
e. Analytics & Monitoring
- Firebase Analytics or AWS CloudWatch
- Custom dashboard in web or separate BI tool

##### Architectural Patterns & Design Principles
- Client-Server (thin clients, backend APIs)
- MVVM/Provider or BLoC in Flutter (stores + repos pattern)
- Component-based + Redux in React
- Repository pattern isolates data sources (HERE API vs local DB vs cloud DB)
- Separation of concerns: Authentication, Routing, Order Management, User Profile, Analytics

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients Layer
    subgraph "Flutter Mobile App" 
        direction TB
        FL_APP["Flutter Mobile App"]:::client
        subgraph "Auth Screens"
            direction TB
            FL_LOGIN["Login Screen"]:::client
            FL_REGISTER["Register Screen"]:::client
        end
        subgraph "Onboarding"
            direction TB
            FL_ONBOARD["Onboarding Screen"]:::client
            FL_SPLASH["Splash Screen"]:::client
        end
        FL_MAIN["Main Scaffold"]:::client
        subgraph "Feed/Home"
            direction TB
            FL_FEED["Feed Screen"]:::client
            FL_RESTAURANT["Restaurant Widget"]:::client
        end
        FL_FOOD["Food Screen"]:::client
        subgraph "Map & Routing"
            direction TB
            FL_MAP["Map Screen"]:::client
            FL_NAV["Navigation Module"]:::client
            FL_ROUTE_EX["Routing Example"]:::client
            FL_MAP_STYLE["Custom Map Styles"]:::client
        end
        FL_PROFILE["Profile Screen"]:::client
        FL_SETTINGS["Settings Screen"]:::client
        FL_MODELS["Data Models"]:::client
        FL_REPOS["Repository Layer"]:::client
        FL_STORES["State Management Stores"]:::client
        FL_FIREBASE_CONF["Firebase Config"]:::client
    end

    subgraph "React Web App"
        direction TB
        WEB_APP["React Web App"]:::client
        WEB_FIREBASE_CONF["Firebase Config"]:::client
        subgraph "Layout Components"
            direction TB
            WEB_HEADER["Header"]:::client
            WEB_FOOTER["Footer"]:::client
            WEB_LAYOUT["Layout"]:::client
        end
        WEB_UI["UI Components"]:::client
        subgraph "Pages"
            direction TB
            WEB_HOME["Home Page"]:::client
            WEB_ALLFOODS["All Foods Page"]:::client
            WEB_FOODDETAILS["Food Details Page"]:::client
            WEB_CART["Cart Page"]:::client
            WEB_CHECKOUT["Checkout Page"]:::client
            WEB_LOGIN["Login Page"]:::client
            WEB_REGISTER["Register Page"]:::client
            WEB_LOCATION["Location Page"]:::client
            WEB_CONTACT["Contact Page"]:::client
        end
        WEB_ROUTING["Routing Setup"]:::client
        subgraph "Redux Store"
            direction TB
            WEB_STORE["Store"]:::client
            WEB_CARTSLICE["Cart Slice"]:::client
            WEB_CARTUISLICE["Cart UI Slice"]:::client
        end
        WEB_MAPS["Maps Integration"]:::client
    end

    %% Backend Services
    subgraph "Backend Services" 
        direction TB
        FB_AUTH["Firebase Auth"]:::backend
        FB_FIRESTORE["Firestore"]:::database
        FB_STORAGE["Firebase Storage"]:::database
        FB_FUNCTIONS["Cloud Functions"]:::backend
        AWS_API["API Gateway"]:::backend
        AWS_LAMBDA["Lambda Functions"]:::backend
        NODE_MICRO["Node.js Microservices"]:::backend
        PAYMENT["Payment Gateway"]:::external
    end

    %% External Services
    subgraph "External APIs"
        direction TB
        HERE["HERE Routing API"]:::external
        FCM["Firebase Cloud Messaging"]:::external
        ANALYTICS["Analytics/Monitoring"]:::external
    end

    %% Hosting & Deployment
    subgraph "Hosting & Deployment"
        direction TB
        FIREBASE_HOST["Firebase Hosting"]:::infra
        APP_STORE["App Store & Play Store"]:::infra
        AWS_S3["AWS S3"]:::database
        AWS_RDS["AWS RDS/DynamoDB"]:::database
    end

    %% Connections
    FL_APP -->|uses| FB_AUTH
    FL_APP -->|reads/writes| FB_FIRESTORE
    FL_APP -->|uploads/downloads| FB_STORAGE
    FL_APP -->|calls| FB_FUNCTIONS
    FL_REPOS -->|invokes HERE| HERE
    FB_FUNCTIONS -->|GET /optimizeRoute| HERE
    FB_FUNCTIONS -->|writes| FB_FIRESTORE
    FB_FUNCTIONS -->|publishes| FCM
    WEB_APP -->|uses SDK| FB_AUTH
    WEB_APP -->|reads/writes| FB_FIRESTORE
    WEB_APP -->|hosting| FIREBASE_HOST
    WEB_ROUTING -->|dispatches| AWS_API
    AWS_API -->|invokes| AWS_LAMBDA
    AWS_LAMBDA -->|access| AWS_RDS
    AWS_LAMBDA -->|writes| FB_FIRESTORE
    AWS_LAMBDA -->|uploads| AWS_S3
    FB_FIRESTORE -->|stream| FL_STORES
    FB_FIRESTORE -->|stream| WEB_STORE
    FB_FIRESTORE -->|logs| ANALYTICS

    %% Click Events Flutter
    click FL_APP "https://github.com/dishantzaveri/ecoeats/tree/main/app/"
    click FL_LOGIN "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/auth/login_screen.dart"
    click FL_REGISTER "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/auth/register_screen.dart"
    click FL_ONBOARD "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/onboarding/onboarding_screen.dart"
    click FL_SPLASH "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/onboarding/splash_screen.dart"
    click FL_MAIN "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/main/main_scaffold_screen.dart"
    click FL_FEED "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/feed/feed_screen.dart"
    click FL_RESTAURANT "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/feed/restraunt_widget.dart"
    click FL_FOOD "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/foods/food_screen.dart"
    click FL_MAP "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/map/map_screen.dart"
    click FL_NAV "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/map/navigation.dart"
    click FL_ROUTE_EX "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/map/routing_example.dart"
    click FL_MAP_STYLE "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/map/custom_map_styles.dart"
    click FL_PROFILE "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/features/edit_profile/profile_screen.dart"
    click FL_REPOS "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/logic/repos/auth_repo.dart"
    click FL_STORES "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/logic/stores/auth_store.dart"
    click FL_MODELS "https://github.com/dishantzaveri/ecoeats/tree/main/app/lib/logic/models/"
    click FL_FIREBASE_CONF "https://github.com/dishantzaveri/ecoeats/blob/main/app/lib/firebase_options.dart"
    
    %% Click Events React
    click WEB_APP "https://github.com/dishantzaveri/ecoeats/tree/main/web/"
    click WEB_FIREBASE_CONF "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/firebase.js"
    click WEB_HEADER "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/components/Header/Header.jsx"
    click WEB_FOOTER "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/components/Footer/Footer.jsx"
    click WEB_LAYOUT "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/components/Layout/Layout.js"
    click WEB_UI "https://github.com/dishantzaveri/ecoeats/tree/main/web/src/components/UI/"
    click WEB_HOME "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/Home.jsx"
    click WEB_ALLFOODS "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/AllFoods.jsx"
    click WEB_FOODDETAILS "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/FoodDetails.jsx"
    click WEB_CART "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/Cart.jsx"
    click WEB_CHECKOUT "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/Checkout.jsx"
    click WEB_LOGIN "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/Login.jsx"
    click WEB_REGISTER "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/Register.jsx"
    click WEB_LOCATION "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/Location.jsx"
    click WEB_CONTACT "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/pages/Contact.jsx"
    click WEB_ROUTING "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/routes/Routers.js"
    click WEB_STORE "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/store/store.js"
    click WEB_CARTSLICE "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/store/shopping-cart/cartSlice.js"
    click WEB_CARTUISLICE "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/store/shopping-cart/cartUiSlice.js"
    click WEB_MAPS "https://github.com/dishantzaveri/ecoeats/blob/main/web/src/Maps.js"

    %% Styles
    classDef client fill:#D0E6FF,stroke:#0366D6,color:#0366D6;
    classDef backend fill:#E6F5D0,stroke:#2E7D32,color:#2E7D32;
    classDef database fill:#FFE6CC,stroke:#E65100,color:#E65100;
    classDef external fill:#F3E5F5,stroke:#6A1B9A,color:#6A1B9A;
    classDef infra fill:#ECEFF1,stroke:#455A64,color:#455A64;
```
