mcpField
A
api-gateway-configuration

api-gateway-configuration

github.com/secondskyCloud & DevOps240416 installsUpdated 5w ago
Repository

About api-gateway-configuration

A guide to designing and configuring API gateways for microservice architectures. It outlines gateway responsibilities and provides configuration examples for Kong, Nginx, and AWS API Gateway.

Key features

  1. 01Request routing and load balancing
  2. 02Authentication and authorization
  3. 03Rate limiting and throttling
  4. 04Request and response transformation
  5. 05Logging and monitoring
  6. 06SSL termination

Use cases

  1. 01Plan an API gateway for microservices
  2. 02Configure service routes and load balancing
  3. 03Apply authentication and rate limits at the gateway
  4. 04Set up HTTPS, logging, and health checks

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/secondsky/claude-skills --skill api-gateway-configuration

After installing, type/api-gateway-configurationin Claude Code to confirm it loaded.

Details

From the project README

API Gateway Configuration

Design and configure API gateways for microservice architectures.

Gateway Responsibilities

  • Request routing and load balancing
  • Authentication and authorization
  • Rate limiting and throttling
  • Request/response transformation
  • Logging and monitoring
  • SSL termination

Kong Configuration (YAML)

_format_version: "3.0"

services:
  - name: user-service
    url: http://user-service:3000
    routes:
      - name: user-routes
        paths: ["/api/users"]
    plugins:
      - name: rate-limiting
        config:
          minute: 100
          policy: local
      - name: jwt

  - name: order-service
    url: http://order-service:3000
    routes:
      - name: order-routes
        paths: ["/api/orders"]

Nginx Configuration

upstream backend {
    server backend1:3000 weight=5;
    server backend2:3000 weight=5;
    keepalive 32;
}

server {
    listen 443 ssl;

    location /api/ {
        proxy_pass http://backend;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_cache_valid 200 1m;
    }

    location /health {
        return 200 'OK';
    }
}

AWS API Gateway (SAM)

Resources:
  ApiGateway:
    Type: AWS::Serverless::Api
    Properties:
      StageName: prod
      Auth:
        DefaultAuthorizer: JWTAuthorizer
        Authorizers:
          JWTAuthorizer:
            JwtConfiguration:
              issuer: !Sub "https://cognito-idp.${AWS::Region}.amazonaws.com/${UserPoolId}"

Best Practices

  • Authenticate at gateway level
  • Implement global rate limiting
  • Enable request logging
  • Use health checks for backends
  • Apply response caching strategically
  • Never expose backend details in errors
  • Enforce HTTPS in production

Comments

Markdown supported