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

Hide salesforce api credentials in javascript client app

Edge pipeline attaches Bearer tokens so static sites never embed secrets. For "hide salesforce api credentials in javascript client app", store SALESFORCE_ACCESS_TOKEN in Secret Vault, call https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}} from a Worker, and let JavaScript / HTML hit only https://realcomposer.com/v1/workspace/hide-salesforce-credentials-javascript with an rc_live_ client token.

Sub-10ms edgeView Recipe
Multi-API Aggregation

Merge salesforce contacts with hubspot crm one api

Parallel fetch Salesforce Contact and HubSpot CRM contact into one JSON object. For "merge salesforce contacts with hubspot crm one api", store SALESFORCE_ACCESS_TOKEN, HUBSPOT_ACCESS_TOKEN in Secret Vault, call https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}} from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/merge-salesforce-with-hubspot-api with an rc_live_ client token.

Sub-10ms edgeView Recipe

Related Concepts