# Firebase rest api proxy for webflow site

> Firestore REST reads via edge with service token vault injection. For "firebase rest api proxy for webflow site", 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 Webflow hit only https://realcomposer.com/v1/workspace/firebase-rest-proxy-webflow with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/firebase-rest-proxy-webflow
- Client platform: Webflow
- Upstream services: Firebase
- Category: Security & Secret Vault
- JSON version: https://realcomposer.com/recipes/firebase-rest-proxy-webflow.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=firebase-rest-proxy-webflow&via=agent

## Problem: Firebase keys in Webflow network tabs

Webflow ships code or scripts to end-user devices. Any Firebase bearer token in those bundles can be copied from DevTools, proxies, or repackaged apps.

- Shared Webflow projects revealing Firebase tokens
- Sudden Firebase quota burn from scripted abuse
- Inability to rotate keys without redeploying clients

## Solution steps

1. **Add vault secrets for this pipeline**: Create FIREBASE_ACCESS_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.

2. **Target the real upstream URL**: Point step firebase at https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} with GET. Add output mapping fields that mirror the JSON contract your screen already expects. Leave cache TTL at 0 when each response is user-specific (include userId or record id in query params before enabling cache).

3. **Call from Webflow custom code**: Call https://realcomposer.com/v1/workspace/firebase-rest-proxy-webflow with a restricted rc_live_ client token. Webflow never sends upstream secrets.

```
fetch('https://realcomposer.com/v1/workspace/firebase-rest-proxy-webflow', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
}).then(r => r.json());
```

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Firebase rest api proxy for webflow site",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "firebase",
      "upstreamUrlTemplate": "https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}}",
      "httpMethod": "GET",
      "headersTemplate": {
        "Authorization": "Bearer {{secrets.FIREBASE_ACCESS_TOKEN}}"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "docName",
        "sourcePath": "name",
        "type": "string",
        "sourceStep": "firebase"
      },
      {
        "targetPath": "fields",
        "sourcePath": "fields",
        "type": "object",
        "sourceStep": "firebase"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/firebase-rest-proxy-webflow" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_firebase",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "firebase-rest-proxy-webflow"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "docName": "sample",
  "fields": "sample"
}
```

## FAQ

### Which Firebase credential belongs in the vault for this pipeline?

Store FIREBASE_ACCESS_TOKEN for firebase-rest-proxy-webflow. Webflow never sees decrypted values.

### Does POST traffic get cached?

firebase-rest-proxy-webflow vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.

### Can I restrict which domains call this pipeline?

Upstream steps in firebase-rest-proxy-webflow honor timeoutMs and optional fallback JSON without leaking secrets.
