Skip to content

Start a site's code ​

A Foliwake site keeps its frontend code in a Git repository: blocks, styles and a small loader. create-foliwake writes one for you, checked with the platform's own rules before anything is written.

Create the repository ​

sh
npm create foliwake@latest my-site
cd my-site

pnpm create foliwake my-site, yarn create foliwake my-site and bun create foliwake my-site work too. In a terminal it asks for what you left open. Useful options:

OptionWhat
--template minimalone page, one block (note); the default
--template examplestwo pages, three blocks, one with JavaScript (quiz)
--reactReact vendored in scripts/vendor/, and a React example block (poll)
--storybookStorybook for the blocks (needs the Foliwake CLI to render them)
--no-gitno Git repository and no first commit

Everything comes with the package: no network, except installing Storybook's packages when you ask for it. The create-foliwake reference has every option and exit status.

What you get ​

text
components/<name>/     one folder per block: <name>.json, <name>.css, optionally <name>.js and <name>.example.md
scripts/components.js  the loader: loads each block's CSS and JS on the pages that use it
styles/styles.css      styles of every page
site.yaml              site settings (authoring dialect)
content/               local sample pages (not published from this repository)
tests/                 quick checks of the vendored scripts and workflows
.github/               checks, branch previews and production workflows (inert until connected)

There is no build step. The files in components/, scripts/ and styles/ are what the browser loads.

Check it ​

sh
npx @foliwake/site-check
node --test "tests/*.test.mjs"

@foliwake/site-check is the code the platform runs first on every commit. A clean result here means the platform will not refuse your code for the same reasons. See Check a site's code for the CLI, exit codes and CI use.

What needs the platform ​

The SDK does not render pages or block examples. Only the platform does.

Want toWithout the Foliwake CLIWith it (not public yet)
See a page with your blockspush a branch, open its branch previewfoliwake dev --watch
See every block's examplesthe block catalog on the preview/_dev/blocks locally
Check pages and examplesthe platform does it on every commitfoliwake page check
Get types of each block's own fieldsnot available yetfoliwake dev writes them
Storybooknot available yetnpm run stories

Connect it to your site ​

  1. Push the repository to GitHub.
  2. In the Foliwake admin, connect it to your site. You get the site id and two deployment keys.
  3. Set the GitHub environments, variables and branch protection that the project's README.md lists.

Then:

  • a pushed branch gets a branch preview with that branch's code;
  • a merge into main becomes a code release, and every page is rebuilt with it in the preview;
  • the release reaches live automatically when every page builds, or by Release in the admin.

Next: build two blocks hands-on in the tutorial, or read Write a block.

Apache-2.0