# narumedsr-p/cu_marketplace architecture

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

- Interactive diagram: https://gitdiagram.com/narumedsr-p/cu_marketplace
- Repository: https://github.com/narumedsr-p/cu_marketplace

## Overview

CU_Marketplace is a campus marketplace scaffold organized as a public API gateway and seven domain services, each documented as owning an isolated Postgres database. The intended request path is client → gateway authentication/proxy → a domain service; gateway-issued JWT claims are forwarded as identity headers for downstream services. The major domain stages include listings, orders, chat, wishlists and matching, reviews, moderation/profiles, and notifications. The web app is described as a starter not yet wired to the API. Service-to-service links below follow the README; sampled source is incomplete and some business logic is explicitly unimplemented.

Main entry points: [`apps/api-gateway/src/proxy/proxy.module.ts`](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/proxy/proxy.module.ts) (Service proxies), [`apps/moderation-service/src/app.module.ts`](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/moderation-service/src/app.module.ts) (Moderation & profiles), [`apps/order-service/src/orders/orders.controller.ts`](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/order-service/src/orders/orders.controller.ts) (Orders & handover), [`apps/api-gateway/src/openapi/openapi.controller.ts`](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/openapi/openapi.controller.ts) (API docs aggregator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Client Experience"]
  node_web["Web starter<br/>[App.tsx]"]
end

subgraph group_gateway["API Gateway"]
  node_auth["JWT auth<br/>[auth.service.ts]"]
  node_gateway_guard["Gateway guard"]
  node_gateway_proxy["Service proxies<br/>[proxy.module.ts]"]
  node_openapi["API docs aggregator"]
end

subgraph group_commerce["Marketplace Services"]
  node_catalog["Listings &amp; categories<br/>[app.module.ts]"]
  node_catalog_db[("Catalog database")]
  node_orders["Orders &amp; handover"]
  node_orders_db[("Order database")]
  node_wishlist["Wishlist &amp; matching"]
  node_wishlist_db[("Wishlist database")]
end

subgraph group_community["Community Services"]
  node_chat["Chat rooms<br/>[chat.controller.ts]"]
  node_chat_db[("Chat database")]
  node_reviews["Seller reviews"]
  node_reviews_db[("Review database")]
end

subgraph group_platform["Platform Services"]
  node_moderation["Moderation &amp; profiles<br/>[app.module.ts]"]
  node_moderation_db[("Moderation database")]
  node_notifications["Notifications &amp; preferences"]
  node_notifications_db[("Notification database")]
end

node_user(("Marketplace user"))

node_user -->|"opens"| node_web
node_user -->|"requests token"| node_auth
node_auth -->|"checks profile"| node_moderation
node_user -->|"sends bearer token"| node_gateway_guard
node_gateway_guard -->|"forwards identity"| node_gateway_proxy
node_gateway_proxy -->|"proxies requests"| node_catalog
node_gateway_proxy -->|"proxies requests"| node_orders
node_gateway_proxy -->|"proxies requests"| node_chat
node_gateway_proxy -->|"proxies requests"| node_wishlist
node_gateway_proxy -->|"proxies requests"| node_reviews
node_gateway_proxy -->|"proxies requests"| node_moderation
node_gateway_proxy -->|"proxies requests"| node_notifications
node_openapi -->|"fetches docs"| node_catalog
node_openapi -->|"fetches docs"| node_orders
node_openapi -->|"fetches docs"| node_chat
node_openapi -->|"fetches docs"| node_wishlist
node_openapi -->|"fetches docs"| node_reviews
node_openapi -->|"fetches docs"| node_moderation
node_openapi -->|"fetches docs"| node_notifications
node_catalog -->|"reads/writes"| node_catalog_db
node_orders -->|"reads/writes"| node_orders_db
node_wishlist -->|"reads/writes"| node_wishlist_db
node_chat -->|"reads/writes"| node_chat_db
node_reviews -->|"reads/writes"| node_reviews_db
node_moderation -->|"reads/writes"| node_moderation_db
node_notifications -->|"reads/writes"| node_notifications_db
node_orders -->|"calls catalog"| node_catalog
node_orders -->|"calls chat"| node_chat
node_orders -->|"calls notifications"| node_notifications
node_wishlist -->|"calls catalog"| node_catalog
node_wishlist -->|"calls notifications"| node_notifications
node_chat -->|"calls notifications"| node_notifications
node_reviews -->|"calls orders"| node_orders
node_reviews -->|"calls notifications"| node_notifications
node_moderation -->|"calls catalog"| node_catalog
node_moderation -->|"calls orders"| node_orders
node_moderation -->|"calls chat"| node_chat
node_moderation -->|"calls notifications"| node_notifications

click node_web "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/web/src/App.tsx"
click node_auth "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/auth/auth.service.ts"
click node_gateway_guard "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/common/guards/gateway-auth.guard.ts"
click node_gateway_proxy "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/proxy/proxy.module.ts"
click node_openapi "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/openapi/openapi.controller.ts"
click node_catalog "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/catalog-service/src/app.module.ts"
click node_orders "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/order-service/src/orders/orders.controller.ts"
click node_wishlist "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/wishlist-service/src/match/auto-match.controller.ts"
click node_chat "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/chat-service/src/chat/chat.controller.ts"
click node_reviews "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/review-service/src/reviews/reviews.controller.ts"
click node_moderation "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/moderation-service/src/app.module.ts"
click node_notifications "https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/notification-service/src/notifications/notifications.controller.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_web,node_user toneBlue
class node_auth,node_gateway_guard,node_gateway_proxy,node_openapi toneAmber
class node_catalog,node_catalog_db,node_orders,node_orders_db,node_wishlist,node_wishlist_db toneMint
class node_chat,node_chat_db,node_reviews,node_reviews_db toneRose
class node_moderation,node_moderation_db,node_notifications,node_notifications_db toneIndigo
```

## Components

### Client Experience

- [Web starter](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`

### API Gateway

- [JWT auth](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/auth/auth.service.ts): `apps/api-gateway/src/auth/auth.service.ts`
- [Gateway guard](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/common/guards/gateway-auth.guard.ts): `apps/api-gateway/src/common/guards/gateway-auth.guard.ts`
- [Service proxies](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/proxy/proxy.module.ts): `apps/api-gateway/src/proxy/proxy.module.ts`
- [API docs aggregator](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/api-gateway/src/openapi/openapi.controller.ts): `apps/api-gateway/src/openapi/openapi.controller.ts`

### Marketplace Services

- [Listings & categories](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/catalog-service/src/app.module.ts): `apps/catalog-service/src/app.module.ts`
- **Catalog database**
- [Orders & handover](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/order-service/src/orders/orders.controller.ts): `apps/order-service/src/orders/orders.controller.ts`
- **Order database**
- [Wishlist & matching](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/wishlist-service/src/match/auto-match.controller.ts): `apps/wishlist-service/src/match/auto-match.controller.ts`
- **Wishlist database**

### Community Services

- [Chat rooms](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/chat-service/src/chat/chat.controller.ts): `apps/chat-service/src/chat/chat.controller.ts`
- **Chat database**
- [Seller reviews](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/review-service/src/reviews/reviews.controller.ts): `apps/review-service/src/reviews/reviews.controller.ts`
- **Review database**

### Platform Services

- [Moderation & profiles](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/moderation-service/src/app.module.ts): `apps/moderation-service/src/app.module.ts`
- **Moderation database**
- [Notifications & preferences](https://github.com/narumedsr-p/cu_marketplace/blob/main/apps/notification-service/src/notifications/notifications.controller.ts): `apps/notification-service/src/notifications/notifications.controller.ts`
- **Notification database**

### Other components

- **Marketplace user**

## Connections

- Marketplace user → Web starter: opens
- Marketplace user → JWT auth: requests token
- JWT auth → Moderation & profiles: checks profile
- Marketplace user → Gateway guard: sends bearer token
- Gateway guard → Service proxies: forwards identity
- Service proxies → Listings & categories: proxies requests
- Service proxies → Orders & handover: proxies requests
- Service proxies → Chat rooms: proxies requests
- Service proxies → Wishlist & matching: proxies requests
- Service proxies → Seller reviews: proxies requests
- Service proxies → Moderation & profiles: proxies requests
- Service proxies → Notifications & preferences: proxies requests
- API docs aggregator → Listings & categories: fetches docs
- API docs aggregator → Orders & handover: fetches docs
- API docs aggregator → Chat rooms: fetches docs
- API docs aggregator → Wishlist & matching: fetches docs
- API docs aggregator → Seller reviews: fetches docs
- API docs aggregator → Moderation & profiles: fetches docs
- API docs aggregator → Notifications & preferences: fetches docs
- Listings & categories → Catalog database: reads/writes
- Orders & handover → Order database: reads/writes
- Wishlist & matching → Wishlist database: reads/writes
- Chat rooms → Chat database: reads/writes
- Seller reviews → Review database: reads/writes
- Moderation & profiles → Moderation database: reads/writes
- Notifications & preferences → Notification database: reads/writes
- Orders & handover → Listings & categories: calls catalog
- Orders & handover → Chat rooms: calls chat
- Orders & handover → Notifications & preferences: calls notifications
- Wishlist & matching → Listings & categories: calls catalog
- Wishlist & matching → Notifications & preferences: calls notifications
- Chat rooms → Notifications & preferences: calls notifications
- Seller reviews → Orders & handover: calls orders
- Seller reviews → Notifications & preferences: calls notifications
- Moderation & profiles → Listings & categories: calls catalog
- Moderation & profiles → Orders & handover: calls orders
- Moderation & profiles → Chat rooms: calls chat
- Moderation & profiles → Notifications & preferences: calls notifications
