RealComposer
React NativeFirebaseEdge Caching & Rate Limits

Cache firebase firestore reads at edge

Repeat mobile reads without origin round trips

Direct Answer & Architecture Summary

Edge cache Firestore REST document GETs keyed by document path. For "cache firebase firestore reads at edge", store FIREBASE_ACCESS_TOKEN in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let React Native hit only https://realcomposer.com/v1/workspace/cache-firebase-firestore-reads-edge with an rc_live_ client token. Enable 180s GET cache only when query params identify the resource.

Security LevelAES-256-GCM Vault
Edge LatencySub-10ms Response
InfrastructureZero Server Maintenance
The Problem Solved

Uncached Firebase spikes cost and latency

Every React Native visitor can trigger a fresh Firebase call. Bursts exhaust per-minute quotas even when data changes slowly.

Critical Security & Operational Risks:
  • Thundering herds after cache expiry on the origin
  • Analytics skewed by client-side retry storms
  • Support tickets blaming "API downtime" during spikes
Architecture & Step-by-Step Implementation

How RealComposer Solves This at the Edge

1

Add vault secrets for this pipeline

Store FIREBASE_ACCESS_TOKEN in the vault. React Native never embeds the raw secret, only a revocable rc_live_ client token.

2

Configure upstream steps and output mapping

Configure headersTemplate to inject vault secrets, target https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}}, and Add output mapping fields that mirror the JSON contract your screen already expects.

3

Call from React Native

Allowed origins on the token should list every React Native host that calls this URL.

                    const res = await fetch('https://realcomposer.com/v1/workspace/cache-firebase-firestore-reads-edge', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
                  
Payload Slimming Comparison
85% Bandwidth Reduction
Raw Upstream Response254 B
              {
  "requestId": "req_cache-fi",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "cache-firebase-firestore-reads-edge"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
            
RealComposer Slimmed Edge Payload38 B
              {
  "docName": "sample",
  "fields": "sample"
}
            

Recipe Specs

HTTP method
GET
Upstream calls
1
Edge cache TTL
180s
Client auth
Restricted client token
Mapped output fields
2
Payload
254 B to 38 B (-85%)
Call from Terminal or Client
curl -X GET "https://realcomposer.com/v1/workspace/cache-firebase-firestore-reads-edge" \
  -H "Authorization: Bearer rc_live_client_token"
Frequently Asked Questions

Developer Questions & Troubleshooting

Which Firebase credential belongs in the vault for this pipeline?

Yes for cache-firebase-firestore-reads-edge. Ship only an rc_live_ client token in React Native; RealComposer injects FIREBASE_ACCESS_TOKEN on https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}}.

What cache key does RealComposer use?

cache-firebase-firestore-reads-edge POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

How do I rotate upstream credentials?

Upstream steps in cache-firebase-firestore-reads-edge honor timeoutMs and optional fallback JSON without leaking secrets.

Sources & Definitions Used in This Answer

Instant Deployment

Deploy this React Native + Firebase Recipe

Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.

CLONE THIS RECIPE
Related Architecture Recipes