RealComposer
Platform

Next.js / React Edge API Recipes

Production-ready templates for calling third-party APIs from Next.js / Reactwithout exposing secrets or maintaining a custom backend.

Next.js safe & unsafe practices
Security & Secret Vault

Call firebase admin api from nextjs without exposing service account

Store service account JSON in Vault; Next.js routes call RealComposer instead of Firebase Admin SDK in serverless bundles. For "call firebase admin api from nextjs without exposing service account", store FIREBASE_ACCESS_TOKEN in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/call-firebase-admin-from-nextjs-securely with an rc_live_ client token.

Sub-10ms edgeView Recipe
Security & Secret Vault

Hide contentful preview token in nextjs app

Edge injects preview token; ISR pages fetch composed CMS JSON safely. For "hide contentful preview token in nextjs app", store CONTENTFUL_PREVIEW_TOKEN in Secret Vault, call https://preview.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/hide-contentful-preview-token-nextjs with an rc_live_ client token.

Sub-10ms edgeView Recipe
Security & Secret Vault

Hide anthropic api key in nextjs chat interface

Next.js client chat UI calls edge stream; Anthropic never touches browser. For "hide anthropic api key in nextjs chat interface", store ANTHROPIC_API_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/hide-anthropic-api-key-nextjs with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe

Stitch contentful entries with shopify products api

Contentful marketing fields plus Shopify SKU inventory in parallel. For "stitch contentful entries with shopify products api", store CONTENTFUL_ACCESS_TOKEN, SHOPIFY_ACCESS_TOKEN in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/stitch-contentful-with-shopify-products with an rc_live_ client token.

Sub-10ms edgeView Recipe

Merge cloudinary assets with contentful entries

Resolve Contentful asset references with Cloudinary transformation metadata. For "merge cloudinary assets with contentful entries", store CLOUDINARY_BASIC_AUTH, CONTENTFUL_ACCESS_TOKEN in Secret Vault, call https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/merge-cloudinary-with-contentful-entries with an rc_live_ client token.

Sub-10ms edgeView Recipe

Aggregate contentful content with algolia search

Algolia search results enriched with Contentful entry fields at edge. For "aggregate contentful content with algolia search", store CONTENTFUL_ACCESS_TOKEN, ALGOLIA_API_KEY in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/aggregate-contentful-with-algolia-search with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe

Combine anthropic with supabase vector rag search

Anthropic completion plus Supabase vector match results composed at edge. For "combine anthropic with supabase vector rag search", store ANTHROPIC_API_KEY, SUPABASE_SERVICE_ROLE_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/combine-anthropic-supabase-vector-rag with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe

Anthropic messages api response slim for chat ui

Map content blocks and stop reason; drop billing debug fields. For "anthropic messages api response slim for chat ui", store ANTHROPIC_API_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/slim-anthropic-messages-response-chat with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe
Edge Caching & Rate Limits

Cache contentful delivery api at edge avoid limits

300s TTL on composed entry responses at Cloudflare edge. For "cache contentful delivery api at edge avoid limits", store CONTENTFUL_ACCESS_TOKEN in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/cache-contentful-delivery-api-edge with an rc_live_ client token. Enable 300s GET cache only when query params identify the resource.

Sub-10ms edgeView Recipe
Edge Caching & Rate Limits

Contentful and algolia search cache edge

Cache composed search hits for popular queries. For "contentful and algolia search cache edge", store CONTENTFUL_ACCESS_TOKEN, ALGOLIA_API_KEY in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/contentful-algolia-search-cache-edge with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe