# Connect firebase to bubble io without server code

> Firebase reads via RealComposer edge connector. For "connect firebase to bubble io without server code", 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 Bubble.io hit only https://realcomposer.com/v1/workspace/connect-firebase-to-bubble-no-server with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/connect-firebase-to-bubble-no-server
- Client platform: Bubble.io
- Upstream services: Firebase
- Category: Platforms & Frameworks
- JSON version: https://realcomposer.com/recipes/connect-firebase-to-bubble-no-server.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=connect-firebase-to-bubble-no-server&via=agent

## Problem: CORS blocks Firebase in Bubble.io

Low-code Bubble.io tools expose connector tokens in shared workspaces, so Firebase credentials leak to every editor.

- Browser console CORS errors blocking launches
- Editors pasting secrets into reusable components
- Inability to test locally without disabling security

## Solution steps

1. **Bind vault keys to the Worker**: Store FIREBASE_ACCESS_TOKEN in the vault. Bubble.io never embeds the raw secret, only a revocable rc_live_ client token.

2. **Configure upstream steps and output mapping**: 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. **Connect Bubble API Connector**: Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

```
API Connector GET https://realcomposer.com/v1/workspace/connect-firebase-to-bubble-no-server
Private header: Authorization Bearer rc_live_your_token
```

## 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": "Connect firebase to bubble io without server code",
  "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/connect-firebase-to-bubble-no-server" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_connect-",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "connect-firebase-to-bubble-no-server"
  },
  "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?

Log request IDs for connect-firebase-to-bubble-no-server, not raw Firebase payloads, because upstream bodies may include PII.

### What cache key does RealComposer use?

connect-firebase-to-bubble-no-server vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.

### How do I rotate upstream credentials?

Allowed origins on the connect-firebase-to-bubble-no-server client token restrict which domains may call the edge URL.
