Backend for Frontend without Express Or Docker
One edge call merges REST API for Frontend / Web
To backend for frontend without express or docker, configure parallel steps for REST API. Frontend / Web performs one authorized GET/POST to RealComposer and receives a merged payload.
Serial REST API calls slow Frontend / Web pages
Each extra REST API hop adds hundreds of milliseconds and another OAuth refresh path your UI must manage.
- One slow upstream blocking an entire page
- Partial failures leaving UI in inconsistent states
- Duplicate auth refresh logic per service
How RealComposer Solves This at the Edge
Store upstream credentials in Secret Vault
Add API_BEARER_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.
Configure upstream steps and output mapping
Point step upstream at https://jsonplaceholder.typicode.com/users/{{query.userId}} 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).
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/bff-without-express-or-docker', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_bff-with",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "bff-without-express-or-docker"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"userId": "sample",
"name": "sample",
"email": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 1
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 3
- Payload
- 248 B to 52 B (-79%)
curl -X GET "https://realcomposer.com/v1/workspace/bff-without-express-or-docker" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
Is it safe to log REST API responses in Frontend / Web?
Store API_BEARER_TOKEN for bff-without-express-or-docker. Frontend / Web never sees decrypted values.
When does edge caching apply to this recipe?
bff-without-express-or-docker vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.
What happens if an upstream step times out?
Upstream steps in bff-without-express-or-docker honor timeoutMs and optional fallback JSON without leaking secrets.
Sources & Definitions Used in This Answer
- DefinitionBackend for Frontend (BFF)
- DefinitionCustom Domain Edge Routing
- DefinitionMicroservices Architecture
- DefinitionServerless Functions
- DefinitionSOAP API
- DefinitionMonolithic Architecture
- DefinitionService Discovery
- DefinitionSaga Pattern
- DefinitionRemote Procedure Call (RPC)
- DefinitiontRPC
- DefinitionConsumer-Driven Contracts
- DefinitionAPI Mocking
- DefinitionServer-Driven UI
- DefinitionFeature Flags API
- Stack guideWeb Frontends safe & unsafe practices
- Stack guideREST APIs safe & unsafe practices
- Official docsWeb Frontends documentation
- Official docsREST APIs documentation
Deploy this Frontend / Web + REST API Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.