{
  "slug": "lightweight-api-gateway-jamstack",
  "title": "Lightweight API Gateway for Jamstack and Static Sites",
  "metaTitle": "Lightweight API Gateway for - RealComposer",
  "metaDescription": "Lightweight api gateway for jamstack and static sites. Merge REST API in one Static HTML / Jamstack call with parallel Worker steps.",
  "headline": "One edge call merges REST API for Static HTML / Jamstack",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 8,
  "clientPlatform": "Static HTML / Jamstack",
  "upstreamServices": [
    "REST API"
  ],
  "searchIntentQuery": "lightweight api gateway for jamstack and static sites",
  "directAnswerSummary": "To lightweight api gateway for jamstack and static sites, configure parallel steps for REST API. Static HTML / Jamstack performs one authorized GET/POST to RealComposer and receives a merged payload.",
  "problem": {
    "title": "Serial REST API calls slow Static HTML / Jamstack pages",
    "explanation": "Each extra REST API hop adds hundreds of milliseconds and another OAuth refresh path your UI must manage.",
    "risks": [
      "One slow upstream blocking an entire page",
      "Partial failures leaving UI in inconsistent states",
      "Duplicate auth refresh logic per service"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Store API_BEARER_TOKEN in the vault. Static HTML / Jamstack never embeds the raw secret, only a revocable rc_live_ client token."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "Configure headersTemplate to inject vault secrets, target https://jsonplaceholder.typicode.com/users/{{query.userId}}, and Add output mapping fields that mirror the JSON contract your screen already expects."
    },
    {
      "stepNumber": 3,
      "title": "Call from Static HTML / Jamstack",
      "description": "Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.",
      "codeSnippet": "fetch('https://realcomposer.com/v1/workspace/lightweight-api-gateway-jamstack', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Lightweight API Gateway for Jamstack and Static Sites",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "upstream",
        "upstreamUrlTemplate": "https://jsonplaceholder.typicode.com/users/{{query.userId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.API_BEARER_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "userId",
          "sourcePath": "id",
          "type": "number",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "name",
          "sourcePath": "name",
          "type": "string",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "email",
          "sourcePath": "email",
          "type": "string",
          "sourceStep": "upstream"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_lightwei",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "lightweight-api-gateway-jamstack"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "userId": "sample",
    "name": "sample",
    "email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/lightweight-api-gateway-jamstack\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Does Static HTML / Jamstack need CORS changes after adding RealComposer?",
      "answer": "Log request IDs for lightweight-api-gateway-jamstack, not raw REST API payloads, because upstream bodies may include PII."
    },
    {
      "question": "What cache key does RealComposer use?",
      "answer": "lightweight-api-gateway-jamstack forwards client JSON to POST upstreams unchanged; secrets interpolate only in URLs and header templates."
    },
    {
      "question": "What happens if an upstream step times out?",
      "answer": "Upstream steps in lightweight-api-gateway-jamstack honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "reduce-json-payload-size-frontend",
    "filter-json-response-at-edge",
    "slim-github-api-response-mobile-widgets"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/lightweight-api-gateway-jamstack",
    "markdown": "https://realcomposer.com/recipes/lightweight-api-gateway-jamstack.md",
    "json": "https://realcomposer.com/recipes/lightweight-api-gateway-jamstack.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=lightweight-api-gateway-jamstack&via=agent"
  }
}