# Actors, areas and journeys

> Who acts in the map, how cases are grouped, and the paths people take through them.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://cases.docs.sypnia.com/map/actors-areas-journeys/

For agents: Actors: id, name, kind (person|system), description; a person actor maps to a role in the app (and, with Data, to RLS roles); systems include other apps (rappi) and the clock (scheduled cases). Areas: id, title, cases in order, public (outcomes other areas may listen to: <case>.<Outcome>; everything else internal); an area runs as one service. Journeys: id, title, actor, an ordered list of case ids, optional branches. Defined in cases/map.yaml.

## Actors

An actor is _who_ acts: a kind of person (customer, staff, owner) or another system (a payment provider, a scheduler). Every use case has one primary actor; steps can name others.

`cases/map.yaml (actors)`

```yaml
actors:
  - id: customer
    name: Customer
    kind: person
    description: Someone who buys at the bakery, signed in with an e-mail code
  - id: staff
    name: Staff
    kind: person
    description: Bakery staff; sees and prepares every order
  - id: payments
    name: Payment provider
    kind: system
  - id: rappi
    name: Rappi
    kind: system
    description: Sends orders from its app, by webhook
  - id: clock
    name: The clock
    kind: system
    description: Starts the scheduled cases
  - id: system
    name: The app itself
    kind: system
    description: Runs the cases that start on another case's outcome
```

With Sypnia Data, a person actor is usually a role your row-level security knows. Cases shows the link: the policies of the tables a case touches, and whether they allow its actors ([Data](https://cases.docs.sypnia.com/links/data)).

## Areas

An area groups cases that belong together, like a module or a section of the app, in the business's own words. Areas give the map its shape in the editor (one lane per area), keep their insides to themselves, and run together: the cases of an area run in one service ([Running cases](https://cases.docs.sypnia.com/runtime)).

`cases/map.yaml (areas)`

```yaml
areas:
  - id: menu
    title: Menu
    cases: [see-today-menu]
  - id: orders
    title: Orders
    cases: [place-order, order-for-tomorrow, rappi-order, cancel-order, see-my-orders]
    public: [place-order.OrderPlaced, order-for-tomorrow.OrderPlaced, rappi-order.OrderPlaced]
  - id: pickup
    title: Pick-up
    cases: [pick-up-order, mark-picked-up]
```

A case file lives in its area's folder: `cases/orders/order-for-tomorrow.case.yaml`.

`public` lists the outcomes other areas may listen to, as `<case>.<Outcome>`. Everything else is internal to the area: its cases can listen to each other, and nobody outside can ([Outcomes and events](https://cases.docs.sypnia.com/map/outcomes-and-events#areas-share-only-their-public-outcomes)). An area's public outcomes are its contract with the rest of the app.

## Journeys

A journey is the path one person takes through several cases, in order. Journeys are how a client checks that the whole experience makes sense, and how a new team member learns the app.

`cases/map.yaml (journeys)`

```yaml
journeys:
  - id: first-order
    title: A customer's first order
    actor: customer
    cases: [sign-up, see-today-menu, place-order, pick-up-order]
```

A journey may branch: `cases: [place-order, { either: [pick-up-order, cancel-order] }]`.
