Skip to content

Apps, pages and blocks

grimoire/apps/ describes where people meet the product: one folder per site or mobile app. Each page or screen lists its blocks, and each block points to a feature flow. The flow says what happens. The app folder says where it is shown and to whom.

---
id: web-client
type: site
root: src/web/$sites/client
---
# The shop website
## Conditions
- guest not signed in
- customer signed in
- vip customer with the vip membership
  • type is site or mobile.
  • origin is optional: inferred when you described the app from code, confirmed once the owner agrees. Layouts, pages and screens take it too.
  • root is the project folder of the site (src/web/$sites/client, or src/web in a single-site app) or of the mobile app (mobile). Warlock matches the app to the site or mobile app the code reports by this folder.
  • ## Conditions declares every named condition the app uses: who is looking (guest, customer), a membership (vip), or a setting (pref:personalised). A block’s Who sees it can name only declared conditions.

layouts/<layout>.md holds the blocks that every page of a layout shares (a header, a footer). It has the same ## Blocks table as a page. A page names its layout in the front matter: layout: site.

---
route: /products/:id
layout: site
---
# Product
One product with its price, stock and the order button.
## Blocks
| Block | Flow | Who sees it | Changes with |
| ------------ | ----------------------- | ----------- | ----------------- |
| Details | catalog/browse-products | everyone | vip: member price |
| Order button | orders/place-order | customer | — |
| Sign in hint | — | guest | — |
## Also reached from
- mail order-confirmation
ColumnMeaning
BlockThe name of the block on the page.
FlowThe <feature>/<flow> the block shows, or — when it belongs to no flow (a header).
Who sees iteveryone, or condition names of the app (checked against the app’s conditions).
Changes with—, or items separated by ;. Free text; names in backticks are checked (GR5010).

route is the route of the page in its site. A page whose route is not in the site any more is reported.

Put a block in its own file, pages/<page>/blocks/<block>.md, when how it looks or where it sits differs by app. The file name is the block name in lower case with dashes (new-arrivals for New arrivals). The file points to its flow in the front matter (flow: catalog/new-arrivals) and lists details such as position and shows. Every block file needs a row in the page’s Blocks table.

Show what a page, screen or block looks like with Markdown image lines, anywhere in its file outside code fences:

![The home page](../../../../screenshots/web/home.png)

The image files live in grimoire/screenshots/ (any subfolders; .png, .jpg, .jpeg, .webp, .gif). Write the path relative to the Markdown file, or starting with /grimoire/screenshots/. The Product map shows them under “Where you see it”. A path outside the folder is GR1029 and a missing file is GR2014; both are warnings.

A mobile app has screens instead of pages, in screens/<screen>/README.md.

  • File-based routing (Expo Router). Warlock lists the screens from the file names under app/ (or src/app/). A group folder such as (tabs) is not part of the route, index is the route of its folder, and [id] stays as written. _layout, +not-found, +html and +api files are not screens. Write the route of the screen in the front matter (route: /products/[id]); Warlock reports a route that has no file.
  • Navigation defined in code. Warlock does not read your source, so it lists no screens. Declare each screen in screens/<screen>/README.md with its name: screen: Orders. Nothing is compared with files.

What the user gets can differ by app (a phone uses the device location, a site uses the account’s country). Write that difference in the flow, under ## Differs by app. How a block looks or where it sits differs by app too: write that in the app’s block file. Never copy the flow into the app.

How a page is reached, and what it requires

Section titled “How a page is reached, and what it requires”

Do not write these. The book lists how a page is reached (the links and redirects Warlock can read) and what it requires (middleware and permissions). Write an entry point yourself only when the book cannot see it, such as a link in an email:

## Also reached from
- mail order-confirmation

Kinds mail, notification, page and screen are checked against the code; other kinds are free text.

The check reports these. Each code is described on the check page.

CodeSeverityMeaning
GR5001errorA block row or block file points to a flow that does not exist.
GR5002errorA condition is used in a block but not declared in the app README.
GR5003errorA page’s route is not a page of its site.
GR5004errorA page names a layout with no file.
GR5005errorAn app’s root matches no site or mobile app.
GR5006errorA screen has no route, or its route is not a screen of a file-routed app.
GR5007warningA block file has no row in its page’s Blocks table.
GR5008errorAn entry point in Also reached from names no mail, notification, page or screen.
GR5009warningA site or mobile app has no folder in grimoire/apps (only once the folder has apps).
GR5010warningA name in backticks in Changes with is not a condition declared in the app README.

A finding about a block or page fills its flow, so a proposed flow’s findings are shown as expected. A flow or feature that names an app with no folder is GR2008.