RealComposer
Frontend / WebAlgoliaSecurity & Secret Vault

Call Algolia Write API from Client without Master Key

Algolia secrets stay out of Frontend / Web bundles

Direct Answer & Architecture Summary

Frontend / Web cannot safely store Algolia production keys. Vault-bound headers reach https://{{secrets.ALGOLIA_APP_ID}}-dsn.algolia.net/1/indexes/{{query.index}}/query on Workers while apps call your algolia-write-api-secure-proxy edge URL.

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

Why Frontend / Web leaks Algolia credentials

Attackers routinely extract Algolia secrets from Frontend / Web builds. Direct browser calls also expose internal error payloads with hostnames.

Critical Security & Operational Risks:
  • Production Algolia keys copied from Frontend / Web bundles
  • Compliance violations after credential leaks
  • Attackers replaying vault-grade scopes from a laptop
Architecture & Step-by-Step Implementation

How RealComposer Solves This at the Edge

1

Bind vault keys to the Worker

Add ALGOLIA_API_KEY to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.

2

Configure upstream steps and output mapping

Use POST against https://{{secrets.ALGOLIA_APP_ID}}-dsn.algolia.net/1/indexes/{{query.index}}/query. Allowed origins on the client token should match post pipelines set cache ttl to 0 because realcomposer only stores get responses at the edge.

3

Call from Frontend / Web

Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

                    const res = await fetch('https://realcomposer.com/v1/workspace/algolia-write-api-secure-proxy', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
                  
Payload Slimming Comparison
84% Bandwidth Reduction
Raw Upstream Response249 B
              {
  "requestId": "req_algolia-",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "algolia-write-api-secure-proxy"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
            
RealComposer Slimmed Edge Payload41 B
              {
  "hitCount": "sample",
  "firstHit": "sample"
}
            

Recipe Specs

HTTP method
POST
Upstream calls
1
Edge cache TTL
No caching
Client auth
Restricted client token
Mapped output fields
2
Payload
249 B to 41 B (-84%)
Call from Terminal or Client
curl -X POST "https://realcomposer.com/v1/workspace/algolia-write-api-secure-proxy" \
  -H "Authorization: Bearer rc_live_client_token" \
  -H "Content-Type: application/json" \
  -d '{"model":"example"}'
Frequently Asked Questions

Developer Questions & Troubleshooting

Is it safe to log Algolia responses in Frontend / Web?

Yes for algolia-write-api-secure-proxy. Ship only an rc_live_ client token in Frontend / Web; RealComposer injects ALGOLIA_API_KEY on https://{{secrets.ALGOLIA_APP_ID}}-dsn.algolia.net/1/indexes/{{query.index}}/query.

Will Anthropic or Linear prompt bodies be rewritten?

algolia-write-api-secure-proxy POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

Can I restrict which domains call this pipeline?

Allowed origins on the algolia-write-api-secure-proxy client token restrict which domains may call the edge URL.

Sources & Definitions Used in This Answer

Instant Deployment

Deploy this Frontend / Web + Algolia 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