Section 11: Lab: Resilience in a Multi-Service System
- Set timeouts on service calls with RxJS
- Retry with back-off, and when not to retry
- The circuit breaker idea and fallbacks
- Graceful shutdown with enableShutdownHooks
- Lab: a gateway that still responds when a downstream service fails
Section 12: Security between Services
- Authenticate at the gateway with JWT and pass user details on
- Check permissions in internal services with guards
- Keep an internal network and never expose service ports publicly
- Store secrets safely, and the idea of TLS between services
- Lab: make the order service accept only requests from the gateway
Section 13: Lab: Health Checks, Logs and Tracing
- Health checks for services, databases and brokers with @nestjs/terminus
- Structured logs with a correlation ID across services
- Distributed tracing with OpenTelemetry
- Follow a request's path in Jaeger
- Lab: find the service that slows down orders
Section 14: Lab: Testing and Deploying with Docker Compose
- Unit-test handlers with Vitest and a mocked ClientProxy
- Write a multi-stage Dockerfile for each service
- Combine every service, broker and database in docker-compose.yml
- Scale out instances and share work through queues
- PM2 for a single server, and an overview of moving to Kubernetes
Section 15: Workshop: A Microservices Store Capstone
- Bring together the gateway and the user, product, order and notification services
- Connect services over RabbitMQ, NATS and gRPC as designed
- Test failed services and duplicate messages
- Monitor the whole system with health checks and tracing
- Workshop: present the architecture and next steps for your organisation