RealComposer

Web Frontends Safe & Unsafe Practices

Direct Answer

Anything shipped to a browser, including environment variables inlined at build time, is readable by every visitor. Web frontends should hold only publishable keys and short-lived user or client tokens, and call private APIs through a server or edge proxy.

Credentials & Where They Belong

Client safe
Publishable keys and client tokens

Designed to be public and revocable.

Server only
Upstream secret keys

Any key that can read private data or spend money.

Safe Practices

  • Proxy private API calls

    Send requests to your own edge endpoint, which injects secrets and enforces CORS.

  • Set a Content Security Policy

    Restrict script and connect sources to reduce the impact of XSS.

  • Prefer HttpOnly cookies for sessions

    JavaScript cannot read HttpOnly cookies, which limits token theft through XSS.

Unsafe Practices

  • Hiding secrets in environment variables

    Bundlers inline them into JavaScript, where DevTools and scrapers can read them.

  • Obfuscating keys in code

    Obfuscation delays nobody. The key still appears in network requests.

  • Rendering untrusted HTML from APIs

    innerHTML with upstream content opens XSS that can steal sessions.

The RealComposer Pattern

Point the frontend at a RealComposer edge URL with an rc_live_ client token and allowed origins configured, so upstream secrets stay in the vault.

START BUILDING FREE

Frequently Asked Questions

Q:Are .env files safe in frontend projects?

Only for values that are meant to be public. Anything the build reads ends up in the bundle.

Security & Secret Vault

Call Plaid API from Flutter without Exposing Client Secret

To solve call plaid api from flutter without exposing client secret, never execute unauthenticated requests or embed private tokens directly in client bundles. RealComposer acts as a sub-10ms edge gateway running on Cloudflare Workers that securely injects credentials from your Secret Vault, normalizes responses, and prevents unauthorized API usage. Route calls through your RealComposer edge URL to guarantee complete privacy, robust origin validation, and low mobile latency.

Sub-10ms edgeView Recipe
Security & Secret Vault

Call Github API with Private Personal Access Token from Client

To solve call github api with private personal access token from client, never execute unauthenticated requests or embed private tokens directly in client bundles. RealComposer acts as a sub-10ms edge gateway running on Cloudflare Workers that securely injects credentials from your Secret Vault, normalizes responses, and prevents unauthorized API usage. Route calls through your RealComposer edge URL to guarantee complete privacy, robust origin validation, and low mobile latency.

Sub-10ms edgeView Recipe

Related Concepts