Skip to content

How Foliwake works: from Drupal to a visitor’s browser ​

Foliwake is a publishing and delivery layer. Drupal can remain the place where editors manage content, translations and media. Foliwake reads that content, prepares a website using a separate frontend, and publishes versioned results to S3-compatible storage. Its delivery service serves those results through a cache or CDN.

Drupal is the example in this guide, not the only intended source. The same separation applies to Git Markdown, Google Docs and Markdown in a Google Drive folder. Future connectors, such as Notion, are not implemented. A multi-source site assigns each page to one owning source.

The important separation is between preparing a publication and serving a visitor. A visitor request does not call Drupal, read a Markdown file, or run a frontend build. It reads a selected publication.

This guide is for developers evaluating that architecture. The publishing flow and the Drupal connector described here are available. The shared document model mentioned below is planned work. The Drupal editor workflow uses an integration service and module to add author controls around the same publishing system described here.

“We already put React in front of Drupal. What is different?” ​

Drupal manages the content. Foliwake manages what becomes the website—and delivers the published result independently of Drupal.

Separating Drupal from the frontend is not new. A React application reading JSON:API already does that. Foliwake adds a publication boundary: content and frontend code become a recorded, reviewable release before visitors receive it.

For a client-rendered SPA that fetches article data at runtime, the flow looks like this:

text
Visitor opens the site
  → browser loads the React application
  → application fetches article data from Drupal JSON:API (or its cache)
  → application constructs the article in the browser

With Foliwake, the work is split into two paths:

text
Publication:
  Drupal → read and validate → render content and prepare images
         → preview → explicitly publish a content/code release

Visitor request:
  browser → cache → delivery service → stored release
  browser receives HTML; CSS styles it and JavaScript adds interaction

The HTML body is prepared before publication. The delivery service adds its document shell when serving it. Reading that published article does not require another Drupal API request.

QuestionBrowser-rendered SPA fetching Drupal at runtimeFoliwake
When does article data become HTML?When the application renders it in the browserBefore publication; the delivery service adds the shell
What content does a visitor see?What the application's API, access and caching rules exposeThe explicitly selected live release, subject to cache freshness
Does an article visit depend on Drupal?On an API cache miss, usually yesNo, for stored article content and copied media
How is editorial approval tied to delivery?The application needs an appropriate preview/publication workflowPublication can require the exact preview version reviewed
How do content and frontend roll back together?Requires a coordinated versioning mechanismA retained site release identifies the content/code pair

This compares two delivery designs, not the capabilities of React itself. React frameworks also support server rendering and static generation. A Drupal + React site can pre-render pages, retain releases and implement coordinated rollback. If your team already does that, the difference narrows: evaluate Foliwake's packaged publication workflow, source connectors and operational fit rather than assuming a unique rendering capability. See React’s rendering options.

A concrete editorial example ​

At 10:00, an editor reviews and publishes “Plant watering”. Once cache refresh completes, visitors receive that approved version.

At 10:05, someone edits the article in Drupal. Foliwake's live release stays unchanged. The team can sync and prepare another preview without making it public.

At 10:10, Drupal becomes unavailable. The published article and its copied images can still be served from Foliwake's storage and delivery infrastructure. New syncs cannot succeed until Drupal returns. This assumes the delivery service, storage and required frontend assets remain available; dynamic features still calling Drupal, such as a separate search or form, may fail.

If the team rolls back the website, Foliwake selects an earlier retained content/code pair and refreshes the cache. It does not delete the editor's new Drupal work or rewind Drupal revisions.

Show the difference in a demo ​

Use an isolated test site to demonstrate this sequence: publish an article, edit it in Drupal without changing live, prepare and inspect its preview, then publish only that article. Finally, make the demo Drupal source unavailable and request an uncached published page through Foliwake. This checks source independence beyond merely showing a cached response. Restore the source and demonstrate rollback.

That is a suggested acceptance demonstration, not a claim that a public Drupal/R2 deployment has already passed it. The existing GitHub publication and local Varnish demo is separate evidence.

Foliwake does not automatically import an existing React SPA or Drupal theme. Adopting it means mapping supported content and providing a compatible frontend. An application built around live personalised API data may be better kept as an application, or integrated as a separate feature of the published site.

For the product questions—“Drupal already publishes pages”, “why not React?”, and “why not just a CDN?”—see the FAQ. Drupal already provides editorial moderation; the distinction discussed here is the retained, independently delivered website release.

What stays in Drupal? ​

Drupal remains the authoring system. Editors create articles, translate them, choose images and use Drupal’s existing permissions and editorial workflow. Foliwake does not move the Drupal database into a bucket or run Drupal modules at the edge.

The frontend becomes a separate project. Developers own its HTML component contract, CSS and JavaScript, with frontend files kept in Git. Drupal’s Twig theme is not automatically exported. A Drupal module, View, Paragraphs bundle or custom field needs an explicit mapping if its behaviour is to appear on the Foliwake site.

ResponsibilityWhere it belongs
Editing articles, Drupal revisions and editorial permissionsDrupal
Reading supported entities and translating their fieldsThe Drupal connector
Validating content, preparing images, creating releasesFoliwake’s publishing engine
Styling and interactive enhancementThe frontend project in Git
Keeping published HTML, images and frontend versionsS3-compatible storage
Resolving a public URL to the selected publicationFoliwake’s delivery service
Reusing responses close to visitorsVarnish or a configured CDN

Drupal forms, search, comments, user sessions and personalised pages do not become static features automatically. They need a separate integration or remain served by Drupal. This architecture fits content delivery; it is not a transparent replacement for every Drupal route.

Preview and publish at a glance ​

Six steps with two edited articles: edit A and B; sync and preview show both; review and select only A; publish A, the version you reviewed, refused if anything changed since; the new live version holds A's new text, B unchanged and the same code; A is cleared from the cache and visitors see it.Six steps with two edited articles: edit A and B; sync and preview show both; review and select only A; publish A, the version you reviewed, refused if anything changed since; the new live version holds A's new text, B unchanged and the same code; A is cleared from the cache and visitors see it.

For commands and the failure/recovery diagram, see preview and publish.

Follow one article ​

Imagine an article called “Plant watering”, published at /articles/plant-watering.

Content sources (local Markdown, Git on GitHub or GitLab, Google Drive Markdown, Google Docs, Drupal; several per site) and the site's blocks, styles and templates in Git go into the Foliwake server. It syncs, prepares a preview, publishes the pages you select and releases new code into your S3 or R2 bucket: published versions of the site and code, and pictures. The delivery service, in Docker or as a Cloudflare Worker, reads only that bucket. A CDN or cache (Cloudflare, Varnish or your CDN), cleared for the changed pages after each publication, serves browsers and your app, which shows the pages inside its own interface.Content sources (local Markdown, Git on GitHub or GitLab, Google Drive Markdown, Google Docs, Drupal; several per site) and the site's blocks, styles and templates in Git go into the Foliwake server. It syncs, prepares a preview, publishes the pages you select and releases new code into your S3 or R2 bucket: published versions of the site and code, and pictures. The delivery service, in Docker or as a Cloudflare Worker, reads only that bucket. A CDN or cache (Cloudflare, Varnish or your CDN), cleared for the changed pages after each publication, serves browsers and your app, which shows the pages inside its own interface.

1. Sync reads a source version ​

The connector lists supported articles, reads their fields and resolves referenced media. It supplies content to the engine through the plugin API. The engine validates the result and records a source snapshot that later operations can refer to.

A source snapshot is an input to publishing, not a live website. Selecting a new snapshot does not change the public site.

In the Drupal connector, page identity combines the node UUID and language. The public path comes from the alias and configured language prefix. Identity and URL are separate: renaming an alias should not create an unrelated article identity.

Related entities matter too. Changing an image or its alt text can change the article’s output even when the node’s own changed value does not. The connector tracks these dependencies and downloads images on every sync. It checks media and file records around the download to detect changes during reading. This is not a claim of a database-wide Drupal transaction or perfect consistency across every article in a sync.

2. Preview prepares a reviewable publication ​

The engine renders content into semantic HTML and creates image variants. Components already have meaningful HTML before their browser JavaScript runs. CSS changes presentation; JavaScript adds interaction.

Today, source plugins supply Foliwake Markdown. The Drupal connector converts its supported HTML into that format. The planned document model would let Drupal HTML and Markdown map into the same validated tree without the intermediate Markdown serialization. That model is not implemented yet.

Preview has its own stored content and its own reference. The main preview address serves the content/code pair saved in that preview. Separate branch-preview addresses let developers try another frontend code release against preview content.

Preview responses use Cache-Control: no-store, private. This controls caching; it does not itself authenticate users. Operators must configure access protection for a preview exposed publicly.

3. Publish selects what becomes live ​

The editor chooses pages to publish. Foliwake builds a new content release by combining those selected changes with the existing live entries for other pages. Unselected edits remain outside live.

Publication can be tied to the preview release the author reviewed. If the expected version is no longer valid, the operation refuses rather than substituting a newer, unseen version. The dashboard requires that protection; CLI users should use the --expect value printed by preview.

A Drupal node becoming “published” makes it eligible for discovery; it does not by itself publish it to Foliwake’s live site. Publication happens in Foliwake's dashboard or CLI, or from Drupal through the Drupal editor integration, which keeps the same reviewed-version check.

What actually lives in S3? ​

Think of the bucket as a collection of immutable files plus a few small mutable pointers. It is not a folder of /articles/plant-watering/index.html files.

These are representative object keys within one site’s storage. IDs and hashes are shortened for readability; the list omits branch-preview and provenance records.

text
refs/
  live.json
  preview.json

site-releases/
  sr_abc.json
content-releases/
  cr_def.json
code-releases/
  cd_ghi.json

blobs/sha256/
  <body-hash>
media/
  <image-variant-hash>.jpg
code/cd_ghi/
  shell.json
  components/components.json
  styles/styles.css
  scripts/components.js
  components/hero/hero.css

preview/
  site-releases/sr_draft.json
  content-releases/cr_draft.json
  blobs/sha256/<preview-body-hash>
  media/<preview-image-hash>.jpg

S3 “folders” are key prefixes. The relationships come from JSON records, not filesystem links.

Stored objectWhat it means
refs/live.jsonThe small pointer selecting the current live site release
site-releases/sr_….jsonA publication record pairing one content release with one code release; also records its parent and operation
content-releases/cr_….jsonA map from public URL paths to page entries
blobs/sha256/…The rendered HTML body of a page, addressed by its bytes’ hash
media/<hash>.<ext>A generated image variant; changed bytes produce a different key
code-releases/cd_….jsonA manifest describing a frontend release, its shell, component descriptor and files
code/cd_…/…The actual versioned frontend files and shell description
preview/…Preview content and publication records, separated from live; code releases are shared

The ss_… IDs seen during sync identify source snapshots. They are different from the sr_… site releases that the delivery service follows. Source snapshots and publication workflow state belong to the engine’s local state, not to the public page URL.

How the records point to each other ​

For our article, the lookup is:

text
refs/live.json
  site_release: sr_abc
           │
           ▼
site-releases/sr_abc.json
  content_release: cr_def ──► content-releases/cr_def.json
  code_release: cd_ghi         entries["/articles/plant-watering"]
           │                    body: sha256:<body-hash>
           │                    metadata: title, components, language…
           │                    media: ["media/<hash>.jpg", …]
           │                              │
           │                              ▼
           │                    blobs/sha256/<body-hash>
           ▼
code-releases/cd_ghi.json
  shell: shell.json
  component_assets: components/components.json
  files: paths and their hashes
           │
           ▼
code/cd_ghi/shell.json + frontend files

A content entry also records a digest of its source inputs. That helps identify the exact inputs used to prepare it; it is not the path used to fetch its HTML.

The body blob contains the rendered content, not the whole HTML document. The code release’s shell.json is a description of the surrounding page: language fallback, metadata fields, stylesheets and module scripts. The delivery service combines them into the final response.

Content and code manifests use content-derived IDs, so identical records can be reused. Site-release IDs identify publication events and are opaque IDs. They should not all be described as Git commits or content hashes.

How a request becomes a page ​

Suppose a visitor requests https://example.org/articles/plant-watering.

  1. The CDN checks its cache. A usable cached response can be returned without contacting the delivery service or S3.
  2. On a miss, the request reaches Foliwake. The configured host selects the site and whether this is live or preview.
  3. The delivery service reads refs/live.json. For a live page request reaching the delivery service, it reads the current pointer rather than keeping a stale in-memory copy of that pointer.
  4. It follows the site release to the content and code releases. The content release’s path map provides the article entry. A path absent from that release returns 404.
  5. It loads the body and shell. The body is fetched by hash and checked against that hash. Immutable records and bodies can be cached inside the delivery service, so this is a logical lookup sequence, not a fixed number of S3 requests on every visit.
  6. It assembles the response. The delivery service adds the document shell, title, description, language and versioned frontend links around the already-rendered body. It does not parse Drupal HTML or Markdown at this point.
  7. The browser fetches assets. Styles and scripts use URLs such as /code/cd_ghi/styles/styles.css; images use /media/<hash>.jpg. The shell already links the stylesheets of the components on the page, so they apply at first paint. The component loader then adds the component JavaScript and enhancements.

Asset routes are not an unrestricted proxy to arbitrary bucket keys. The delivery service checks whether requested code and media are eligible through committed release history. Uploaded but uncommitted files do not automatically become publicly reachable through it. This is also why a private bucket behind the delivery service is the intended deployment shape.

A missing file required by a selected release is a delivery failure. The delivery service should not silently borrow a body or code file from another publication to make the request appear successful.

Why publishing is a pointer change ​

Foliwake uploads the new immutable objects before selecting them. The final selection updates refs/live.json using a conditional write: “replace the pointer only if it still has the version I read.” Concurrent publication cannot simply overwrite that pointer without noticing another writer.

This makes the selected release a coherent content/code pair. It does not mean every visitor worldwide sees the new page at the exact same instant. A CDN may still hold an earlier response, and a browser may already have an earlier page open.

If preparation fails before the pointer changes, the current live selection remains. Some uploaded objects may be left unreferenced; that alone does not make them live. Local workflow records allow interrupted operations to be examined and recovered.

How cache refresh fits in ​

Stable page URLs need cache invalidation when their published response changes. Versioned image and code URLs usually do not: new bytes use new URLs, while older releases keep their existing asset URLs.

A selected-page publication queues invalidation for the affected paths. A code release can affect every page and requires a wider HTML invalidation. The current engine has immediate and delayed final invalidation phases to account for requests already in flight.

The live reference can be committed even if the cache service is unavailable. In that case, publication has happened, but visitors through the cache may still see the old response. Foliwake reports cache refresh as pending and retains retry work in its local state. foliwake operation recover --wait retries pending work with a bounded wait.

Local Varnish delivery has been exercised in the project demo: a changed page was invalidated while an unrelated page stayed cached; a failed purge left the old cached response visible; recovery then exposed the new response. This establishes that local flow. A Cloudflare purge adapter (purge by tag, for the Worker delivery service's edge cache) is available in the code; verify it on your own deployment. Fastly and other provider adapters do not exist yet.

Do not treat changing cache configuration as permission to discard workflow state. See current limitations.

Cache work survives configuration changes and state recovery ​

Foliwake records the cache/no-cache decision before the live pointer changes. Recovery uses that saved decision. A publication explicitly made without a cache queues no refresh; a required refresh remains pending if the cache is temporarily removed.

If the state database is lost or restored from an older backup, that evidence may be missing. Recovery conservatively retains an all-HTML refresh for unexplained committed history, even when no cache is configured now. Both phases wait for a configured cache; repeated recovery does not duplicate the work. This differs from an ordinary publication with an intact, explicit no-cache record.

See the state recovery diagram and operator steps. There is currently no command to retire retained jobs explicitly.

What rollback restores ​

A full rollback creates a new publication selecting the earlier content/code pair and then refreshes affected caches. It does not rewind Drupal, delete later Drupal revisions, or edit the frontend Git repository.

Code-only rollback changes the frontend selection while retaining current content. Cached pages and already-open tabs can continue requesting older versioned assets, so retention is important. Do not delete old objects just because the current reference does not point directly to them; historical releases may still need them.

Backups must cover both the bucket and the engine’s local state, as well as the authoring sources and frontend repository. The bucket holds deliverable releases. Local state holds source identities, snapshots, operation history and pending work. One is not a complete substitute for the other.

What a Drupal pilot needs ​

The connector is deliberately narrow: published article nodes in the configured languages, article images and a generated article list per language. It does not export Drupal’s full rendered website.

Before adapting it to another Drupal installation, agree on:

  • Entity mapping: which bundles and fields become pages and component fields; which UUID/language pairs identify them.
  • Paths and links: how aliases and language prefixes map to public URLs; how unsupported destinations are reported.
  • Media: which media bundles and file types are allowed, how alt text is preserved, and what changes trigger a reread.
  • HTML support: which rich-text constructs are supported. The current connector fails unsupported content rather than quietly dropping it.
  • Listing behaviour: the connector generates a list; it does not execute arbitrary Views. Publish a changed list and its newly linked articles together when needed. Dependencies are not silently added to the selection.
  • Navigation: pilot navigation belongs to the frontend project; Drupal menu synchronization is future work.
  • Publication ownership: editors can use Foliwake's dashboard, or publish from Drupal with the editor integration, which uses a protected API and the same reviewed-version check.

Disappearance from the source is not an instruction to remove a live page. Unpublish is explicit. This avoids accidental deletion after an incomplete sync, but it also means moderation and takedown procedures must include the delivery site.

Start by reproducing one useful journey: article list → article → images → language navigation → edit in Drupal → sync → preview → publish → cached response → rollback. Measure editing effort, output quality, request volume and delivery behaviour on that pilot before promising lower cost or higher performance.

Where to go deeper ​

For operating instructions, continue with preview and publish and configuration and storage. For the site's code and apps that embed pages, read Concepts on the SDK docs site.