# khushi747/food-ordering-app architecture

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

- Interactive diagram: https://gitdiagram.com/khushi747/food-ordering-app
- Repository: https://github.com/khushi747/food-ordering-app

## Overview

##### Project Type and Role Distribution
- This application is a full-stack food-ordering system with clearly defined roles. The frontend, built with Angular, includes various dashboards (admin, kitchen, user) and a login module. The backend is a C# (likely ASP.NET Core) API server responsible for data management, business logic, and event handling.
- Key roles/areas include Administration (menu management), Kitchen (order processing and updates), and End-User functionalities (order creation, tracking).

##### File Structure and Identify Main Components
- Frontend Component:
- Located under the “frontend” directory, using Angular.
- Contains separate modules/components for Admin Dashboard, Kitchen Dashboard, User Dashboard, and Login.
- Manages routing, user interfaces, and calls to the backend API.
- Backend Component:
- Located under the “server” directory.
- Organized using the MVC pattern with Controllers (AdminController, ChefController, UserController) and a systematic separation via Data, Models, Dtos, Mappers, and Services.
- Uses Entity Framework (evidenced by the EF migrations and context “GininternsContext.cs”) for database interactions.
- Integrates with a messaging system via RabbitMQ (see RabbitMqProducer.cs and events such as OrderStatusUpdatedEvent) to manage asynchronous communication like order status updates.
- Database:
- The project uses a relational database (implied by EF Core migrations and context settings) to store menus, orders, and user details.
- External/Messaging Systems:
- RabbitMQ is incorporated on the server side to handle events related to orders.

##### Determining Relationships and Interactions
- The Angular frontend communicates with the backend API server via RESTful calls. The interaction flows include:
- User actions (login, order placement, dashboard viewing) trigger API calls to the respective user endpoints.
- Admin actions (menu management) call the appropriate Admin APIs.
- Kitchen staff interactions (updating and viewing order statuses) connect with the Chef API endpoints.
- The backend processes these requests and interacts with the database using Entity Framework.
- On certain operations, such as order status changes, the backend publishes events to RabbitMQ, triggering notifications or further asynchronous processing.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clear division between frontend UI and backend business logic.
- MVC/MVVM for both frontend and backend.
- Service Layer pattern on the server side (e.g., ChefService, UserService).
- Use of Data Transfer Objects (DTOs) and mapping layers (MenuMapper, OrderMapper) to handle data exchange between the UI and the data models.
- Asynchronous processing for order events via RabbitMQ integration.

- Differentiate between the frontend (Angular), backend (controllers, services, data mappers, EF Core), database, and messaging system (RabbitMQ).
- Annotations (if needed) to explain design patterns like MVC, Service Layers, and asynchronous event handling.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Top level roots
    AF["Angular Frontend"]
    BF["Backend API Server"]

    %% Frontend Components
    subgraph "Frontend Components"
        LM["Login Module"]
        AD_Main["Admin Dashboard"]
        subgraph "Admin Dashboard Components"
            AD1["Add Component"]
            AD2["Navbar Component"]
            AD3["Item Card Component"]
        end
        KD_Main["Kitchen Dashboard"]
        subgraph "Kitchen Dashboard Components"
            KD1["Dashboard Component"]
            KD2["Navbar Component"]
            KD3["Order Card Component"]
        end
        UD_Main["User Dashboard"]
        subgraph "User Dashboard Components"
            UD1["Dashboard Component"]
            UD2["Navbar Component"]
            UD3["Item Card Component"]
        end
    end

    %% Backend Components
    subgraph "Backend Components"
        AC["Admin Controller"]
        CC["Chef Controller"]
        UC["User Controller"]
        subgraph "Services Layer"
            CS["Chef Service"]
            US["User Service"]
        end
        subgraph "Data Access Layer"
            EF["EF Core Context"]
            MIG["Migrations"]
            ADT["Admin DTOs"]
            CDT["Chef DTOs"]
            UDT["User DTOs"]
            MM["Menu Mapper"]
            OM["Order Mapper"]
            ODM["Orderdetails Mapper"]
        end
        subgraph "Messaging Layer"
            RQP["RabbitMQ Producer"]
            OSE["OrderStatusUpdatedEvent"]
        end
    end

    %% External Systems
    DB["Relational Database"]
    MQ["RabbitMQ"]

    %% Relationships from Frontend to Backend
    LM -->|"calls"| UC
    AD_Main -->|"adminOps"| AC
    KD_Main -->|"chefOps"| CC
    UD_Main -->|"userOps"| UC

    %% Internal Backend Relationships
    AC -->|"maps"| MM
    AC -->|"usesDTO"| ADT
    CC -->|"processes"| CS
    CC -->|"usesDTO"| CDT
    UC -->|"handles"| US
    UC -->|"usesDTO"| UDT

    CS -->|"accesses"| EF
    US -->|"accesses"| EF
    MM -->|"mapsTo"| EF

    EF -->|"persists"| DB

    CS -->|"publishes"| RQP
    US -->|"publishes"| RQP
    RQP -->|"sends"| MQ

    %% Top-level Connections (for visual grouping)
    AF --- LM
    AF --- AD_Main
    AF --- KD_Main
    AF --- UD_Main
    BF --- AC
    BF --- CC
    BF --- UC

    %% Click Events
    click AF "https://github.com/khushi747/food-ordering-app/tree/main/frontend"
    click LM "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/login/loginpage"
    click AD_Main "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/admindashboard"
    click AD1 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/admindashboard/add"
    click AD2 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/admindashboard/navbar"
    click AD3 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/admindashboard/item-card"
    click KD_Main "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/kitchendashboard"
    click KD1 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/kitchendashboard/kitchendashboard"
    click KD2 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/kitchendashboard/navbar"
    click KD3 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/kitchendashboard/order-card"
    click UD_Main "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/userdashboard"
    click UD1 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/userdashboard/userdashboard"
    click UD2 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/userdashboard/navbar"
    click UD3 "https://github.com/khushi747/food-ordering-app/tree/main/frontend/src/app/components/userdashboard/item-card"
    click BF "https://github.com/khushi747/food-ordering-app/tree/main/server"
    click AC "https://github.com/khushi747/food-ordering-app/blob/main/server/Controllers/AdminController.cs"
    click CC "https://github.com/khushi747/food-ordering-app/blob/main/server/Controllers/ChefController.cs"
    click UC "https://github.com/khushi747/food-ordering-app/blob/main/server/Controllers/UserController.cs"
    click CS "https://github.com/khushi747/food-ordering-app/blob/main/server/Service/ChefService.cs"
    click US "https://github.com/khushi747/food-ordering-app/blob/main/server/Service/UserService.cs"
    click EF "https://github.com/khushi747/food-ordering-app/blob/main/server/Data/GininternsContext.cs"
    click MIG "https://github.com/khushi747/food-ordering-app/tree/main/server/Migrations"
    click ADT "https://github.com/khushi747/food-ordering-app/tree/main/server/Dtos/Admin"
    click CDT "https://github.com/khushi747/food-ordering-app/tree/main/server/Dtos/Chef"
    click UDT "https://github.com/khushi747/food-ordering-app/tree/main/server/Dtos/User"
    click MM "https://github.com/khushi747/food-ordering-app/blob/main/server/Mappers/MenuMapper.cs"
    click OM "https://github.com/khushi747/food-ordering-app/blob/main/server/Mappers/OrderMapper.cs"
    click ODM "https://github.com/khushi747/food-ordering-app/blob/main/server/Mappers/OrderdetailsMapper.cs"
    click RQP "https://github.com/khushi747/food-ordering-app/blob/main/server/Producer/RabbitMqProducer.cs"
    click OSE "https://github.com/khushi747/food-ordering-app/blob/main/server/Events/OrderStatusUpdatedEvent.cs"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#2a9df4,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef db fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
    classDef mq fill:#f8d7da,stroke:#dc3545,stroke-width:2px;

    class AF,LM,AD_Main,AD1,AD2,AD3,KD_Main,KD1,KD2,KD3,UD_Main,UD1,UD2,UD3 frontend;
    class BF,AC,CC,UC,CS,US,EF,MIG,ADT,CDT,UDT,MM,OM,ODM,RQP,OSE backend;
    class DB db;
    class MQ mq;
```
