Custom Implementation
Technical Requirements
Section titled “Technical Requirements”For your frontend to fully support Pyxis features (preview, revalidation), it must have a server-side layer (SSR/Edge) to securely store API keys.
Implementation Checklist
Section titled “Implementation Checklist”1. Data Fetching
Section titled “1. Data Fetching”Your engine should query the endpoint:
GET {INTERNAL_API_URL}/api/pages/{slug}
- The
Accept: application/jsonheader is required. - If a
pyxis_previewcookie exists in the browser, its value must be forwarded in theX-Pyxis-Previewheader.
2. Preview Support (The Handshake)
Section titled “2. Preview Support (The Handshake)”You must create an endpoint (e.g., /api/preview) that:
- Receives
path,expires, andsignatureparameters from the URL. - Forwards them to
{INTERNAL_API_URL}/api/preview/verify. - If the response is successful, stores the received
preview_tokenin a secure cookie (httpOnly). - Redirects the user to the address specified in
path.
3. Cache Revalidation
Section titled “3. Cache Revalidation”If your framework uses caching (e.g., ISR/SSG), create a POST /api/revalidate endpoint that:
- Validates the
REVALIDATE_TOKENin the header or body. - Upon successful verification, triggers a cache purge for the provided
path.