How codefactory-co/fastcampus-nestjs-part2 works
This repository implements a NestJS microservices order and commerce system: a gateway exposes authentication, product, and order APIs, while user, product, order, payment, and notification services handle domain work over gRPC. The principal order flow retrieves user and product data, checks the requested total, persists an order, then requests payment and updates order status. Source excerpts show the order orchestration and several service boundaries; some gateway routing and notification behavior is only indicated by configured clients, so those links are marked unverified.
Main entry points: order.service.ts Order Workflow · auth.service.ts User Authentication · payment.service.ts Payment Processing · user.service.ts User Service
Components 22
API Gateway
- Gateway App
apps/gateway/src/app.module.ts - Auth API
apps/gateway/src/auth/auth.controller.ts - Auth Proxy
apps/gateway/src/auth/auth.service.ts - Order API
apps/gateway/src/order/order.controller.ts - Product API
apps/gateway/src/product/product.controller.ts
Identity
- User Authentication
apps/user/src/auth/auth.service.ts - User Service
apps/user/src/user/user.service.ts - User Database
apps/user/src/user/entity/user.entity.ts
Commerce Services
- Order RPC
apps/order/src/order/order.controller.ts - Order Workflow
apps/order/src/order/order.service.ts - Order Store
apps/order/src/order/entity/order.entity.ts - Product RPC
apps/product/src/product/product.controller.ts - Product Catalog
apps/product/src/product/product.service.ts - Product Store
apps/product/src/product/entity/product.entity.ts - Payment RPC
apps/payment/src/payment/payment.controller.ts - Payment Processing
apps/payment/src/payment/payment.service.ts - Payment Store
apps/payment/src/payment/entity/payment.entity.ts
Notifications
- Notification RPC
apps/notification/src/notification/notification.controller.ts - Notification Service
apps/notification/src/notification/notification.service.ts - Notification Store
apps/notification/src/notification/entity/notification.entity.ts
Shared RPC
- gRPC Contracts
libs/common/src/grpc/proto/index.ts
Other components
- API Client
Connections 22
- API Client → Auth API: requests auth
apps/gateway/src/auth/auth.controller.ts - API Client → Order API: submits order
apps/gateway/src/order/order.controller.ts - Auth API → Auth Proxy: calls
apps/gateway/src/auth/auth.controller.ts - Auth Proxy → User Authentication: gRPC auth
apps/gateway/src/auth/auth.service.ts - API Client → Product API: requests products
apps/gateway/src/product/product.controller.ts - Order API → Order RPC: routes order
- Product API → Product RPC: routes catalog
- Order RPC → Order Workflow: delegates
apps/order/src/order/order.controller.ts - Order Workflow → User Service: fetches user
apps/order/src/order/order.service.ts - Order Workflow → Product Catalog: fetches products
apps/order/src/order/order.service.ts - Order Workflow → Payment RPC: requests payment
apps/order/src/order/order.service.ts - Order Workflow → Order Store: writes order
apps/order/src/order/order.service.ts - Product RPC → Product Catalog: delegates
apps/product/src/product/product.controller.ts - Product Catalog → Product Store: reads products
apps/product/src/product/product.service.ts - Payment RPC → Payment Processing: delegates
apps/payment/src/payment/payment.controller.ts - Payment Processing → Payment Store: stores payment
apps/payment/src/payment/payment.service.ts - Payment Processing → Notification RPC: notifies payment
- Notification RPC → Notification Service: delegates
apps/notification/src/notification/notification.controller.ts - Notification Service → Notification Store: stores notice
apps/notification/src/notification/notification.service.ts - User Authentication → User Service: creates user
apps/user/src/auth/auth.service.ts - User Authentication → User Database: checks credentials
apps/user/src/auth/auth.service.ts - User Service → User Database: persists user
apps/user/src/user/user.service.ts