{
  "slug": "cache-github-api-avoid-rate-limit",
  "title": "How to Cache Github API Rate Limit 60 Requests Per Hour",
  "metaTitle": "Cache Github API Rate Limit 60 - RealComposer",
  "metaDescription": "How to cache github api rate limit 60 requests per hour. Shield GitHub with 300s GET edge cache; cache key uses query params on.",
  "headline": "Edge TTL shield for Frontend / Web GitHub calls",
  "category": "caching",
  "categoryLabel": "Edge Caching & Rate Limits",
  "urgency": 9,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "GitHub"
  ],
  "searchIntentQuery": "how to cache github api rate limit 60 requests per hour",
  "directAnswerSummary": "To how to cache github api rate limit 60 requests per hour, set cacheTtlSeconds on a GET pipeline targeting https://api.github.com/user/repos?per_page=5. Identical query strings reuse Cloudflare caches.default before upstream sees traffic.",
  "problem": {
    "title": "Uncached GitHub spikes cost and latency",
    "explanation": "Every Frontend / Web visitor can trigger a fresh GitHub call. Bursts exhaust per-minute quotas even when data changes slowly.",
    "risks": [
      "Thundering herds after cache expiry on the origin",
      "Analytics skewed by client-side retry storms",
      "Support tickets blaming \"API downtime\" during spikes"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Add GITHUB_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Set headers, mapping, and cache TTL",
      "description": "Point step github at https://api.github.com/user/repos?per_page=5 with GET. Add output mapping fields that mirror the JSON contract your screen already expects. Set cache TTL to 300s so repeat GETs with the same query string hit caches.default."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/cache-github-api-avoid-rate-limit', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "How to Cache Github API Rate Limit 60 Requests Per Hour",
    "method": "GET",
    "cacheTtlSeconds": 300,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "github",
        "upstreamUrlTemplate": "https://api.github.com/user/repos?per_page=5",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.GITHUB_TOKEN}}",
          "Accept": "application/vnd.github+json"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "repoId",
          "sourcePath": "0.id",
          "type": "number",
          "sourceStep": "github"
        },
        {
          "targetPath": "fullName",
          "sourcePath": "0.full_name",
          "type": "string",
          "sourceStep": "github"
        },
        {
          "targetPath": "isPrivate",
          "sourcePath": "0.private",
          "type": "boolean",
          "sourceStep": "github"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_cache-gi",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "cache-github-api-avoid-rate-limit"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "repoId": "sample",
    "fullName": "sample",
    "isPrivate": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/cache-github-api-avoid-rate-limit\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "What should Frontend / Web store instead of GitHub secrets?",
      "answer": "Log request IDs for cache-github-api-avoid-rate-limit, not raw GitHub payloads, because upstream bodies may include PII."
    },
    {
      "question": "How do I forward JSON bodies to POST upstreams?",
      "answer": "cache-github-api-avoid-rate-limit vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Allowed origins on the cache-github-api-avoid-rate-limit client token restrict which domains may call the edge URL."
    }
  ],
  "relatedRecipeSlugs": [
    "combine-stripe-customer-and-invoices",
    "combine-openai-and-supabase-vector-search",
    "merge-plaid-accounts-and-transactions"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/cache-github-api-avoid-rate-limit",
    "markdown": "https://realcomposer.com/recipes/cache-github-api-avoid-rate-limit.md",
    "json": "https://realcomposer.com/recipes/cache-github-api-avoid-rate-limit.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=cache-github-api-avoid-rate-limit&via=agent"
  }
}