Appendix D: Cheatsheet
For when you know what you want and need the syntax. Each line is a complete construct; chapters and other appendices are linked for full context.
Module
service Orders { team: Commerce command Create} // kind + name + bodyservice #ord001 Orders { ... } // with stable IDservice AuthService in Platform { ... } // attach to a parent declared elsewhereservice Notifications // empty body, no bracesSee Ch 4.
Interface
command Authorize // bare leafcommand Authorize { // with body "Description" timeout: "5s"}event PaymentEvents // event interface (async)command Handler { // event handler wiring subscribes: Orders.OrderEvents}See Ch 5.
Facet
facet OrdersResource { // generic facet base: "/orders" command Post}resource OrdersResource { base: "/orders" } // user-defined facet kindfacet Outer { facet Inner { ... } } // nested facetsresource is a custom kind teams define via type facet resource { ... }; the stdlib only ships generic facet. See Ch 6 and Ch 16.
Process
process Checkout { Customer > Orders.Create // step: Caller > Callee.Interface Orders > Payments.Authorize : "label" // step with label
if "stripe-customer" { // conditional Payments > Stripe.Charge } else { Payments > PayPal.Charge }
switch "outcome" { // multi-way branch ok { Payments > Ledger.Record } declined { Orders > Notifications.SendEmail } }
parallel { // parallel branches { Shipping > Notifications.SendEmail } { Shipping > Notifications.SendSMS } }
try { // error path Orders > Payments.Authorize } catch "declined" { Orders > Notifications.SendEmail }
each item in Cart { // iteration Cart > Inventory.Reserve }
do SomeHelper(arg) // invoke subprocess}
process Checkout in Orders { ... } // attach to a modulesubprocess EmitX(arg) { Orders > Ledger.Record } // reusable helperSee Ch 7.
View
view PaymentsLandscape { focus domain: Payments focus security.zone: PCI group by team layout elk // elk | dagre | force | manual include "Payments.*", "Gateway.*" exclude "*.Internal" "Description"}See Ch 8.
Fields and labels
service X { team: Commerce // identifier value repo.url: "https://..." // dotted key + string version: 2 // number enabled: true // boolean "Description goes here as a bare string."
labels { domain: Orders security.zone: PCI }}See Ch 9.
Descriptions
"Plain markdown plus two extensions.**bold**, *italic*, ~~strike~~, `code`, [link](https://...), tables, lists.
[[#stable_id]] and [[Name]] link to other declarations.@labelPath substitutes a label value from this node."See Ch 10.
Packages
name: acme.shopversion: "1.0.0"widgets: "./widgets.js"
dependencies { acme.shared: "../shared"}
use * from arch.modulesuse database, frontend from arch.modulesuse Database as ManagedDB from acme.sharedexport use payments_provider from acme.paymentsSee Ch 12.
Stable IDs
service #pay001 Payments { ... } // module IDtype #t001 module service { ... } // type IDprocess #flow42 Checkout { ... } // process IDview #v9 Landscape { ... } // view ID// Facets and interfaces do NOT carry IDs.See Ch 13.
Type declarations
type module service { required cascade team // mandatory cascading blank field required labels.domain // mandatory blank label component metrics { command Emit } // pre-filled sub-declaration required database PrimaryStore // mandatory blank sub-declaration cascade widget: arch-service // default cascading field append base // append-mode field (path/list/object compose)}
type service paymentsService { team: "Payments" } // subtypeexport type ... // visible to importersSee Ch 15-15.
Required blanks
// Two and only two ways to address an inherited `required` blank:field: value // fulfilldrop field // remove entirelySee Ch 17.
Propagation modes (set at the type)
| Modifier | Behavior |
|---|---|
| (none) — local | Stays where set, doesn’t flow |
cascade | Flows to descendants; override-on-walk |
cascade * | Declares a cascade-group root — sub-fields under the path participate in the same group; replacing the root drops the group; overriding a leaf keeps it |
append | Flows and composes (paths concat, lists append, objects merge) |
Cascade groups let you bundle related sub-fields (e.g. widget, widget.icon, widget.color) so that swapping the root tag automatically clears the inherited sub-fields, without per-leaf drop ceremony:
type module service { cascade * widget: arch-module { icon: service color: "#60a5fa" }}type service custom { widget: my-element // drops icon, color}type service tweaked { widget.color: "green" // keeps icon}Labels always cascade with override semantics; no modifier needed (or allowed) on labels. See Ch 18.
Refinement / override / drop (uniform at type and instance level)
// Refine — same kind or subtype, merges:component metrics { command EmitV2 }
// Override — switch to non-subtype kind, requires keyword:override database metrics { command Read }
// Drop — remove entirely:drop metricsdrop metrics.Emit // remove a childMove-set against an inherited required blank:
| Goal | Syntax |
|---|---|
| Refine to subtype kind, keep blank | required <subtype> Name |
| Refine to subtype kind, fulfill | <subtype> Name { ... } |
| Switch to non-subtype kind, keep blank | override required <new-kind> Name |
| Switch to non-subtype kind, fulfill | override <new-kind> Name { ... } |
| Fulfill keeping inherited kind | Name: value or Name { ... } |
| Remove entirely | drop Name |
See Ch 19.
Widgets
widget: arch-service // custom-element formwidget.icon: server // widget propwidget.accent: "#34d399"
widget: "<div class='card'>{{name}}</div>" // inline template formwidget: """<archui-card>{{name}}</archui-card>""" // triple-quoted, rawSee Ch 20.
CLI
archlang validate <path> # validate; exit non-zero on errorsarchlang validate --watch <path>archlang info <path> # summarize a packagearchlang check <path> # validate + run derived checksarchlang format <file.arch> # canonical formatting (whitespace, indent)archlang format --check # exit non-zero if format would change anythingarchlang format --diff # print what would changeSee Ch 21.
Embedding the viewer
<archlang-viewer src="./diagram.arch" style="width: 100%; height: 480px"></archlang-viewer>Sizing uses CSS (style, class); the element doesn’t accept width/height attributes. See Ch 23.
File layout reminder
my-project/├── package.archspace # manifest (required for non-anonymous package)├── widgets.js # custom-element registrations (optional)├── kinds.arch # type declarations├── orders.arch # instance declarations└── packages/shared/ # nested package (its own boundary) ├── package.archspace └── ...