Headless and decoupled front ends
This page is for developers who want Exponential's content model, editing and permissions behind a front end built with another framework: a JavaScript application, a static site generator, a mobile app, or a site written in Laravel, Django or Rails. Exponential is not headless-only: it has its own templates, so you choose how much of the front end to replace (Headless Exponential).
Contents
- What you keep and what you replace
- Reading content
- Rich text, images and links
- Preview
- Caching and purging
- Hybrid first
What you keep and what you replace
| Kept in Exponential | Replaced by your front end |
|---|---|
| content classes, editing, versions, translations, workflows | page templates, menus, the pagelayout |
| roles and policies, checked on every API call | routing, URL handling |
| the administration and the layouts editor for editors | rendering of layouts |
| search, media storage, image aliases | client-side state and caching |
Reading content
curl -s -H "Authorization: Bearer $EXP_API_KEY" \
"https://example.com/api/ezp/v2/content/node/<node id>/list/offset/0/limit/20?ResponseGroups=Metadata,Fields"The REST API requires a user by default (rest.ini [Authentication] RequireAuthentication). For a public front end, use
a read-only integration user with a role limited to what the site shows, and keep its key on your server, never in
browser code (REST and JSON APIs).
Rich text, images and links
OutputFormat=xhtmlreturns rendered XHTML of rich text fields, so the front end does not parse the internal XML.- Image fields carry the original and the aliases; define aliases for your front end's sizes in
image.ini(Images and image variations). - Links inside rich text point to site addresses; map them to your front end's routes by URL alias or node ID.
Preview
Editors preview in the administration with the site's templates. A headless front end needs its own preview: read the draft version through an authenticated, editor-level call and render it in a protected preview route. Plan it early.
Caching and purging
- The REST framework has an answer cache configured in
rest.ini. - Cache in your front end or CDN; purge on publish with a workflow event or a
content/cachelistener that calls your front end's purge or revalidation hook (Events and listeners). - Fetch lists in pages with limits.
Hybrid first
Many projects keep the public site in Exponential's templates and add an app or a JavaScript widget on the API. That keeps preview, layouts, SEO and URL aliases simple and gives the app the same content. Go fully headless when the front end really must live elsewhere. If the goal is a Symfony front end with Twig on the same content, look at the legacy bridge instead of the REST API (Mixing Exponential and a framework).
Related pages
- Headless Exponential
- OAuth and API keys
- REST API v1 and v2
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.