Skip to content

The navigation map

Where every case lives in your app, as a tree of places, and everything that is worked out from it.

Applies to EngineCloud
View as Markdown
On this page
  1. The parts
  2. Ids and paths
  3. Cases and places
  4. Generated from the code, checked by real clicks
  5. What the tree feeds
  6. Rules the check applies

Inside the app, every case has a place: the screen, tab, modal or menu where it happens. The navigation map puts those places in a tree, so the way to reach any of them is always known: «Shop › Order for tomorrow».

cases/navigation.yaml
roots:
  - id: site
    title: La Espiga
    actors: [visitor, customer]
    route: /
  - id: shop
    title: Shop
    actors: [customer]
    route: /shop
  - id: console
    title: Console
    actors: [staff, owner]
    route: /console

places:
  - id: shop.order-for-tomorrow
    title: Order for tomorrow
    kind: screen
    parent: shop
    opened_by: { label: Order for tomorrow, kind: button }
    route: /shop/tomorrow
  - id: shop.order-for-today
    title: Order for today
    kind: screen
    parent: shop
    opened_by: { label: Order for today, kind: button }
    route: /shop/today
  - id: shop.my-orders
    title: My orders
    kind: tab
    parent: shop
    opened_by: { label: My orders, kind: tab }
  - id: shop.my-orders.order-detail
    title: Order
    kind: screen
    parent: shop.my-orders
    opened_by: { label: an order in the list, kind: item }
  - id: console.cash-flow
    title: Cash flow
    kind: screen
    parent: console
    opened_by: { label: Cash flow, kind: item }
  - id: console.cash-flow.new-transaction
    title: New transaction
    kind: modal
    parent: console.cash-flow
    opened_by: { label: New transaction, kind: button }
    permission: payments.create

shortcuts:
  - from: site
    to: shop.order-for-tomorrow
    label: Order now

The parts

PartWhat it is
RootWhere an actor comes in: the public site, the console, the member app. A map has as many roots as the app has front doors, and an actor may have several.
PlaceA screen, tab, modal, menu or panel. It has an id, a title, a kind, an optional route and an optional permission.
ParentEvery place has exactly one parent: a root or another place. That is what makes the path unique.
ActionableThe button, link, menu item or tab on the parent that opens the place (opened_by). It is what a person clicks.
ShortcutAny other way to reach a place: a link on the home page, a notification, a search result. Shortcuts are ways in, never a second parent.

Ids and paths

A place id is lowercase words in kebab-case, joined by dots: shop.order-for-tomorrow. By habit the first part is the root or section it lives under. The id is a name from your code, independent of the route and of the path in the tree: the route can change, and moving a place to another parent keeps its id, and every case that points to it.

The path is never written by hand. It is the titles from the root to the place, joined with ›: console.cash-flow.new-transaction reads «Console › Cash flow › New transaction». Rename a title and every path that goes through it follows.

Cases and places

A case that happens inside the app says where with where:

cases/payments/record-transaction.case.yaml
id: record-transaction
starts: in_app
where: console.cash-flow.new-transaction

where is optional, and only cases that start in_app have one. A case that starts when another app calls, on a schedule or on an event has no place; where it changes what people see, that change shows on the places of the cases that show it. Several cases can share a place: «See my orders» and «Cancel an order» both live on shop.my-orders.order-detail.

Generated from the code, checked by real clicks

You can write the tree by hand, but it usually comes from the code. Each place and each actionable carries an id in the markup:

HTML
<main data-sypnia-place="shop">
  <a href="/shop/tomorrow" data-sypnia-opens="shop.order-for-tomorrow">Order for tomorrow</a>
</main>

<main data-sypnia-place="shop.order-for-tomorrow">…</main>

data-sypnia-place goes on the element that shows a place; data-sypnia-opens on the actionable that opens one. The pieces Sypnia Design generates, and the components of @sypnia/ui, set them for you from the case’s where; in any other markup, write the attributes yourself. Then:

Terminal
npx @sypnia/cases nav --from-code     # reads every data-sypnia-place and data-sypnia-opens, proposes the tree

The result is a proposal, like any change to the map. Then Sypnia Telemetry confirms the tree with what people really do. Its browser SDK reads the same attribute: every page_view and click carries place, the id of the innermost data-sypnia-place around it (an id from your code, never the page’s content). On the server side, every run of a case is a span with sypnia.case (the case id) and sypnia.case.outcome (how it ended). With the project linked, Cases compares people’s moves, a click in one place and the next place they see, with the tree:

FindingWhat it meansWhat to do
nav-missing-edgepeople move between two places with no actionable or shortcut between them in the mapadd it as a shortcut, or remove the link
nav-unreacheda place nobody reached in 30 dayscheck the way to it, or remove it from the map
nav-unknown-routea route people visit that has no placegive it a place, or find out why it exists

Each finding is shown on the map, with a proposal ready to accept or dismiss (Telemetry).

What the tree feeds

The tree is written once and used everywhere a person or an agent needs to know where something is:

  • «How to get there» in your docs and help pages. Each case shows its path, «Shop › Order for tomorrow», always current.
  • The coding agent. «Where do I edit the price of a product?» has one answer: the place, its path, its route and the files behind it (Agent).
  • Role editors. When you edit a role, the tree shows which places it can reach and which it cannot, by permission, so a role never ends up with a button that leads nowhere.
  • Video breadcrumbs. A tutorial or support video shows the path of each step as it records it (Sypnia Learn).
  • Screens. Sypnia Design designs one screen for every case with a where, and shows its path.

Rules the check applies

  • Every parent exists, and following parents always reaches a root (no cycles).
  • Ids are unique across roots and places.
  • A case’s where exists, and its actor is one of the actors of the place’s root.
  • A case with where starts in_app.
  • A shortcut points to an existing place and never replaces its parent.
  1. The parts
  2. Ids and paths
  3. Cases and places
  4. Generated from the code, checked by real clicks
  5. What the tree feeds
  6. Rules the check applies

    Search pages, sections and terms