Cache linear api graphql queries at edge
Issue boards that poll without exhausting API
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.
Linear rate limits from Frontend / Web traffic
Without edge caching, identical Linear reads during a session still round-trip to the origin.
- HTTP 429 responses during launch traffic
- Surprise SaaS overages from duplicate reads
- Slower repeat views than necessary
How RealComposer Solves This at the Edge
Store upstream credentials in Secret Vault
Add LINEAR_API_KEY to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.
Target the real upstream URL
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.
Call from Frontend / Web
Allowed origins on the token should list every Frontend / Web host that calls this URL.
const res = await fetch('https://realcomposer.com/v1/workspace/cache-linear-graphql-queries-edge', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"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"
}
}
}
{
"issueId": "sample",
"title": "sample"
}
Recipe Specs
- HTTP method
- POST
- Upstream calls
- 1
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 2
- Payload
- 252 B to 37 B (-85%)
curl -X POST "https://realcomposer.com/v1/workspace/cache-linear-graphql-queries-edge" \
-H "Authorization: Bearer rc_live_client_token" \
-H "Content-Type: application/json" \
-d '{"model":"example"}'Developer Questions & Troubleshooting
What should Frontend / Web store instead of Linear secrets?
Use scoped tokens where the vendor allows them on cache-linear-graphql-queries-edge. Admin keys stay {{secrets.*}} references only.
How do I forward JSON bodies to POST upstreams?
Cache key for cache-linear-graphql-queries-edge: internal edge-cache path plus sorted query. Identical params hit; vary userId per user.
Can I restrict which domains call this pipeline?
Upstream steps in cache-linear-graphql-queries-edge honor timeoutMs and optional fallback JSON without leaking secrets.
Sources & Definitions Used in This Answer
- DefinitionGraphQL Query Language
- DefinitionGraphQL Persisted Queries
- DefinitionGraphQL Introspection
- DefinitionGraphQL Subscriptions
- DefinitionFederated API
- DefinitionGraphQL Fragments
- Stack guideWeb Frontends safe & unsafe practices
- Stack guideLinear safe & unsafe practices
- Official docsWeb Frontends documentation
- Official docsLinear documentation
Deploy this Frontend / Web + Linear Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.