API Proxy
Cache CMS APIs at the edge
Send CMS API requests through Cachely, not directly to the origin. Credentials stay server-side, JSON responses are cached at the edge, and asset URLs are rewritten to your domain automatically.
Credentials never reach the browser
API tokens are stored server-side and injected at the edge — not shipped to client code.
Edge-cached responses
Repeated reads return from the edge after the first request.
Asset URLs rewritten automatically
Image and file URLs inside JSON responses are rewritten to your edge domain before they reach the app.
Editorial preview just works
Preview and draft requests can bypass cache so editors always see fresh content.
How it works
How an API request flows through Cachely
- 1Your app sends a
GETrequest toyour-project.cachely.io/~api/... - 2Cachely checks the API cache. On a cache hit, the response returns from the edge.
- 3On a cache miss, Cachely injects the stored API token and fetches the CMS origin.
- 4Asset URLs in the JSON response are rewritten to your edge domain, then the result is cached and returned to your app.
For developers
Integrate in minutes with the Cachely SDK
Drop the SDK into your existing CMS client and route matching requests through your edge domain. Keep credentials off the client and avoid URL rewriting scattered across your codebase.
What You Get
- - Drop in one fetch-compatible adapter — all matching CMS requests are proxied automatically
- - API requests and asset URLs routed through the same edge domain
- - Non-CMS requests pass through untouched — no accidental rewrites
- - Toggle API proxy and asset proxy on or off independently
- - Built-in support for Contentful and Prismic; generic provider for any other CMS
- - Works alongside the asset-only transformer if you need a lighter integration
Install
Add the package once and use the same helper for every supported CMS.
Copy command
npm install @cachely-io/sdkUsage
import { createCachelyFetch } from '@cachely-io/sdk'
import { createClient } from 'contentful'
const cmsFetch = createCachelyFetch({
tenant: 'my-site',
provider: 'contentful',
providerConfig: {
spaceId: 'exampleSpaceId',
},
})
const client = createClient({
space: 'exampleSpaceId',
accessToken: '',
adapter: cmsFetch,
})
const entry = await client.getEntry('homepage')