RealComposer
Frontend / WebGoogle MapsSecurity & Secret Vault

Hide Google Maps API Key in Web App

Google Maps secrets stay out of Frontend / Web bundles

Direct Answer & Architecture Summary

Frontend / Web cannot safely store Google Maps production keys. Vault-bound headers reach https://maps.googleapis.com/maps/api/place/autocomplete/json?input={{query.input}}&key={{secrets.GOOGLE_MAPS_API_KEY}} on Workers while apps call your google-maps-api-proxy-edge edge URL.

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

Why Frontend / Web leaks Google Maps credentials

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

Critical Security & Operational Risks:
  • Production Google Maps 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

Add vault secrets for this pipeline

Create GOOGLE_MAPS_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.

2

Target the real upstream URL

Use GET against https://maps.googleapis.com/maps/api/place/autocomplete/json?input={{query.input}}&key={{secrets.GOOGLE_MAPS_API_KEY}}. Allowed origins on the client token should match 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 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/google-maps-api-proxy-edge', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
                  
Payload Slimming Comparison
82% Bandwidth Reduction
Raw Upstream Response245 B
              {
  "requestId": "req_google-m",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "google-maps-api-proxy-edge"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
            
RealComposer Slimmed Edge Payload43 B
              {
  "description": "sample",
  "placeId": "sample"
}
            

Recipe Specs

HTTP method
GET
Upstream calls
1
Edge cache TTL
No caching
Client auth
Restricted client token
Mapped output fields
2
Payload
245 B to 43 B (-82%)
Call from Terminal or Client
curl -X GET "https://realcomposer.com/v1/workspace/google-maps-api-proxy-edge" \
  -H "Authorization: Bearer rc_live_client_token"
Frequently Asked Questions

Developer Questions & Troubleshooting

Is it safe to log Google Maps responses in Frontend / Web?

Store GOOGLE_MAPS_API_KEY for google-maps-api-proxy-edge. Frontend / Web never sees decrypted values.

When does edge caching apply to this recipe?

google-maps-api-proxy-edge vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.

How do I rotate upstream credentials?

Rotate vault secrets for google-maps-api-proxy-edge anytime; clients keep the same rc_live_ token.

Sources & Definitions Used in This Answer

Instant Deployment

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