{
  "title": "API Gateway Pattern",
  "description": "API Gateway pattern providing single entry point for microservices",
  "type": "architecture-pattern",
  "data": {
    "nodes": [
      {
        "id": "external-client",
        "type": "external-system",
        "position": {
          "x": 432,
          "y": 208.83333333333334
        },
        "data": {
          "mode": "full",
          "externalSystem": {
            "id": "mobile-app",
            "name": "Mobile App",
            "version": "1.0.0",
            "summary": "Mobile application making API requests"
          },
          "editor": {
            "title": "External System",
            "subtitle": "Edit the details of the external system",
            "schema": {
              "type": "object",
              "required": [
                "externalSystem",
                "mode"
              ],
              "properties": {
                "externalSystem": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "Random value",
                      "description": "The name of the external system"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the external system"
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 100
        }
      },
      {
        "id": "service-api-gateway",
        "type": "service",
        "position": {
          "x": 814,
          "y": 42.166666666666664
        },
        "data": {
          "mode": "full",
          "service": {
            "id": "api-gateway",
            "name": "API Gateway",
            "owners": [
              "platform-team"
            ],
            "sends": [],
            "receives": [],
            "version": "1.0.0",
            "summary": "Single entry point handling routing, auth, rate limiting, and aggregation"
          }
        },
        "measured": {
          "width": 262,
          "height": 113
        }
      },
      {
        "id": "service-user",
        "type": "service",
        "position": {
          "x": 1196,
          "y": 12
        },
        "data": {
          "mode": "full",
          "service": {
            "id": "user-service",
            "name": "User Service",
            "owners": [
              "user-team"
            ],
            "sends": [
              "UserCreated"
            ],
            "receives": [
              "GetUser",
              "CreateUser"
            ],
            "version": "1.0.0",
            "summary": "Manages user accounts and profiles"
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        }
      },
      {
        "id": "service-order",
        "type": "service",
        "position": {
          "x": 1196,
          "y": 190
        },
        "data": {
          "mode": "full",
          "service": {
            "id": "order-service",
            "name": "Order Service",
            "owners": [
              "order-team"
            ],
            "sends": [
              "OrderCreated"
            ],
            "receives": [
              "GetOrders",
              "CreateOrder"
            ],
            "version": "1.0.0",
            "summary": "Handles order processing and management"
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        }
      },
      {
        "id": "service-payment",
        "type": "service",
        "position": {
          "x": 1196,
          "y": 368
        },
        "data": {
          "mode": "full",
          "service": {
            "id": "payment-service",
            "name": "Payment Service",
            "owners": [
              "payment-team"
            ],
            "sends": [
              "PaymentProcessed"
            ],
            "receives": [
              "ProcessPayment"
            ],
            "version": "1.0.0",
            "summary": "Processes payments and handles billing"
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        }
      },
      {
        "id": "data-cache",
        "type": "data",
        "position": {
          "x": 1196,
          "y": 546
        },
        "data": {
          "mode": "full",
          "data": {
            "id": "api-cache",
            "name": "API Cache (Redis)",
            "owners": [
              "platform-team"
            ],
            "version": "1.0.0",
            "summary": "Caches frequently requested data to improve performance",
            "type": "Cache"
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        }
      },
      {
        "id": "service-auth",
        "type": "service",
        "position": {
          "x": 1196,
          "y": 724
        },
        "data": {
          "mode": "full",
          "service": {
            "id": "auth-service",
            "name": "Auth Service",
            "owners": [
              "security-team"
            ],
            "sends": [],
            "receives": [
              "ValidateToken"
            ],
            "version": "1.0.0",
            "summary": "Validates authentication tokens and manages authorization"
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        }
      },
      {
        "id": "query-get-dashboard",
        "type": "query",
        "position": {
          "x": 432,
          "y": 30.833333333333336
        },
        "data": {
          "mode": "full",
          "message": {
            "id": "get-dashboard",
            "name": "GET /dashboard",
            "version": "1.0.0",
            "summary": "Aggregated dashboard data from multiple services"
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        }
      },
      {
        "id": "note-api-gateway-instructions",
        "type": "note",
        "position": {
          "x": 12,
          "y": 12
        },
        "data": {
          "text": "🚪 **API Gateway Pattern**\n\nSingle entry point for all client requests to microservices:\n\n**📱 Clients** → **🚪 API Gateway** → **⚙️ Microservices**\n\n**Gateway Responsibilities:**\n• **Request routing** - Routes to appropriate microservice\n• **Authentication** - Validates tokens and user identity\n• **Rate limiting** - Prevents abuse and ensures fair usage\n• **Response aggregation** - Combines data from multiple services\n• **Caching** - Reduces load on downstream services\n• **Monitoring** - Centralized logging and metrics\n\n**Key Benefits:**\n• **Simplified clients** - Single endpoint instead of many\n• **Cross-cutting concerns** - Auth, logging, etc. in one place\n• **Protocol translation** - HTTP to internal protocols\n• **Load balancing** - Distributes requests across instances\n\n**💡 Pro tip:** Great for mobile apps and SPAs, but avoid creating a monolithic gateway!",
          "color": "pink"
        },
        "measured": {
          "width": 400,
          "height": 280
        },
        "width": 400,
        "height": 280
      }
    ],
    "edges": [
      {
        "source": "external-client",
        "target": "service-api-gateway",
        "label": "API Requests",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": false,
        "type": "default",
        "id": "xy-edge__external-client-service-api-gateway"
      },
      {
        "source": "query-get-dashboard",
        "target": "service-api-gateway",
        "label": "Aggregated Request",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": false,
        "type": "default",
        "id": "xy-edge__query-get-dashboard-service-api-gateway"
      },
      {
        "source": "service-api-gateway",
        "target": "data-cache",
        "label": "Cache Check",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": false,
        "type": "default",
        "id": "xy-edge__service-api-gateway-data-cache"
      },
      {
        "source": "service-api-gateway",
        "target": "service-auth",
        "label": "Validate Token",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": false,
        "type": "default",
        "id": "xy-edge__service-api-gateway-service-auth"
      },
      {
        "source": "service-api-gateway",
        "target": "service-user",
        "label": "Route Request",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__service-api-gateway-service-user"
      },
      {
        "source": "service-api-gateway",
        "target": "service-order",
        "label": "Route Request",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__service-api-gateway-service-order"
      },
      {
        "source": "service-api-gateway",
        "target": "service-payment",
        "label": "Route Request",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__service-api-gateway-service-payment"
      }
    ],
    "viewport": {
      "x": 176.23005682274425,
      "y": 70.48013971760818,
      "zoom": 0.6116742684863479
    },
    "creationDate": "2025-08-11T15:37:15.636Z",
    "name": "API Gateway Pattern",
    "version": "1.0",
    "source": "https://app.eventcatalog.dev",
    "appState": {},
    "id": "api-gateway-pattern"
  },
  "usecase": "Design API Gateway Architecture",
  "mermaid": "flowchart LR\n    C[Client] --> G[API Gateway]\n    G --> U[User Service]\n    G --> O[Order Service]\n    G --> P[Payment Service]",
  "tags": ["API Design", "Microservices"]
}