Playground
Try UJN
Write a journey in the editor. The drawing follows as you type, with the validator's warnings under it.
Live drawing needs the local render server. Until it is public, edit the samples and see them as drawn when this page was built.
Start it from the project folder with bash tools/ujn-serve.sh. For another port add
--port 18200, then put http://127.0.0.1:18200 here, or open this page with
?server=http://127.0.0.1:18200.
Planned A public render server, so the playground also works without the project.
The render server is not running. It draws with PlantUML and the UJN module on your computer, from the project folder (not public yet).
bash tools/ujn-serve.shhttp://127.0.0.1:18190 answers.
If your browser asked whether this page may reach your computer and you said no, allow it in the site's settings, or choose Stop connecting under Render server.
Your edits are not drawn yet. The drawing below is the sample as it was built.
Three steps
How the playground works
1Start the render server
It runs PlantUML's small built-in web server with the UJN module, the same PlantUML build that draws this site. It listens on 127.0.0.1 only.
bash tools/ujn-serve.shNot public yet The project repository is not public yet, so this works only where the project is.
2Write, or start from a sample
Pick a sample from the menu or write your own. The drawing follows about a third of a second after you stop typing.
What you type stays in this browser, in its local storage, and goes only to the render server set at the top of the page.
3Read the warnings
The validator names the line and the node. Click a warning to jump to its line; the gutter marks it too. Try the Broken on purpose sample to see four of them.
No warnings means none of the checks fired. It does not mean the journey is right.
Syntax
Cheat sheet
Enough to write a first journey. The primer covers the language on one page, and the docs have the full spec.
A file
@startujnjourney SHOP "Shop" start beginview cart { title: "Cart"; route: /cart }end done { type: success } begin --> cartcart --> done : [Pay]@endujnA node is a keyword, a handle and an optional block. An arrow is source, arrow, target, then a label after a colon.
Nine kinds of node
- view
- Anything the user sees as a window: a page, a modal, a toast, a wizard
- action
- Something the system does between views: validate, send, wait
- handoff
- The user leaves the app or its channel and may come back
- data
- A store an action reads or writes
- actor
- A person: the customer, or an agent doing a manual step
- system
- A service; type: external for a third party
- start / end
- Where it begins, and how it ends: success, failure or abandoned
- ref
- Another journey, named here and drawn elsewhere
Four kinds of arrow
- -->
- Navigation: the flow moves on
- -x->
- Failure: an error, a rejection
- ..>
- Return: going back
- .x.>
- Failed return: going back because something failed
- -down->
- A direction hint: also -up-, -left-, -right-
- : [Pay] valid
- The label: [trigger] then a guard
- { payload: [a, b] }
- The fields that cross the arrow
Eleven flags
- idea, future, not-implemented, out-of-scope, deprecated
- Delivery flags. Everything reachable only through the node inherits them.
- experiment, risk, security, needs-decision, needs-updates
- Review flags. They stay where they are set.
- legacy
- Pending in the spec; the proposal is that it stays where it is set.
Write them in a node's block: flags: [future]. The toggles above the editor add colors: mono, legend and direction: down to the render block they send; your text stays as it is.
Limits
What the playground does not do yet
Model JSON
Command lineThe local server returns drawings only: PlantUML's built-in web server accepts drawing options, and --ujn-model is not one of them. For the model, run this in the project folder:bash tools/ujn.sh -tsvg --ujn-model journey.puml
Permanent ids
Command line-populate_ids writes unique ids into your file, so it runs on the command line:bash tools/ujn.sh -tsvg -populate_ids journey.puml
A public render server
PlannedUntil it exists, the playground needs the local server and the project folder. The samples still show the drawings made when this page was built.
About the local server
While the server runs, any page open in your browser can send it a source and read the answer, because PlantUML's server allows every origin. The script keeps that narrow: it listens on 127.0.0.1 only, so other machines cannot reach it; it runs PlantUML's SANDBOX security profile, so a source cannot read your files or reach URLs (!include and %load_json are refused); and the server itself refuses options such as --config and -I.
A page can still make it work hard with a very large source. Stop it with Ctrl+C when you are done.