Appearance
Quickstart
In about 10 minutes you create the code of a Foliwake site, its blocks and styles, and check it with the same checks the Foliwake server runs. You need nothing from us but public npm packages.
Foliwake itself is not public yet
The Foliwake server, its Docker image and the foliwake command are private for now, so you cannot run a preview or a live site on your own computer without access. This tutorial covers what works for everyone today. With access, continue with run Foliwake yourself.
What you will have
- A Git repository with three blocks (
note,quiz,steps), styles, two sample pages and tests. - A clean report from
@foliwake/site-check: the checks the server runs on every commit of the site's code. - A mistake made on purpose, caught and fixed, so you know what the server would refuse and why.
Before you start
- Node.js 22.22 or newer (
node --version) with npm. - Git, with your name and e-mail set (
git config --global user.name), for the first commit. - A terminal. No account, server or network access beyond npm is needed.
1. Create the site's code
sh
npm create foliwake@latest my-site -- --template examples
cd my-siteIn a terminal it asks a few questions; Enter accepts the defaults. It ends with:
text
Checked with @foliwake/site-check 0.5.0: no problems.
Created my-site (template examples, create-foliwake 0.5.0).
Git: new repository (branch main), first commit 4bef832.What you got:
| Path | What it is |
|---|---|
components/<block>/ | One folder per block: <block>.json lists its fields, .css and .js give it look and behaviour, .example.md shows how authors write it. |
content/ | Sample pages in Markdown. On a real site, content usually comes from Drupal, Google Docs, Drive or Git instead. |
styles/, scripts/ | Site-wide styles and the script that loads the blocks. |
site.yaml | The site's settings for the server. |
tests/ | Quick tests, run with node --test. |
.github/workflows/ | Checks on every push, and branch previews once the repository is connected to a Foliwake server. |
Open components/note/note.example.md to see how an author writes a block in a page:
md
:::note
### Remember
The title is optional: a `###` heading as the first line of the block.
:::2. Check it
sh
npx @foliwake/site-check
node --test "tests/*.test.mjs"text
@foliwake/site-check 0.5.0 — site code in . (HTML contract 2)
13 files would be captured (components/, scripts/, styles/, …, site.yaml): 0 errors, 0 warnings, 0 notes."Captured" files are the ones the server takes from a commit when it releases the site's code.
3. Break a block and let the check catch it
In components/note/note.json, change the type of the text field from "text" to "paragraph" and check again:
sh
npx @foliwake/site-checktext
components/note/note.json:6:23 error BLOCKS_PACK_INVALID note /fields/1/type: Unknown field type "paragraph".
fix: Use one of: text, heading, list, choices, quote, image.
13 files would be captured (…): 1 error, 0 warnings, 0 notes.The server runs exactly this code: a commit with this error never reaches the preview, let alone the live site. Put "text" back (git checkout components/note/note.json) and the check is clean again.
That is the result of this tutorial: a site's code that the server would accept, and the habit of checking it before you push.
Next: write your own block
The SDK docs go on from here: the block tutorial, write a block and the checks. To show Foliwake pages inside a React or Next.js app, read embed pages.
Rendering pages and block examples needs the server. Without access, you can still read how it works: architecture and concepts and preview and publish.
Run Foliwake yourself
With access to the private repository and its image, run the whole platform on your computer. You need Docker with Compose 2.24 or newer, and Node.js, pnpm and Git for the command line.
Install the command line
The foliwake command runs from a checkout of the repository:
bash
git clone https://github.com/foliwake/foliwake.git ~/foliwake
cd ~/foliwake && pnpm install && pnpm build
npm link # makes `foliwake` a command in every terminalTo update: git pull && pnpm install && pnpm build in the checkout. With nvm, npm link belongs to the current Node version: run it again after switching versions. If npm link fails with EACCES, point npm's global folder at your home once (npm config set prefix "$HOME/.local", with ~/.local/bin on your PATH) and link again; do not use sudo. Use npm link, not a shell alias: tools started by npm scripts cannot see aliases.
Start the server and publish a page
sh
docker login ghcr.io -u <your GitHub user> # a token with only the read:packages scope
foliwake docker install # dashboard and sites at http://localhost:8080
foliwake create mytest # Connect to a Foliwake server? → http://localhost:8080
cd mytest
foliwake preview # http://mytest.preview.localhost:8080/
foliwake publish # http://mytest.live.localhost:8080/docker install prints a one-time sign-in link for the dashboard. create signs you in when needed, creates the site on the server and links the folder to it. preview sends the pages of content/ and the code of your last commit, so commit after changing blocks or styles. publish lists the pages it will put live and asks first. Browsers resolve *.localhost to your computer, so no DNS is needed.
The local development server shows your pages as you save them:
sh
foliwake dev --watch # http://127.0.0.1:3000/, block catalog at /_dev/blocksDetails: install with Docker, create a site frontend and develop a frontend.
