Skip to content

Create a site frontend ​

foliwake create makes a new frontend project, ready for foliwake dev and for a code release: one example block (or three), local sample pages, site styles, the component loader, quick tests, and GitHub workflows for checks, branch previews and production. It works like npm create vite: it asks only for what you did not give as flags, and only in a terminal.

bash
foliwake create my-site
text
┌  Create a Foliwake site
│
◇  Template
│  minimal
│
◇  Site id on your Foliwake server (optional; Enter to skip)
│  skip
│
◇  Add React support? (React vendored in scripts/vendor/, no npm install, and a React example block)
│  No
│
◇  Add Storybook for your blocks? (npm packages, installed by you later)
│  No
│
◇  Create a Git repository and the first commit?
│  Yes

Created my-site (template minimal, Foliwake 0.0.0).
Git: new repository (branch main), first commit 3f9c2a1.

Next:
  cd my-site
  foliwake dev --watch
  open http://127.0.0.1:3000/   (blocks and their examples: /_dev/blocks)

◇  Connect to a Foliwake server?
│  http://localhost:8080
│
◇  Site on http://localhost:8080
│  Create a new site "my-site"

Creating site my-site on http://localhost:8080…
Created site my-site in organisation default on http://localhost:8080.

The last question lists each server this computer is signed in to (with the account's e-mail and the one used last), servers you signed out of and Foliwake Cloud (marked "sign in"), "Another server…" (an address; http://localhost:8080 is offered when you know no server yet) and "Not now". A server you are not signed in to is signed in to at once, as foliwake login does it (the browser opens with the code). Then: "Create a new site" (only for an organisation admin), "Link an existing site" or "Not now". "Not now", Ctrl+C in the sign-in or a failed sign-in keep the project and print how to connect it later.

The template comes with the engine: its version is the engine's version, and it is checked with the same rules as code prepare and page check before anything is written.

Questions and flags ​

QuestionFlagDefault without a terminal
Project folderthe argument (. for the current folder)foliwake-site
The folder is not empty--overwrite (remove its files) or --keep-existing (add next to them)refused
Template--template minimal or --template examplesminimal
Site id on your Foliwake server--site <id> (--site "": none)none
React support--react / --no-reactno
Storybook for the blocks--storybook / --no-storybookno
Git repository and first commit--git / --no-gityes
Connect to a Foliwake server--server <origin> (or cloud; also FOLIWAKE_SERVER) skips the server question; --no-connect skips it allnot asked
Create a new site / Link an existing site--create-site (id: --site, else the folder name) or --link-site <id>nothing; with one of them: the server of --server, FOLIWAKE_SERVER, else the only one you are signed in to (several: refused, name one)
Replace the folder's link to another server or site--relinkrefused

--no-interactive never asks, even in a terminal; --interactive asks even when no terminal is detected. Ctrl+C or Escape in a question cancels the run: nothing is written (exit status 130).

  • .git is never touched. A folder that holds only .git counts as empty; --overwrite removes everything else.
  • Inside an existing Git repository (for example a monorepo) no repository is created and nothing is committed; review and commit the new files there.
  • The first commit uses your Git identity (user.name and user.email from your Git configuration). If none is configured, the project is still created; the command says so and exits 1.
  • The templates: minimal has one page and the block note; examples adds the blocks steps (CSS only) and quiz (JavaScript with block-kit: it emits the answer and complete events of the blocks contract's assessment extension) and a second page.
  • React support adds React without npm and without a build step: scripts/vendor/react.js, React and ReactDOM in one ES module (production build of the exact versions this Foliwake release was built with, about 220 KB minified, 68 KB gzipped, loaded only on pages with a React block), its MIT license in the file's header comment (kept in code releases) and as scripts/vendor/react.LICENSE.txt, the example block poll, rendered with block-kit's ctx.mount, and scripts/react-view.js, the React view ctx.mount takes. create copies the files from the engine; nothing is downloaded. foliwake blocks new <name> --react then writes blocks that use it. React in blocks explains it.

What you get ​

text
my-site/
├── .github/
│   ├── actions/foliwake-request/action.yml
│   ├── scripts/foliwake-report.py
│   └── workflows/  frontend-checks.yml, branch-preview.yml, production.yml
├── components/note/  note.json (fields), note.css, note.example.md (examples)
├── content/index.md      local sample page (the welcome page; its logo in content/images/)
├── scripts/components.js the component loader (calls each block's init(root, host))
├── styles/styles.css
├── tests/                site.test.mjs, workflows.test.mjs
├── site.yaml             authoring: blocks-v3
├── foliwake.config.json  local configuration (found by commands run in this folder)
├── package.json          scripts: dev, check, test (no dependencies)
├── README.md
└── .gitignore

With React the project also has components/poll/ and scripts/vendor/ (above). With Storybook the project also has .storybook/, a pnpm-workspace.yaml that lets pnpm run esbuild's install script, and the npm scripts stories and build-stories with Storybook as development dependencies; run npm install && npm run stories (Block examples and Storybook). create never runs npm.

There is no build step. Content stays local in this version: content/ holds sample pages to develop against; the site's real content lives in its content source on the server.

Then ​

  • Write a block on the SDK docs site: fields, styles, block-kit and React.
  • Develop a frontend: dev, automatic reload, remote preview content.
  • Frontend components: how blocks, fields and the loader work.
  • Block examples, catalog and Storybook: /_dev/blocks, the authors' catalog on preview, foliwake blocks render.
  • Connected folders: .foliwake/connection.json binds the folder to its server and site (Foliwake Cloud is stored as "server": "cloud", so it survives a move of the cloud to another domain); preview and publish use it. foliwake site unlink removes it (nothing changes on the server).
  • Connect to GitHub: see branch previews and roll out frontend code. The project's README lists the GitHub environments, secrets and variables. The workflows stay inert until FOLIWAKE_SITE_ID and BRANCH_PREVIEWS_ENABLED / FRONTEND_PRODUCTION_DEPLOY_ENABLED are set. Then a branch push updates its branch preview, and a merge into main prepares the site's preview; you release it in the admin (Frontend → New code → Release).