# mjunhaochen/cswp-meal-delivery architecture

> Architecture diagram of the GitHub repository mjunhaochen/cswp-meal-delivery, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mjunhaochen/cswp-meal-delivery
- Repository: https://github.com/mjunhaochen/cswp-meal-delivery

## Overview

MealDeliveryApp is an Angular SPA backed by a NestJS API. Users authenticate, browse meals and products, and students add or remove meals from their order list; owners and admins manage catalog and student-house data. The API also supports user administration and meal-product associations. The README identifies MongoDB as the backend; sampled auth code additionally writes user nodes through Neo4j. Frontend service implementations and most API services were not sampled, so those links reflect the available controller wiring and documented endpoint surface rather than inspected service internals.

Main entry points: [`libs/data/src/lib`](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/libs/data/src/lib) (Shared data contracts), [`apps/meal-delivery/src/app/app.module.ts`](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/app.module.ts) (Application shell), [`apps/meal-delivery/src/app/pages/meal`](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/meal) (Meals and orders), [`apps/meal-delivery/src/app/pages/product`](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/product) (Product management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular client"]
  node_spa["Application shell<br/>[app.module.ts]"]
  node_auth_ui["Authentication UI"]
  node_auth_client["Auth client<br/>[auth.service.ts]"]
  node_meal_ui["Meals and orders"]
  node_meal_client["Meal client<br/>[meal.service.ts]"]
  node_product_ui["Product management"]
  node_product_client["Product client<br/>[product.service.ts]"]
  node_house_ui["House management"]
  node_house_client["House client"]
  node_user_ui["User management"]
  node_user_client["User client<br/>[user.service.ts]"]
end

subgraph group_api["NestJS API"]
  node_api["HTTP API<br/>[app.module.ts]"]
  node_auth_api["Auth endpoints<br/>[auth.controller.ts]"]
  node_auth_service["Auth service<br/>[auth.service.ts]"]
  node_meal_api["Meal endpoints<br/>[meal.controller.ts]"]
  node_order_api["Order endpoints"]
  node_product_api["Product endpoints"]
  node_productlist_api["Meal-product links"]
  node_house_api["House endpoints"]
  node_user_api["User endpoints<br/>[user.controller.ts]"]
  node_schemas["Mongo schemas"]
end

subgraph group_storage["Data stores"]
  node_mongo[("MongoDB")]
  node_neo4j_service["Neo4j adapter<br/>[neo4j.service.ts]"]
  node_neo4j[("Neo4j")]
end

subgraph group_contracts["Shared contracts"]
  node_data_models["Shared data contracts"]
end

node_user(("User"))

node_user -->|"uses"| node_spa
node_spa -->|"renders"| node_auth_ui
node_spa -->|"renders"| node_meal_ui
node_spa -->|"renders"| node_product_ui
node_spa -->|"renders"| node_house_ui
node_spa -->|"renders"| node_user_ui
node_auth_ui -->|"submits credentials"| node_auth_client
node_auth_client -->|"HTTP requests"| node_auth_api
node_meal_ui -->|"requests meals"| node_meal_client
node_meal_ui -->|"order actions"| node_order_api
node_meal_client -->|"HTTP requests"| node_meal_api
node_product_ui -->|"requests products"| node_product_client
node_product_client -->|"HTTP requests"| node_product_api
node_product_ui -->|"associate products"| node_productlist_api
node_house_ui -->|"requests houses"| node_house_client
node_house_client -->|"HTTP requests"| node_house_api
node_user_ui -->|"requests users"| node_user_client
node_user_client -->|"HTTP requests"| node_user_api
node_auth_api -->|"delegates"| node_auth_service
node_auth_service -->|"reads and writes"| node_mongo
node_auth_service -->|"writes user node"| node_neo4j_service
node_neo4j_service -->|"executes query"| node_neo4j
node_meal_api -->|"meal operations"| node_mongo
node_order_api -->|"order operations"| node_mongo
node_product_api -->|"product operations"| node_mongo
node_productlist_api -->|"association operations"| node_mongo
node_house_api -->|"house operations"| node_mongo
node_user_api -->|"user operations"| node_mongo
node_schemas -->|"defines documents"| node_mongo
node_data_models -.->|"shared types"| node_auth_client
node_data_models -.->|"shared types"| node_auth_api
node_data_models -.->|"shared types"| node_meal_api
node_data_models -.->|"shared types"| node_product_api
node_data_models -.->|"shared types"| node_house_api
node_data_models -.->|"shared types"| node_user_api

click node_spa "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/app.module.ts"
click node_auth_ui "https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/auth"
click node_auth_client "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/auth/auth.service.ts"
click node_meal_ui "https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/meal"
click node_meal_client "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/meal/meal.service.ts"
click node_product_ui "https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/product"
click node_product_client "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/product/product.service.ts"
click node_house_ui "https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/studentHouse"
click node_house_client "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/studentHouse/studentHouse.service.ts"
click node_user_ui "https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/user"
click node_user_client "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/user/user.service.ts"
click node_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/app.module.ts"
click node_auth_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/auth/auth.controller.ts"
click node_auth_service "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/auth/auth.service.ts"
click node_meal_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/meal/meal.controller.ts"
click node_order_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/orderlist/orderlist.controller.ts"
click node_product_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/product/product.controller.ts"
click node_productlist_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/productlist/productlist.controller.ts"
click node_house_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/studentHouse/studentHouse.controller.ts"
click node_user_api "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/user/user.controller.ts"
click node_neo4j_service "https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/neo4j/neo4j.service.ts"
click node_data_models "https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/libs/data/src/lib"
click node_schemas "https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery-api/src/app/schema"

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_spa,node_auth_ui,node_auth_client,node_meal_ui,node_meal_client,node_product_ui,node_product_client,node_house_ui,node_house_client,node_user_ui,node_user_client,node_user toneBlue
class node_api,node_auth_api,node_auth_service,node_meal_api,node_order_api,node_product_api,node_productlist_api,node_house_api,node_user_api,node_schemas toneAmber
class node_mongo,node_neo4j_service,node_neo4j toneMint
class node_data_models toneRose
```

## Components

### Angular client

- [Application shell](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/app.module.ts): `apps/meal-delivery/src/app/app.module.ts`
- [Authentication UI](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/auth): `apps/meal-delivery/src/app/auth`
- [Auth client](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/auth/auth.service.ts): `apps/meal-delivery/src/app/auth/auth.service.ts`
- [Meals and orders](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/meal): `apps/meal-delivery/src/app/pages/meal`
- [Meal client](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/meal/meal.service.ts): `apps/meal-delivery/src/app/pages/meal/meal.service.ts`
- [Product management](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/product): `apps/meal-delivery/src/app/pages/product`
- [Product client](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/product/product.service.ts): `apps/meal-delivery/src/app/pages/product/product.service.ts`
- [House management](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/studentHouse): `apps/meal-delivery/src/app/pages/studentHouse`
- [House client](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/studentHouse/studentHouse.service.ts): `apps/meal-delivery/src/app/pages/studentHouse/studentHouse.service.ts`
- [User management](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery/src/app/pages/user): `apps/meal-delivery/src/app/pages/user`
- [User client](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery/src/app/pages/user/user.service.ts): `apps/meal-delivery/src/app/pages/user/user.service.ts`

### NestJS API

- [HTTP API](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/app.module.ts): `apps/meal-delivery-api/src/app/app.module.ts`
- [Auth endpoints](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/auth/auth.controller.ts): `apps/meal-delivery-api/src/app/auth/auth.controller.ts`
- [Auth service](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/auth/auth.service.ts): `apps/meal-delivery-api/src/app/auth/auth.service.ts`
- [Meal endpoints](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/meal/meal.controller.ts): `apps/meal-delivery-api/src/app/meal/meal.controller.ts`
- [Order endpoints](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/orderlist/orderlist.controller.ts): `apps/meal-delivery-api/src/app/orderlist/orderlist.controller.ts`
- [Product endpoints](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/product/product.controller.ts): `apps/meal-delivery-api/src/app/product/product.controller.ts`
- [Meal-product links](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/productlist/productlist.controller.ts): `apps/meal-delivery-api/src/app/productlist/productlist.controller.ts`
- [House endpoints](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/studentHouse/studentHouse.controller.ts): `apps/meal-delivery-api/src/app/studentHouse/studentHouse.controller.ts`
- [User endpoints](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/user/user.controller.ts): `apps/meal-delivery-api/src/app/user/user.controller.ts`
- [Mongo schemas](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/apps/meal-delivery-api/src/app/schema): `apps/meal-delivery-api/src/app/schema`

### Data stores

- **MongoDB**
- [Neo4j adapter](https://github.com/mjunhaochen/cswp-meal-delivery/blob/main/apps/meal-delivery-api/src/app/neo4j/neo4j.service.ts): `apps/meal-delivery-api/src/app/neo4j/neo4j.service.ts`
- **Neo4j**

### Shared contracts

- [Shared data contracts](https://github.com/mjunhaochen/cswp-meal-delivery/tree/main/libs/data/src/lib): `libs/data/src/lib`

### Other components

- **User**

## Connections

- User → Application shell: uses
- Application shell → Authentication UI: renders
- Application shell → Meals and orders: renders
- Application shell → Product management: renders
- Application shell → House management: renders
- Application shell → User management: renders
- Authentication UI → Auth client: submits credentials
- Auth client → Auth endpoints: HTTP requests
- Meals and orders → Meal client: requests meals
- Meals and orders → Order endpoints: order actions
- Meal client → Meal endpoints: HTTP requests
- Product management → Product client: requests products
- Product client → Product endpoints: HTTP requests
- Product management → Meal-product links: associate products
- House management → House client: requests houses
- House client → House endpoints: HTTP requests
- User management → User client: requests users
- User client → User endpoints: HTTP requests
- Auth endpoints → Auth service: delegates
- Auth service → MongoDB: reads and writes
- Auth service → Neo4j adapter: writes user node
- Neo4j adapter → Neo4j: executes query
- Meal endpoints → MongoDB: meal operations
- Order endpoints → MongoDB: order operations
- Product endpoints → MongoDB: product operations
- Meal-product links → MongoDB: association operations
- House endpoints → MongoDB: house operations
- User endpoints → MongoDB: user operations
- Mongo schemas → MongoDB: defines documents
- Shared data contracts → Auth client: shared types
- Shared data contracts → Auth endpoints: shared types
- Shared data contracts → Meal endpoints: shared types
- Shared data contracts → Product endpoints: shared types
- Shared data contracts → House endpoints: shared types
- Shared data contracts → User endpoints: shared types
