Stories
A story explains something that happens in order: a click that crosses a system, a change and what it made better, an incident as it unfolded. Tritone draws the parts on a floor seen from above, at an angle, and plays what happens between them one step at a time.
This page shows the kinds of story people write, each with a whole example and what it is good for. Every example is complete: open it in the live editor and change it, or give it to an agent as a model to follow. What each line means is in the story language.
| Story | It explains | Good for |
|---|---|---|
| A request, hop by hop | What one action sets off, and where the time goes | Onboarding, product and API docs, support |
| Before and after | What a change changed, with the number that moved | Pull requests, performance reports, proposals |
| Work done later | What waits in a queue, and why the answer comes first | Uploads, exports, e-mails: anything that takes a while |
| A conversation between parties | Who waits for whom, and who learns what | Payments, signing in, integrations |
| An incident | What broke, in what order, and what fixed it | Post-mortems, training for on-call |
| A process between people | Who hands what to whom, and where the days go | Approvals, support, operations |
| An idea, taught | A concept, through one example | Courses, articles, READMEs |
| A map of who is who | The parts, before anything moves | The first picture of a README |
How to read a story
| On screen | It is |
|---|---|
| A shape on the floor | An actor: a part of the system, a person, a service someone else runs. The shape says what kind of thing it is: a cylinder is a database, a figure is a person |
| A packet travelling between two shapes, with a label | A message: a request on its way, or the answer coming back |
| A label above a shape | A note: a fact about that actor while the step lasts |
| The caption under the floor | The number and the title of the step that is playing |
On this page every story plays by itself, each step in turn, and starts again. In the live editor, and wherever a
story is embedded as a player, the reader moves through it step by step instead, with the narration of each step
beside the drawing and its numbers above it: that is what the say, idea and set lines write. Open in the
live editor, under each example, shows it that way.
A request, hop by hop
Follow one action from the person who starts it to everything it touches, and back. Each step is one stretch of the trip, so the reader sees which part does what, and where the time goes.
Good for:
- Showing a new developer what one click does, before they read the code
- Product and API documentation: what an action costs, and where it waits
- Support: why something is slow, told to someone who does not read code
story What happens when you sign in
subtitle One click, followed from the browser to the database and back.
you(laptop)[Browser]
web(server)[Web app]
auth(service)[Sign-in service]
users(database)[Accounts DB]
step Send the password
you -> web: POST /login
web -> auth: is it right?
say The web app does not check passwords itself. It hands them to one service that does only that.
step Find the account
auth -> users: find the account
users --> auth: account, password hash
say The database keeps a fingerprint of each password, never the password itself.
set Sign-in = 120 ms
step Answer
auth --> web: it matches
web --> you: you are in
say The browser keeps a cookie that says who you are, so the next page does not ask again.
idea Only one service ever sees a password, and no database keeps one.- Keep to one action. A second action is a second story, or at least a step of its own.
- Declare the actors in the order the request meets them: they are placed in that order, left to right.
Before and after
Show a change by playing the same thing twice: once as it was, once as it is now. A metric with the same name in both steps shows the number that moved, and the messages that did not change make the one that did stand out.
Good for:
- A pull request: the reviewer sees what changed for the system before reading the code
- A performance report: the number that moved, and why
- A proposal: the change you want to make, shown before anyone builds it
story Why the report page got faster
subtitle The same visit, before and after one change.
you(laptop)[Browser]
api(server)[Reports API]
db(database)[Database]
cache(cache)[Totals cache]
step Before: every visit adds up the totals
you -> api: GET /report
api -> db: sum 2M rows
db --> api: totals
api --> you: the report
say Every visit added up the same two million rows again.
set Page = 6.2 s
step After: the totals are kept ready
you -> api: GET /report
api -> cache: get the totals
cache --> api: totals
api --> you: the report
say The totals are now worked out once an hour, and kept in a cache.
set Page = 0.3 s
idea The slow work did not get faster. It stopped happening while you wait.- An actor appears at the first step that mentions it: here the cache arrives with the change.
- Start each step title with
Before:andAfter:, so the caption says which one is playing.
Work done later
Some work takes too long to do while someone waits. The system answers with what is done, leaves the rest in a queue, and a worker picks it up in its own time. This story shows both halves, and why the answer comes first.
Good for:
- Explaining why a result is not there yet: a converted video, an export, a report sent by e-mail
- Designing a feature: deciding what the user waits for, and what can wait
- Telling support why a job can finish minutes after the page said yes
story What happens after you upload a video
subtitle The upload takes seconds. The work it starts takes minutes, out of sight.
you(laptop)[You]
api(server)[Upload API]
jobs(queue)[Job queue]
worker(service)[Video worker]
files(database)[File storage]
step Upload
you -> api: upload video
api -> jobs: convert it
api --> you: received
say The API leaves a job in the queue and answers at once. You can close the page.
set Wait = 2 s
step Convert, later
jobs -> worker: new job
worker -> files: save 3 sizes
note worker: 4 minutes of work
say A worker takes the job when it is free, and makes the versions that play on a phone, a laptop and a TV.
step Tell you
worker -> you: e-mail: video ready
idea Answer with what is done, queue what is slow, and say when it is finished.- A
queueactor is drawn as a stack of slabs: the reader sees at once that work waits there. - The step with no
setkeeps the last value: the wait shown stays the one you felt.
A conversation between parties
Several sides take turns, and each waits for an answer before it goes on: a payment, a sign-in through another account, two systems that agree on something. The story shows the order of the turns, and what each side learns.
Good for:
- An integration guide: what your system sends, and what it gets back, in order
- A security review: who sees what. Here the shop never learns how you paid
- Support: where a payment can be stuck, and whom to ask
story What happens when you pay by card
subtitle Four parties agree before the shop sees a yes.
you(user)[You]
shop(server)[Shop]
psp(cloud)[Payment provider]
bank(server)[Your bank]
step Ask to pay
you -> shop: pay 40 EUR
shop -> psp: charge card
say The shop does not keep your card number. It passes it straight to a payment provider.
step Ask the bank
psp -> bank: may this card pay 40 EUR?
bank <-> you: confirm in your bank's app
bank --> psp: approved
say Your bank asks you to confirm in its app. Only then does it answer.
step Confirm
psp --> shop: paid
shop --> you: order confirmed
set Payment = 4 s
idea The shop only ever learns that you paid, never how.<->is a handshake: something two sides do together, like confirming in an app or opening a secure connection.- A
cloudis a service someone else runs: a payment provider, a CDN, the internet.
An incident
Tell what went wrong the way it happened: one step per moment, the time in its title. The numbers show what users felt, and the last step says what changes so that it does not happen again.
Good for:
- A post-mortem: the order of events is the report, and the last step is the lesson
- Training people on call: what a real failure looks like from the inside
- Telling the rest of the company what happened, without the jargon
story The checkout outage of 14 March
subtitle 17 minutes without orders: what broke, in what order, and what fixed it.
users(user)[Customers]
api(server)[Checkout API]
db(database)[Orders DB]
oncall(user)[On-call engineer]
alerts(service)[Alerting]
step 14:02 The disk fills up
users -> api: place order
api -> db: save order
db --> api: disk full
api --> users: error 500
say A nightly export had been writing to the database's disk for six hours.
set Failed orders = 100%
step 14:05 The alarm goes off
alerts -> oncall: errors above 5%
note db: disk 100% full
say The alarm watched the errors, not the disk, so it fired three minutes after the first refusal.
step 14:19 The disk is freed
oncall -> db: delete the export
db --> oncall: 40% free
say The engineer found the export and removed its files. Orders went through again at once.
set Failed orders = 0%
step What we changed
alerts -> oncall: disk above 80%
idea Warn about what fills up, not only about what fails.- Write the times as they were. A step’s title is its caption, so the clock is always on screen.
- Keep the blame out: actors are parts and roles, not names.
A process between people
Not every story is about software. A refund, an expense, a new hire: the actors are people and the tools between them, and the story shows who hands what to whom, and where the waiting is.
Good for:
- An operations manual: who does what, and in what order
- Finding the slow part of a process: here, a note shows where the days go
- Explaining a process to someone new, or to a customer
story How an expense gets paid back
subtitle From a receipt in your pocket to the money in your account.
you(user)[You]
app(laptop)[Expense app]
manager(user)[Your manager]
finance(user)[Finance team]
bank(server)[Bank]
step Send the receipt
you -> app: receipt
app -> manager: approve 86 EUR?
say You take a photo. The app reads the amount and asks your manager.
step Approve
manager --> app: approved
app -> finance: ready to pay
note manager: took 2 days
say Most of the waiting is here: the request sits until your manager opens it.
set Days so far = 2
step Pay
finance -> bank: transfer 86 EUR
bank --> you: 86 EUR received
set Days so far = 3
idea Every hand-off is a queue. Fewer hands means less waiting.- A process with many steps and many roles reads better all at once: the
lanesmodel draws every hand-off of it on one floor.
An idea, taught
Explain a concept through one example the reader can follow: how an e-mail travels, what a cache does, why a CDN is fast. Each step is one thing to understand, and the idea of the last step is the sentence to remember.
Good for:
- A course or a workshop: one concept per story, one idea per step
- An article or a README: as an image, the story plays inside the page with no script
- Explaining your own product to a customer
story How an e-mail reaches you
subtitle Three servers pass it along. None of them knows the whole way.
alice(user)[Alice]
outbox(server)[Alice's mail server]
dns(cloud)[DNS]
inbox(server)[Your mail server]
you(laptop)[You]
step Send
alice -> outbox: send to you@example.org
say Alice's app hands the message to her mail server, and her part is done.
step Find the way
outbox -> dns: who takes mail for example.org?
dns --> outbox: mail.example.org
say Her server asks the address book of the internet where mail for your domain goes.
step Deliver
outbox <-> inbox: open a secure connection
outbox -> inbox: the message
say It connects to your mail server and hands the message over. Yours keeps it until you read it.
step Read
you -> inbox: any new mail?
inbox --> you: one message from Alice
idea Mail goes from server to server, like a letter between post offices.- Four or five steps are enough to explain most ideas. A longer story is usually two ideas.
sayis the explanation, andideathe one sentence the reader should leave with.
A map of who is who
A story with actors and no steps is a still picture: the cast of a system, before anything moves. It is the map a reader needs before the first story, and it becomes a story as soon as a step is added to it.
Good for:
- The first picture of a README: what the system is made of, one shape per kind of thing
- A glossary of a system for someone new: each name next to what it is
- A starting point: write the cast once, then add the steps of each story
story The parts of our shop
subtitle Who is who, before anything moves.
customer(user)[Customer]
web(laptop)[Web shop]
cdn(cdn)[CDN]
api(server)[Orders API]
cache(cache)[Price cache]
db(database)[Orders DB]
queue(queue)[Job queue]
mailer(service)[Mailer]- The actors climb a staircase in the order they are written. To place one yourself, write
at col,rowafter it, or drag it in the live editor, which writes that for you: see where actors stand.
Writing your own
| To | Do |
|---|---|
| Start | Open the live editor, load one from the Samples view, and change it |
| Keep it readable | Three to six actors, and one thing happening per step |
| Keep labels whole | Messages and notes are cut at 36 characters, actor names at 24 |
| Have it written for you | Give an agent the story language and one example of this page, and say what to explain |
| Choose the shape of an actor | The eight kinds: service, server, database, cache, queue, laptop, user, cloud |
| Show what is connected rather than what happens | That is not a story: draw it as Mermaid text in one of the models |