{
  "slug": "cache-linear-graphql-queries-edge",
  "title": "Cache linear api graphql queries at edge",
  "metaDescription": "Cache linear api graphql queries at edge. Shield Linear with no POST edge cache; cache key uses query params on cache-linear-graphql-queries-edge.",
  "headline": "Issue boards that poll without exhausting API",
  "category": "caching",
  "categoryLabel": "Edge Caching & Rate Limits",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Linear"
  ],
  "searchIntentQuery": "cache linear api graphql queries at edge",
  "directAnswerSummary": "Cache issue list queries with stale-while-revalidate pattern. For \"cache linear api graphql queries at edge\", store LINEAR_API_KEY in Secret Vault, call https://api.linear.app/graphql from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/cache-linear-graphql-queries-edge with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.",
  "problem": {
    "title": "Linear rate limits from Frontend / Web traffic",
    "explanation": "Without edge caching, identical Linear reads during a session still round-trip to the origin.",
    "risks": [
      "HTTP 429 responses during launch traffic",
      "Surprise SaaS overages from duplicate reads",
      "Slower repeat views than necessary"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Add LINEAR_API_KEY to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Use POST against https://api.linear.app/graphql. Allowed origins on the client token should match post pipelines set cache ttl to 0 because realcomposer only stores get responses at the edge."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Allowed origins on the token should list every Frontend / Web host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/cache-linear-graphql-queries-edge', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Cache linear api graphql queries at edge",
    "method": "POST",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "linear",
        "upstreamUrlTemplate": "https://api.linear.app/graphql",
        "httpMethod": "POST",
        "headersTemplate": {
          "Authorization": "{{secrets.LINEAR_API_KEY}}",
          "Content-Type": "application/json"
        },
        "timeoutMs": 10000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "issueId",
          "sourcePath": "data.issue.id",
          "type": "string",
          "sourceStep": "linear"
        },
        {
          "targetPath": "title",
          "sourcePath": "data.issue.title",
          "type": "string",
          "sourceStep": "linear"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_cache-li",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "cache-linear-graphql-queries-edge"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "issueId": "sample",
    "title": "sample"
  },
  "curlSnippet": "curl -X POST \"https://realcomposer.com/v1/workspace/cache-linear-graphql-queries-edge\" \\\n  -H \"Authorization: Bearer rc_live_client_token\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"example\"}'",
  "faqs": [
    {
      "question": "What should Frontend / Web store instead of Linear secrets?",
      "answer": "Use scoped tokens where the vendor allows them on cache-linear-graphql-queries-edge. Admin keys stay {{secrets.*}} references only."
    },
    {
      "question": "How do I forward JSON bodies to POST upstreams?",
      "answer": "Cache key for cache-linear-graphql-queries-edge: internal edge-cache path plus sorted query. Identical params hit; vary userId per user."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Upstream steps in cache-linear-graphql-queries-edge honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "stale-while-revalidate-third-party-api",
    "cache-github-api-avoid-rate-limit"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/cache-linear-graphql-queries-edge",
    "markdown": "https://realcomposer.com/recipes/cache-linear-graphql-queries-edge.md",
    "json": "https://realcomposer.com/recipes/cache-linear-graphql-queries-edge.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=cache-linear-graphql-queries-edge&via=agent"
  }
}