RealComposer

Aggregate contentful content with algolia search

Headless site search with CMS hits

Direct Answer & Architecture Summary

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.

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

Waterfall latency from multiple Contentful and Algolia requests

Next.js / React widgets often await Contentful and Algolia sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.

Critical Security & Operational Risks:
  • Race conditions between parallel manual fetches
  • Higher mobile data usage from redundant JSON
  • Timeouts when any upstream exceeds cellular RTT
Architecture & Step-by-Step Implementation

How RealComposer Solves This at the Edge

1

Store upstream credentials in Secret Vault

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

2

Configure upstream steps and output mapping

Point step contentful at https://cdn.contentful.com/spaces/{{query.spaceId}}/entries with POST. Add output mapping fields that mirror the JSON contract your screen already expects. POST pipelines set cache TTL to 0 because RealComposer only stores GET responses at the edge.

3

Call from Next.js / React

Allowed origins on the token should list every Next.js / React host that calls this URL.

                    // app/api route or client component
const res = await fetch('https://realcomposer.com/v1/workspace/aggregate-contentful-with-algolia-search', {
  cache: 'no-store',
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
                  
Payload Slimming Comparison
56% Bandwidth Reduction
Raw Upstream Response259 B
              {
  "requestId": "req_aggregat",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "aggregate-contentful-with-algolia-search"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
            
RealComposer Slimmed Edge Payload115 B
              {
  "contentful_entryId": "sample",
  "contentful_title": "sample",
  "algolia_hitCount": "sample",
  "algolia_firstHit": "sample"
}
            

Recipe Specs

HTTP method
POST
Upstream calls
2
Edge cache TTL
No caching
Client auth
Restricted client token
Mapped output fields
4
Payload
259 B to 115 B (-56%)
Call from Terminal or Client
curl -X POST "https://realcomposer.com/v1/workspace/aggregate-contentful-with-algolia-search" \
  -H "Authorization: Bearer rc_live_client_token" \
  -H "Content-Type: application/json" \
  -d '{"model":"example"}'
Frequently Asked Questions

Developer Questions & Troubleshooting

Is it safe to log Contentful responses in Next.js / React?

Use scoped tokens where the vendor allows them on aggregate-contentful-with-algolia-search. Admin keys stay {{secrets.*}} references only.

When does edge caching apply to this recipe?

aggregate-contentful-with-algolia-search keeps cache TTL at 0 because it uses POST upstream calls or per-user responses. Add ids to query strings before enabling GET cache.

Can I restrict which domains call this pipeline?

Allowed origins on the aggregate-contentful-with-algolia-search client token restrict which domains may call the edge URL.

Sources & Definitions Used in This Answer

Instant Deployment

Deploy this Next.js / React + Contentful, Algolia 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