Design rationale

Docs · Reference

Copy as Markdown
View as Markdown

Design rationale

Why UJN works the way it does: the main decisions behind the notation, in plain words, each with a small drawing that shows it.

UJN 0.1 draft · revision 23 · November 29, 2026 · Changes

A journey is written as plain text#

You write a journey as plain text, from @startujn to @endujn, with no positions. The PlantUML extension draws it as SVG or PNG, and can also write a file other tools read.

Why

  • Text is easy to compare between versions, tools can read it, and AI assistants can write it.
  • One file is both the picture and the data, so nothing has to be kept in step.
  • The layout is automatic, so nobody places boxes by hand, and the same text always gives the same drawing.

What we did not do

  • We did not start with draw.io shapes, because tools could not read them without an exporter, and layouts would stay hand-made.
  • We did not write journeys inside @startuml, because words like actor, start and end already mean something there.
ExampleTry it
@startujnjourney SHOP "Checkout"view cart { title: "Cart"; route: /cart }view pay { title: "Payment"; route: /pay }end paid { description: "Order placed" }cart --> pay : [Check out]pay --> paid : [Pay]@endujn
Drawing of Example: view Cart, view Payment, end paid. Arrows: Cart to Payment on Check out; Payment to paid on Pay.
Drawn from this text3 nodes · 2 arrows0 warnings

The text gives no positions: the PlantUML extension placed every box and arrow, left to right. Spec: (About this spec, 2, 13.10, 19.6, 19.7, 20)

Other tools read the journey's data file#

On request, the PlantUML extension also writes the journey as a data file that other editors and tools can read. The spec calls this file the model, and a schema describes every field in it.

Why

  • Tools build from the data, not the picture, and a picture not drawn from data drifts away from it.
  • The schema was written with the language, before the code, so each field has one name that every tool uses.
  • Notes for developers, such as accessibility notes and links to tests, go into the data file and show only as hover text in an SVG, so the drawing stays as designed.

What we did not do

  • We did not draw pictures first and define the data later, because the pictures would then be redrawn.
  • We did not keep notes and links in a second file, because two files would have to be kept in step.
ExampleTry it
@startujnjourney LOGIN "Sign in"view login{  title: "Login"  description: "Email and password"  a11y: "Focus starts in the email field"}view home { title: "Home"; route: /home }login --> home : [Sign in]@endujn
Drawing of Example: view Login, view Home. Arrows: Login to Home on Sign in.
Drawn from this text2 nodes · 1 arrow0 warnings

The description is drawn; the accessibility note (a11y) is not, and goes into the data file and SVG hover text. Spec: (9, 9.3, 20)

A short first line, details in a block#

Each screen or step is a short line, such as view login, with an optional block of details in braces. An arrow works the same way: login --> home : [Sign in], its name after the colon, then an optional block.

Why

  • A simple screen stays short: view register alone is a complete statement.
  • Long details, such as a description or links to tests, get room in the block.
  • Each detail is named, so it is clear, easy for tools to read, and easy for AI assistants to write.

What we did not do

  • We did not put everything on one line, because a line stays readable only up to about four details.
  • We did not keep details in a separate data file, because every journey would then need two files.
ExampleTry it
@startujnjourney REG "Register"view registerview details {  title: "Your details"  description: "Name and email"  route: /register/details}view welcome { type: toast; title: "Welcome" }register --> details : [Start]details --> welcome : [Create account]@endujn
Drawing of Example: view register, view Your details, view Welcome. Arrows: register to Your details on Start; Your details to Welcome on Create account.
Drawn from this text3 nodes · 2 arrows0 warnings

register has no block and shows its own name; details takes its title, description and route from its block. Spec: (1, 2, 4.1, 4.4, 4.5, 5, 13.1, 22)

Nine kinds of node, plus short type lists#

A journey is drawn with nine kinds of node, such as a screen (view), a system step (action) and an end. Most kinds have a short list of types; a type changes the icon and the type name drawn in the box, but rarely the shape.

Why

  • Each kind or type earns its place only if it changes what gets built or tested, or clearly helps people read.
  • Nine kinds are few enough to learn at a glance, yet enough to draw a whole journey.
  • A type brings fixed behavior: a modal blocks the screen behind it, while a drawer leaves it usable.

What we did not do

  • We did not give every idea its own shape, because there would be more to learn, and some of those shapes would change nothing that gets built or tested.
  • We did not stop at three basic shapes, because three were too few to draw a whole journey.
ExampleTry it
@startujnjourney DEL "Delete a claim"view claim { title: "Claim"; route: /claims/:id }view confirm { type: modal; title: "Delete claim?" }action remove { title: "Delete claim" }view deleted { type: toast; title: "Claim deleted" }claim --> confirm : [Delete]confirm --> remove : [Yes, delete]remove --> deleted@endujn
Drawing of Example: view Claim, view Delete claim?, action Delete claim, view Claim deleted. Arrows: Claim to Delete claim? on Delete; Delete claim? to Delete claim on Yes, delete; Delete claim to Claim deleted.
Drawn from this text4 nodes · 3 arrows0 warnings

The three views share one frame, with a different icon and type name; the action has its own shape. Spec: (4.5, 11.2, 11.4, 12, 12.1, 14.2, 15.2, 16.2, 17.2, 17.6, 18.1, 20.4)

Every screen and pop-up is its own box#

A pop-up, a side panel, a tab or a wizard step gets its own box, linked to its screen by arrows. No box sits inside another, and there are no swimlanes (bands that group steps by who does them).

Why

  • PlantUML lays out flat boxes and arrows well, and boxes inside boxes less well.
  • One rule keeps it simple: links are arrows, and the arrow into a pop-up shows what it opens over.
  • A swimlane only arranges the drawing by owner; tools read who does what from the boxes themselves.

What we did not do

  • We did not draw pop-ups or steps inside their screens, because boxes inside boxes are harder to lay out.
  • We did not add swimlanes, because they need a special layout for something tools do not read from them.
ExampleTry it
@startujnjourney CLM "New claim"view claims { title: "Claims"; route: /claims }view wizard { type: wizard; title: "New claim" }view details { title: "Details"; parent: wizard }view help { type: modal; title: "Help" }claims --> wizard : [New claim]wizard --> details : [Start]details --> help : [Help]help ..> details@endujn
Drawing of Example: view Claims, view New claim, view Details, view Help. Arrows: Claims to New claim on New claim; New claim to Details on Start; Details to Help on Help; Help to Details.
Drawn from this text4 nodes · 4 arrows0 warnings

Help and Details are boxes of their own, joined by arrows; parent: wizard tells tools that Details is a wizard step. Spec: (11, 11.3, 12.3)

Leaving the app gets its own box#

When the user leaves the app, UJN draws a handoff: a box with a dashed border. It shows where they went and how long they have, and dashed arrows show where they come back.

Why

  • A box gives the pause a place for its facts: where the user went, the time limit, the link back.
  • It shows developers, and tools that write code, what to build: the exit, the wait and the way back in.
  • Leaving and coming back, as with email links and one-time codes, is central to the journeys UJN draws.

What we did not do

  • We did not just tag the arrow that leaves, because the time limit and way back would need extra boxes.
  • We did not use a handoff for a new browser tab, because the user stays in the app.
ExampleTry it
@startujnjourney RESET "Reset password"view forgot { title: "Forgot password"; route: /forgot }action send_link { type: message; title: "Send reset link"; channel: email }handoff email_link { title: "Reset link"; channel: email; timeout: 24 h; resume: /reset/:token }view reset { title: "New password"; route: /reset/:token }view link_expired { title: "Link expired"; route: /reset/expired }forgot --> send_link : [Send link]send_link --> email_linkemail_link ..> reset : [Open link] validemail_link ..> link_expired : [Open link] expired@endujn
Drawing of Example: view Forgot password, action Send reset link, handoff Reset link, view New password, view Link expired. Arrows: Forgot password to Send reset link on Send link; Send reset link to Reset link; Reset link to New password on Open link; Reset link to Link expired on Open link.
Drawn from this text5 nodes · 4 arrows0 warnings

The dashed box is the trip to the inbox, marked "email · 24 h"; two dashed arrows bring the user back. Spec: (11.2, 13.7, 15, 15.3, 15.4)

No decision diamond: conditions sit on arrows#

UJN has no diamond shape for decisions: the conditions written on the arrows out of a box show the branch. From a screen, the user takes one arrow. From a system step, every arrow without a condition runs, and of the arrows with a condition, exactly one runs.

Still open This holds for now: see 23.18.

Why

  • For a tool that writes code, a diamond and conditions on the arrows mean the same thing.
  • Drawings stay smaller and cleaner, with no extra diamond for every branch.
  • On a system step, a condition marks a branch and no condition marks an arrow that always runs; for now, mixing the two on one step is a warning (question 23.18).

What we did not do

  • We did not draw a diamond for every branch, because each condition would add one more shape.
  • We did not make the diamond optional, because then one branch could be drawn two ways.
ExampleTry it
@startujnjourney AUTH "Sign in"view login { title: "Login"; route: /login }action validate { title: "Validate credentials" }view dashboard { title: "Dashboard"; route: /home }view bad_login { type: toast; title: "Incorrect credentials" }login --> validate : [Sign in]validate --> dashboard : validvalidate -x-> bad_login : invalidbad_login ..> login@endujn
Drawing of Example: view Login, action Validate credentials, view Dashboard, view Incorrect credentials. Arrows: Login to Validate credentials on Sign in; Validate credentials to Dashboard; Validate credentials to Incorrect credentials; Incorrect credentials to Login.
Drawn from this text4 nodes · 4 arrows0 warnings

The step "Validate credentials", drawn as an Action, branches with no diamond: its arrows carry "valid" and "invalid". Spec: (13.4, 13.5, 14.4, 23.18)

Arrow names: what the user does, then when#

An arrow's name can have two parts: what the user does, in square brackets, then the condition as plain text. The drawing joins them with a dot: [Sign in] valid credentials shows as "Sign in · valid credentials".

Still open This holds for now: see 23.12.

Why

  • They are separate facts for testing: a test performs what the user does, and checks the condition both ways.
  • It reads like PlantUML, with the user's step in brackets after a colon, so PlantUML users read it at once.
  • After a system step no user acts, so an arrow may carry a condition alone; the brackets tell what the user does apart from a condition.

What we did not do

  • We did not write arrows as sentences, like go login check [Sign in], because no PlantUML diagram looks like that.
  • We did not add a word like "if" before the condition; for now it is plain text (question 23.12).
ExampleTry it
@startujnjourney AUTH "Sign in"view login { title: "Login"; route: /login }view dashboard { title: "Dashboard"; route: /home }view bad_login { type: toast; title: "Incorrect credentials" }view forgot { title: "Forgot password"; route: /forgot }login --> dashboard : [Sign in] valid credentialslogin -x-> bad_login : [Sign in] wrong passwordlogin --> forgot : [Forgot password]bad_login ..> login@endujn
Drawing of Example: view Login, view Dashboard, view Incorrect credentials, view Forgot password. Arrows: Login to Dashboard on Sign in; Login to Incorrect credentials on Sign in; Login to Forgot password on Forgot password; Incorrect credentials to Login.
Drawn from this text4 nodes · 4 arrows0 warnings

Two names show what the user does, then the condition after a dot, as in "Sign in · valid credentials"; "Forgot password" has no condition. Spec: (13.1, 13.4, 13.5, 14.4, 23.12)

Going back has an arrow of its own#

Going back, such as closing a modal or pressing Back, has its own arrow: ..>, dashed with an open head. Going back after a failure is written .x.> and also gets a cross.

Still open This holds for now: see 23.11.

Why

  • Going back is built differently: the app steps back in its history instead of opening a new page.
  • A failure that sends the user back needed its own arrow, because a plain way back hid the failure.
  • For a trip to another journey or out of the app, returns on one arrow also draws the way back.

What we did not do

  • We did not, for now, give a retry its own arrow, because a retry opens its screen like any other arrow: it is --> with the trigger [Retry] (question 23.11).
  • We did not add an "optional" arrow, because every arrow the user chooses is already optional.
ExampleTry it
@startujnjourney AUTH "Sign in"view login { title: "Login"; route: /login }action validate { title: "Validate credentials" }view dashboard { title: "Dashboard"; route: /home }ref registration { journey: REG; title: "Registration" }login --> validate : [Sign in]validate --> dashboard : validvalidate .x.> login : invalidlogin --> registration : [Create account] { returns }@endujn
Drawing of Example: view Login, action Validate credentials, view Dashboard, journey reference Registration. Arrows: Login to Validate credentials on Sign in; Validate credentials to Dashboard; Validate credentials to Login; Login to Registration on Create account.
Drawn from this text4 nodes · 4 arrows0 warnings

The dashed "invalid" arrow with a cross is a failed way back; the dashed arrow from Registration comes from returns. Spec: (13.2, 13.3, 13.7, 20.5, 23.11)

Flags never change a box's shape#

A flag marks where a part of the journey stands, such as future, or asks for a review, such as security. A flagged box keeps its shape: its border turns dotted (a handoff stays dashed) and a tab shows each flag.

Why

  • A box has one type, which changes the code; it may have several flags, which do not.
  • Flags such as future let one drawing show today's product and the plan together.
  • The border turns dotted too, because readers of black-and-white prints notice a line more than a small tab.

What we did not do

  • We did not make the type a flag, because then a screen could be both a modal and a toast.
  • We did not add a flag for "current", because a box with no status flag is already current.
ExampleTry it
@startujnjourney AUTH "Sign in"view login { title: "Login"; route: /login }view terms { type: modal; title: "Terms of use" }view passkey { type: modal; title: "Passkey prompt"; flags: [future, security] }login --> terms : [Terms of use]terms ..> login : [Close]login --> passkey : [Use passkey]passkey ..> login : [Cancel]@endujn
Drawing of Example: view Login, view Terms of use, view Passkey prompt. Arrows: Login to Terms of use on Terms of use; Terms of use to Login on Close; Login to Passkey prompt on Use passkey; Passkey prompt to Login on Cancel.
Drawn from this text3 nodes · 4 arrows0 warnings

Both modals keep the same frame; "Passkey prompt" only adds a dotted border and a tab for each of its two flags. Spec: (8, 11.5, 13.8, 15, 19.4)

Delivery flags carry forward; review flags stay put#

A delivery flag, such as future, carries forward to everything reached only through the flagged screen, step or arrow. A review flag, such as risk, marks one place only.

Still open This holds for now: see 23.3.

Why

  • You flag one place, and everything reached only through it follows, also when you change that flag later.
  • A delivery flag says where a part of the journey stands; a review flag asks for attention at one spot.
  • UJN works out the flags passed on, so the drawing and the file other editors and tools can read agree.

What we did not do

  • We did not keep each flag where it is set, because you would then flag every later screen by hand.
  • We did not let legacy carry forward, because a new screen behind an old one would be marked legacy too. For now legacy stays where it is set; the question is still open (23.3).
ExampleTry it
@startujnjourney SHOP "Checkout"view cart { title: "Cart" }view pay_later { title: "Pay later"; flags: [future] }view dates { title: "Choose dates" }view card { title: "Card payment"; flags: [risk] }view paid { title: "Order placed" }cart --> pay_later : [Pay later]pay_later --> dates : [Continue]cart --> card : [Pay by card]card --> paid : [Pay]@endujn
Drawing of Example: view Cart, view Pay later, view Choose dates, view Card payment, view Order placed. Arrows: Cart to Pay later on Pay later; Pay later to Choose dates on Continue; Cart to Card payment on Pay by card; Card payment to Order placed on Pay.
Drawn from this text5 nodes · 4 arrows0 warnings

Choose dates gets future from Pay later, as an outlined tab and a dotted border; Order placed gets nothing from risk. Spec: (8, 13.8, 20.1, 20.4, 20.5, 23.3)

Everything still reads in black and white#

Shapes, icons, lines, arrowheads and small symbols carry every meaning, so a black-and-white print says the same as color. For now, two flags with no symbol yet, legacy and needs-updates, show the letters L and U (23.28).

Still open This holds for now: see 23.28.

Why

  • On paper the eye reliably tells apart only three line styles, so UJN uses just three: solid, dashed and dotted.
  • On an arrow, each style has one job: solid moves on, dashed goes back or comes back, dotted marks a flag.
  • An arrow for a failure carries a cross, so it reads as a failure without red.

What we did not do

  • We did not give each kind of arrow its own line style, because some pairs already looked alike in print.
  • We did not mark flags with a small badge only, because black-and-white readers would have to find it.
ExampleTry it
@startujnrender { colors: mono }journey PAY "Pay"view card { title: "Card details"; flags: [legacy] }view wallet { title: "Wallet"; flags: [future] }view declined { type: toast; title: "Card declined" }end paid { title: "Paid" }card --> paid : [Pay] card acceptedcard -x-> declined : [Pay] card declineddeclined ..> cardcard --> wallet : [Use wallet]@endujn
Drawing of Example: view Card details, view Wallet, view Card declined, end Paid. Arrows: Card details to Paid on Pay; Card details to Card declined on Pay; Card declined to Card details; Card details to Wallet on Use wallet.
Drawn from this text4 nodes · 4 arrows0 warnings

In one ink (render { colors: mono }), the cross marks the failure, the dashed line goes back, and tabs mark flags. Spec: (8, 10, 13.2, 13.8, 15.5, 19, 19.4, 23.4, 23.28)

Two ids: one to show, one to link#

A screen or step can show a short display id for people, such as AUTH-002, and that id may change. Links use a second, permanent unique id: 11 random hex digits (0 to 9, a to f). You write unique_id: {{auto}}, and a tool fills it in once; this must happen before the file's first commit.

Why

  • Tests, code and requirements link to a screen through its id, so that id must never change.
  • Ids built from what people edit go wrong: add a screen above, and the shown numbers shift.
  • The permanent id depends on nothing you edit, so you can rename a screen and links still hold.

What we did not do

  • We did not build the type into the id, as in MOD-001, because a type change would make it wrong.
  • We did not let links use the shown ids, because those ids move when screens are added.
ExampleTry it
@startujnjourney AUTH "Sign in"increment { auto; view_prefix: "AUTH" }view login [AUTH-10] { title: "Login"; unique_id: 6f2f4d29ca5 }view forgot { title: "Forgot password"; unique_id: 0b7e3a91c42 }view sent { title: "Check your email" }login --> forgot : [Forgot password]forgot --> sent : [Send link]@endujn
Drawing of Example: view Login, view Forgot password, view Check your email. Arrows: Login to Forgot password on Forgot password; Forgot password to Check your email on Send link.
Drawn from this text3 nodes · 2 arrows0 warnings

The tabs show display ids: AUTH-10 written by hand, the others numbered in order; unique ids are not drawn. Spec: (4.2, 4.3, 6, 7, 7.1, 7.3, 7.5, 20.1)

A broken rule still draws, with a warning#

If a journey breaks a rule, UJN still draws it and lists each problem, with its line, underneath. Only a syntax error, such as a line UJN cannot read, stops the drawing.

Why

  • You see problems as you work, and you can still look at a half-finished journey.
  • The same warnings go into the file other editors and tools can read, so they need not check again.
  • One warning is about layout, when an arrow's name has no free spot; it stays out of that file, which does not depend on layout.

What we did not do

  • We did not refuse to draw a broken journey, because then you could not look at a half-finished one.
  • We did not leave the checks to a separate tool, because mistakes would show only when someone ran it.
Example warns on purpose: a warningTry it
@startujnjourney SIGNUP "Sign up"view email { title: "Your email" }view code { title: "Enter code" }view welcome { title: "Welcome" }email --> code : [Send code]code --> welcome@endujn
Drawing of Example: view Your email, view Enter code, view Welcome. Arrows: Your email to Enter code on Send code; Enter code to Welcome.
Drawn from this text3 nodes · 2 arrows1 warning, on purpose

The module prints these warnings, by line (every warning):

  • line 7 · code --> welcome: an exit from a view needs a trigger, written after a colon: [Trigger]

The arrow into Welcome does not say what the user does (its trigger, in square brackets), yet it is drawn, and the box underneath names line 7. Spec: (19.6, 20.6, 21)