# evelynlobo91/gastro_hub architecture

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

- Interactive diagram: https://gitdiagram.com/evelynlobo91/gastro_hub
- Repository: https://github.com/evelynlobo91/gastro_hub

## Overview

Gastro_Hub is a modular NestJS marketplace for multi-brand food ordering, with a React test console. The customer flow begins with registration or login, continues through brand-segmented menus and a unified order, then consolidated payment, kitchen sub-orders, and fulfillment tracking. The README documents this end-to-end product scope; sampled controllers and services confirm several API-to-domain calls, while other domain links are documented rather than verified in source. The repository is still in development: inventory and delivery are represented, while loyalty and financial settlement are capabilities without sampled implementation evidence.

Main entry points: [`src/features/orders/orders.service.ts`](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/orders.service.ts) (Order orchestration), [`src/features/auth/auth.service.ts`](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/auth/auth.service.ts) (Authentication), [`src/features/delivery/delivery.service.ts`](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/delivery/delivery.service.ts) (Fulfillment tracking), [`frontend/src/app/App.tsx`](https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/app/App.tsx) (React console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client console"]
  node_console["React console<br/>[App.tsx]"]
  node_authui["Auth forms<br/>[LoginForm.tsx]"]
  node_sessionpanel["Session panel<br/>[SessionPanel.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and access"]
  node_auth_controller["Auth API<br/>[auth.controller.ts]"]
  node_auth_service["Authentication<br/>[auth.service.ts]"]
  node_users["User accounts<br/>[users.service.ts]"]
end

subgraph group_commerce["Ordering and catalog"]
  node_catalog_controller["Catalog API"]
  node_catalog_service["Catalog<br/>[catalog.service.ts]"]
  node_orders_controller["Orders API"]
  node_orders_service["Order orchestration<br/>[orders.service.ts]"]
  node_order_store[("Order records<br/>[order.entity.ts]")]
  node_payment[("Consolidated payment<br/>[payment.entity.ts]")]
  node_suborders[("Kitchen sub-orders")]
end

subgraph group_fulfillment["Operations"]
  node_inventory["Stock and recipes"]
  node_delivery_controller["Delivery API"]
  node_delivery_service["Fulfillment tracking"]
  node_delivery_store[("Delivery records<br/>[delivery.entity.ts]")]
  node_loyalty["Loyalty"]
end

subgraph group_platform["Platform services"]
  node_session_cache[("Session cache")]
  node_postgres[("PostgreSQL<br/>[database.module.ts]")]
  node_redis[("Redis<br/>[redis.provider.ts]")]
  node_rabbitmq["RabbitMQ"]
end

node_customer(("Customer"))

node_customer -->|"uses"| node_console
node_console -->|"renders"| node_authui
node_console -->|"renders"| node_sessionpanel
node_authui -.->|"submits credentials"| node_api_client
node_sessionpanel -->|"requests session"| node_api_client
node_api_client -.->|"calls API"| node_auth_controller
node_auth_controller -->|"delegates"| node_auth_service
node_auth_service -->|"uses accounts"| node_users
node_auth_service -->|"stores sessions"| node_session_cache
node_session_cache -->|"reads and writes"| node_redis
node_customer -->|"browses menus"| node_catalog_controller
node_catalog_controller -->|"delegates"| node_catalog_service
node_customer -->|"places order"| node_orders_controller
node_orders_controller -->|"delegates"| node_orders_service
node_orders_service -.->|"persists orders"| node_order_store
node_orders_service -.->|"records payment"| node_payment
node_orders_service -.->|"splits by kitchen"| node_suborders
node_orders_service -->|"coordinates delivery"| node_delivery_service
node_customer -->|"tracks fulfillment"| node_delivery_controller
node_delivery_controller -->|"delegates"| node_delivery_service
node_delivery_service -->|"updates status"| node_delivery_store
node_delivery_service -->|"publishes events"| node_rabbitmq
node_customer -.->|"benefits from stock checks"| node_inventory
node_customer -.->|"uses rewards"| node_loyalty
node_orders_service -.->|"stores order data"| node_postgres
node_auth_service -.->|"stores refresh tokens"| node_postgres

click node_console "https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/app/App.tsx"
click node_authui "https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/features/auth/LoginForm.tsx"
click node_sessionpanel "https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/features/auth/SessionPanel.tsx"
click node_api_client "https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/shared/api.ts"
click node_auth_controller "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/auth/auth.controller.ts"
click node_auth_service "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/auth/auth.service.ts"
click node_users "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/users/users.service.ts"
click node_session_cache "https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/cache/session-cache.service.ts"
click node_catalog_controller "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/catalog/catalog.controller.ts"
click node_catalog_service "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/catalog/catalog.service.ts"
click node_orders_controller "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/orders.controller.ts"
click node_orders_service "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/orders.service.ts"
click node_order_store "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/entities/order.entity.ts"
click node_payment "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/entities/payment.entity.ts"
click node_suborders "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/entities/sub-order.entity.ts"
click node_inventory "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/inventory/inventory.service.ts"
click node_delivery_controller "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/delivery/delivery.controller.ts"
click node_delivery_service "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/delivery/delivery.service.ts"
click node_delivery_store "https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/delivery/entities/delivery.entity.ts"
click node_loyalty "https://github.com/evelynlobo91/gastro_hub/blob/main/src/contracts/loyalty.contract.ts"
click node_postgres "https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/database/database.module.ts"
click node_redis "https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/cache/redis.provider.ts"
click node_rabbitmq "https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/messaging/rabbitmq.service.ts"

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_console,node_authui,node_sessionpanel,node_api_client toneBlue
class node_auth_controller,node_auth_service,node_users toneAmber
class node_catalog_controller,node_catalog_service,node_orders_controller,node_orders_service,node_order_store,node_payment,node_suborders toneMint
class node_inventory,node_delivery_controller,node_delivery_service,node_delivery_store,node_loyalty toneRose
class node_session_cache,node_postgres,node_redis,node_rabbitmq,node_customer toneIndigo
```

## Components

### Client console

- [React console](https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`
- [Auth forms](https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/features/auth/LoginForm.tsx): `frontend/src/features/auth/LoginForm.tsx`
- [Session panel](https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/features/auth/SessionPanel.tsx): `frontend/src/features/auth/SessionPanel.tsx`
- [API client](https://github.com/evelynlobo91/gastro_hub/blob/main/frontend/src/shared/api.ts): `frontend/src/shared/api.ts`

### Identity and access

- [Auth API](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/auth/auth.controller.ts): `src/features/auth/auth.controller.ts`
- [Authentication](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/auth/auth.service.ts): `src/features/auth/auth.service.ts`
- [User accounts](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/users/users.service.ts): `src/features/users/users.service.ts`

### Ordering and catalog

- [Catalog API](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/catalog/catalog.controller.ts): `src/features/catalog/catalog.controller.ts`
- [Catalog](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/catalog/catalog.service.ts): `src/features/catalog/catalog.service.ts`
- [Orders API](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/orders.controller.ts): `src/features/orders/orders.controller.ts`
- [Order orchestration](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/orders.service.ts): `src/features/orders/orders.service.ts`
- [Order records](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/entities/order.entity.ts): `src/features/orders/entities/order.entity.ts`
- [Consolidated payment](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/entities/payment.entity.ts): `src/features/orders/entities/payment.entity.ts`
- [Kitchen sub-orders](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/orders/entities/sub-order.entity.ts): `src/features/orders/entities/sub-order.entity.ts`

### Operations

- [Stock and recipes](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/inventory/inventory.service.ts): `src/features/inventory/inventory.service.ts`
- [Delivery API](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/delivery/delivery.controller.ts): `src/features/delivery/delivery.controller.ts`
- [Fulfillment tracking](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/delivery/delivery.service.ts): `src/features/delivery/delivery.service.ts`
- [Delivery records](https://github.com/evelynlobo91/gastro_hub/blob/main/src/features/delivery/entities/delivery.entity.ts): `src/features/delivery/entities/delivery.entity.ts`
- [Loyalty](https://github.com/evelynlobo91/gastro_hub/blob/main/src/contracts/loyalty.contract.ts): `src/contracts/loyalty.contract.ts`

### Platform services

- [Session cache](https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/cache/session-cache.service.ts): `src/shared/cache/session-cache.service.ts`
- [PostgreSQL](https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/database/database.module.ts): `src/shared/database/database.module.ts`
- [Redis](https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/cache/redis.provider.ts): `src/shared/cache/redis.provider.ts`
- [RabbitMQ](https://github.com/evelynlobo91/gastro_hub/blob/main/src/shared/messaging/rabbitmq.service.ts): `src/shared/messaging/rabbitmq.service.ts`

### Other components

- **Customer**

## Connections

- Customer → React console: uses
- React console → Auth forms: renders (evidence: `frontend/src/app/App.tsx`)
- React console → Session panel: renders (evidence: `frontend/src/app/App.tsx`)
- Auth forms → API client: submits credentials
- Session panel → API client: requests session (evidence: `frontend/src/features/auth/SessionPanel.tsx`)
- API client → Auth API: calls API
- Auth API → Authentication: delegates (evidence: `src/features/auth/auth.controller.ts`)
- Authentication → User accounts: uses accounts (evidence: `src/features/auth/auth.service.ts`)
- Authentication → Session cache: stores sessions (evidence: `src/features/auth/auth.service.ts`)
- Session cache → Redis: reads and writes (evidence: `src/shared/cache/session-cache.service.ts`)
- Customer → Catalog API: browses menus
- Catalog API → Catalog: delegates (evidence: `src/features/catalog/catalog.controller.ts`)
- Customer → Orders API: places order
- Orders API → Order orchestration: delegates (evidence: `src/features/orders/orders.controller.ts`)
- Order orchestration → Order records: persists orders (evidence: `src/features/orders/orders.service.ts`)
- Order orchestration → Consolidated payment: records payment (evidence: `src/features/orders/orders.service.ts`)
- Order orchestration → Kitchen sub-orders: splits by kitchen (evidence: `src/features/orders/orders.service.ts`)
- Order orchestration → Fulfillment tracking: coordinates delivery (evidence: `src/features/orders/orders.service.ts`)
- Customer → Delivery API: tracks fulfillment
- Delivery API → Fulfillment tracking: delegates (evidence: `src/features/delivery/delivery.controller.ts`)
- Fulfillment tracking → Delivery records: updates status (evidence: `src/features/delivery/delivery.service.ts`)
- Fulfillment tracking → RabbitMQ: publishes events (evidence: `src/features/delivery/delivery.service.ts`)
- Customer → Stock and recipes: benefits from stock checks
- Customer → Loyalty: uses rewards
- Order orchestration → PostgreSQL: stores order data
- Authentication → PostgreSQL: stores refresh tokens
