The browser app
Design scaffolds, grow arks and check their folders in a browser.
The browser app lets you copy a scaffold (the command line says template) into the project, create arks from it, browse an ark’s tree, add what its scaffold offers, run the check and keep scaffolds of your own. It is the easiest way to use Barnark.
Start it #
$ vendor/bin/barnark gui # http://localhost:8081, opens your browser
$ vendor/bin/barnark gui --port=9000 --no-open
It serves the barn it is started in: the nearest folder at or above the current one that holds a .barn/
folder. It prints the barn’s root and picks the next free port if the port you asked for is taken. Stop it with Ctrl-C. With no barn
there, the page says so and offers to make one in the folder it was started in. That adds only the .barn/ folder.
| Option | What it does |
|---|---|
-p, --port=PORT | The port to try first. The default is 8081. |
--host=HOST | The host to listen on. The default is localhost. |
--no-open | Don’t open a browser window. |
--dry-run | Print what would be started without starting it. |
The side panel #
The GUI calls every template a scaffold. The side panel has three headings. Arks lists the project’s arks by name. Choose one and its views slide in under a back arrow carrying its name: Tree, Check, History, Scaffold, the ark’s own scaffold, and Components. Your scaffolds holds the scaffolds you have copied, and Barnark scaffolds the shipped ones, which are read-only. An ark’s own scaffold is reached through its ark, never listed. Click a scaffold to see its tree and components. The panel can be dragged to whatever width you like, and a double-click on the divider puts it back.
Create an ark #
An ark is made only from one of Your scaffolds. Choose a Barnark scaffold, such as Domain Driven Design or Blank project (one empty folder), and Copy to Your scaffolds under a name such as My DDD. Then, on your copy, Create ark asks for the ark’s name, its folder and the folder’s base directory, and says what it will do: “Creates the ark Shop from a copy of My DDD. Later changes to My DDD won’t reach it.” The ark’s own scaffold takes the ark’s name, and its Scaffold tab says “Copied from My DDD, revision 1”. A project can have many arks. Deleting one of Your scaffolds asks first, and says that copies made from it, arks included, keep working.

Tree #
The tree shows a folder’s folders, never its files. Wherever the scaffold has a member type for a folder you name, it offers a button for it, on the directory’s own row and inside the directory once it is open. Click, for example, Create New Context, give the new folder a name, and the scaffold’s whole structure for it is made underneath.
A member is part of the template, so adding or deleting one makes a new revision, with a reason Barnark writes, such as “Added Context/Billing.” The delete dialog says so before a member goes.

Scaffold #
The Scaffold tab shows the ark’s scaffold’s current tree with what each folder means. A folder of the scaffold’s own offers +, to add a folder of yours inside it with a name and a meaning, and Meaning, to change what it means. Add a folder and Change what /src means do the same for the ark’s folder itself. Each is a new revision. A collection holds only members, so it offers no +, and nothing inside a member offers anything.

Check #
The Check tab runs the check. An unexpected folder offers Add to scaffold: give it a meaning and it becomes part of the ark’s scaffold as it is, and the check runs again.

History #
The History tab lists the ark’s scaffold’s revisions and shows each as a read-only tree. Revisions and history has the rest.
Components #
Every scaffold is built from components, each a folder with a meaning, holding fixed folders, a
collection of members or nothing. An ark shows them in its Components view, and a Barnark scaffold or one of yours behind
Components under its name. They are grouped as Placed, in the scaffold’s tree from its root down, and
Available, not placed yet, which shows only when there are some. Choose one to see its meaning, its tags and what it
holds, with a back arrow to the list. template:components lists the same from the command line.
One of your scaffolds, or an ark’s, takes copies. Copy from… finds a component in any of your scaffolds or
Barnark’s, each shown with the scaffold it is in, and Blank component, an empty folder you name, is always first.
The copy comes with everything it holds and is available to place: nothing in the tree uses it yet, so no folder
changes. A component’s details offer Copy to… one of your scaffolds or a new one, except an ark’s: nothing is copied out of an ark. A key already in use gets a
number (Feature2), and a tag the scaffold already declares keeps its own meaning; the notice after a copy says
which. An available component of one of yours can be Removed, with what only it holds. Later changes to the
original never reach a copy, but a copy says where it came from, in its details and on its scaffold’s page: “Copied from
Aggregate in Domain Driven Design, revision 3”, with the original linked while it is there, “original deleted” once it is gone and,
for a Barnark scaffold, “changed in Barnark since”. From the command line: template:copy-component and
template:remove-component.
Place, on a folder of a scaffold’s own tree, puts an available component there under its own folder name.
In an ark its folders are then made, one already made by hand being kept, and a collection arrives empty, ready for
members. A component is placed only once, never in a collection, and never in a folder used in several places. One of
your scaffolds opens on its Tree, where you add folders and change what they mean as on an ark’s
Scaffold tab, with nothing made on disk. From the command line: template:place, and
--template= on template:add-folder and template:change-meaning.
In one of your scaffolds every folder of the tree, a member type’s included, offers + to add a folder,
List to add a list (a folder that holds members, with the member type each follows), Meaning
and Remove, and the top offers Add a list. Build inside a member type to shape what each member
holds, such as the Domain and Application folders of every context. Remove asks
whether to take the folder out of this scaffold only, so it stays available to place again, or to delete its definition too. An
ark’s tree offers neither List nor Remove: it holds members, so its shape only grows. From the
command line: template:add-list, template:remove-folder, and --in=<key> on
template:add-folder and template:change-meaning.
Tags #
A template can tag its folders, as Domain Driven Design tags its layers Application, Domain,
Infrastructure and Transport. A folder’s tags show as coloured labels beside its name, in Tree and in a
template’s tree, and pointing at one shows what the tag means. Above a template’s current tree, a bar holds each of its tags: choose one to
see only the folders with that tag and the folders above them, every context’s Application among them, and choose it again to
see the whole tree.