Files
pos-system/docs/en/skills/api-gateway-advanced.md
Ho Ngoc Hai 478254400a Refactor service documentation and enhance bilingual support
- Updated service template structure in `ARCHITECTURE.md` and `README.md` for clarity and usability.
- Enhanced bilingual documentation across skills, increasing the number of available skills from 15 to 25.
- Added new sections on event-driven architecture, inter-service communication, and performance optimization.
- Improved formatting and removed outdated references to streamline the documentation experience.
2026-01-01 10:06:27 +07:00

1.5 KiB

name, description
name description
api-gateway-advanced Advanced API Gateway patterns for GoodGo microservices including API composition, request/response transformation, service mesh integration, advanced routing, and gateway-level resilience.

API Gateway Advanced Patterns

When to Use This Skill

Use this skill when:

  • Implementing API composition and aggregation
  • Transforming requests/responses at gateway level
  • Integrating service mesh with Traefik
  • Implementing advanced routing strategies
  • Adding gateway-level circuit breakers
  • Implementing API versioning at gateway

Key Patterns

API Composition

// Aggregate multiple service responses
const [user, orders, payments] = await Promise.all([
  userClient.get(`/users/${userId}`),
  orderClient.get(`/orders?userId=${userId}`),
  paymentClient.get(`/payments?userId=${userId}`),
]);

Request/Response Transformation

// Transform at gateway level
transformer.addRule({
  path: '/api/v1/users',
  requestTransform: (req) => {
    if (!req.query.page) req.query.page = '1';
    return req;
  },
  responseTransform: (res, data) => {
    return { success: true, data };
  },
});

Best Practices

  1. Use API composition for aggregating related data
  2. Cache at gateway for frequently accessed data
  3. Implement circuit breaker at gateway level
  4. Keep transformations simple and testable

Resources