Appearance
Develop a frontend
You can work on a Foliwake frontend before Drupal, Google Docs or a hosted preview is ready. Start with local sample content. When a preview is available, use its pages with the same local CSS and JavaScript.
The choice is explicit:
| Command | Page content | Frontend code |
|---|---|---|
foliwake dev --watch (in the project folder) | Local content | Your working files |
foliwake dev --remote --watch | Hosted preview | Your working files |
foliwake dev --remote live --watch | Hosted live site | Your working files |
These commands run a development server on your computer. They do not publish content, promote code or change the hosted website.
To start a new frontend, run foliwake create: it sets up the layout, the configuration and the sample content below for you.
Examples below assume foliwake is available in your terminal. If you run the engine from its source checkout, use that checkout's pnpm foliwake command and the appropriate project configuration.
Start with local content
Run the command from your frontend repository. A standalone project can contain:
text
my-frontend/
├── components/
│ └── components.json
├── scripts/
├── styles/
├── content/
│ ├── index.md
│ └── images/
└── foliwake.config.jsonKeep the working frontend files and component descriptor from your site's starter. Add a small content/index.md:
md
---
id: home
path: /
title: Frontend playground
---
# Frontend playground
This is local sample content. Editing it does not change Drupal.Every local command needs a configuration file. For this playground, foliwake.config.json names the code and the content folder, nothing else (a local project: no storage, keys or hosts; see configuration and storage):
json
{
"version": 1,
"sites": [
{
"id": "playground",
"code": { "root": "." },
"sources": [{ "id": "content", "plugin": "local-markdown", "owns": ["/"], "settings": { "root": "./content" } }]
}
]
}Start the server from the project folder. Commands find foliwake.config.json in the current folder by themselves. A file like this one, which names no credentials, needs no trust; one that names storage or keys is used once you have trusted it with foliwake config trust (a project from foliwake create is trusted already; see configuration and storage); --config <file> or FOLIWAKE_CONFIG name another file and take precedence:
bash
foliwake dev --watchOpen http://127.0.0.1:3000/. Change a stylesheet and save it; the browser reloads. Use --port 3001 if another process already uses port 3000.
Local mode does not always mean a folder inside the frontend repository. Foliwake uses the content sources the configuration names. A folder source reads local Markdown; a connector source can use its already-selected local snapshot. Several sources are combined into a copy pinned when dev starts. After syncing a newer connector snapshot, restart dev to use it. See configuration and storage for site configuration.
For a simple folder-based setup, you can explicitly choose a different folder:
bash
foliwake dev --config foliwake.config.json --content ./sample-content --watchThis override is not available for configured sources that require the page identity ledger; configure the folder as a source instead. If an inherited project shows unrelated content, check its local folder and active site configuration. Dev does not infer which Drupal site you intended.
Connect the frontend to hosted content
Create foliwake.remote.json in the frontend repository root, next to components/, scripts/ and styles/. It tells dev where preview and live are. It does not switch on remote mode by itself.
For an example site:
json
{
"version": 2,
"site": "docs-site",
"preview": {
"url": "https://preview.example.com",
"auth": {
"type": "basic",
"username": "owner",
"passwordEnv": "FOLIWAKE_PREVIEW_PASSWORD"
}
},
"live": {
"url": "https://live.example.com",
"auth": {
"type": "basic",
"username": "owner",
"passwordEnv": "FOLIWAKE_LIVE_PASSWORD"
}
}
}Replace the URLs and username for your own site. Use the site origin, without an article path. Remote URLs require HTTPS; HTTP is allowed for local loopback servers. For a site without Basic Auth, omit its auth object. "site" is the site's ID. This is version 2 of the file: version 1 (without site) is no longer read; add "version": 2 and "site". The same file, with an app section, also configures a React or Next app that embeds pages (embed in React or Next). FOLIWAKE_REMOTE=<file> names another file; --remote-config beats it.
Commit this file so everyone on the frontend team has the same endpoints. It contains environment-variable names, not passwords. The remote dev process reads the password from the named variable when it starts; it does not send that password to the browser.
Supply the password
Ask the demo operator for access. In macOS's default zsh terminal, this prompts without displaying the password or placing its value in your command history:
zsh
read -rs 'FOLIWAKE_PREVIEW_PASSWORD?Preview password: '
print
export FOLIWAKE_PREVIEW_PASSWORDFor live, use the separate variable named in the example:
zsh
read -rs 'FOLIWAKE_LIVE_PASSWORD?Live password: '
print
export FOLIWAKE_LIVE_PASSWORDStart dev in that same terminal. These prompts are zsh syntax. In other shells, use their equivalent hidden-input prompt or your team's secret manager. Do not put the password in foliwake.remote.json, a command-line URL or a committed file. The configuration shown here does not promise automatic loading of a .env file.
Work with preview pages
bash
foliwake dev --remote --watchOpen the local address with the article's normal path, for example:
text
http://127.0.0.1:3000/articles/give-your-oatmeal-the-ultimate-makeoverThe local server fetches the page HTML and content images from preview.example.com. It uses your local components/, scripts/ and styles/ for the frontend. You can change the header, footer, layout or component styling without deploying those changes.
text
Hosted preview ── page HTML + content images ──┐
├── Local dev server ── Browser
Frontend repo ── local CSS + JavaScript ────────┘There is no direct browser request to Drupal or Google Docs in this flow. Those sources must first be synced and prepared as Foliwake preview content. A Drupal save alone does not update the hosted preview.
--watch watches your local frontend files, not the remote CMS. After someone updates the hosted preview, refresh the local page to fetch it again. A local code change also triggers a reload and a fresh page request.
Work with live content
bash
foliwake dev --remote live --watchThis uses the live endpoint in the same configuration file. It is useful for checking a frontend fix against content that visitors currently see.
You are still viewing live content with local frontend code. To see the actual deployed frontend too, open the live URL directly—in this example, https://live.example.com.
Preview and live are separate choices. An unavailable preview never causes dev to fall back silently to live or to local sample content.
See every block
/_dev/blocks lists the site's blocks with their examples (components/<name>/<name>.example.md), rendered with your CSS and JavaScript, their HTML and their problems; /_foliwake/blocks shows the catalog authors see on preview. Both work in local and remote mode. See Block examples, catalog and Storybook.
What automatic reload does
With --watch, saving local frontend files reloads open development pages. In local folder mode, content edits also trigger reloads. Without --watch, refresh the browser yourself.
Detected frontend validation and JavaScript syntax errors appear in the browser with their file location. Fix the file and save; the overlay clears and the page reloads. JavaScript runtime errors still belong in the browser's developer console, and CSS is not validated by this feature.
If filesystem events are unreliable, use --watch-polling. Stop dev with Ctrl+C. Remote content is never polled by the watcher.
When something does not work
| What you see | What to check |
|---|---|
| Unexpected local pages | Plain dev uses local content. Check the folder and active site configuration, or choose --remote explicitly. |
| Remote configuration missing | Run from the frontend repository containing foliwake.remote.json, or use --remote --remote-config /path/to/file.json. |
| Password variable missing | Export the exact variable named by passwordEnv in the terminal that starts dev. Restart dev after changing it. |
| Access refused | Check the Basic Auth username and password with the site operator. |
| Remote page not found | Check the same path on the chosen hosted preview or live site. Local dev cannot create a remote page that has not reached that destination. |
| Drupal edits are absent | Update Foliwake preview first, then refresh the local page. In live mode, the content must also be published. |
| Port already in use | Add --port 3001, or stop your previous dev process. |
When the frontend is ready
Local development ends with a reviewed change in the frontend repository. Push a branch to see it in a branch preview. After the merge into main, every page is rebuilt with the new code in the site's preview; someone with the right role reviews it and releases it. See roll out frontend code.
A frontend code release and a content publication are different actions. Running dev performs neither.
