Skip to content

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 + body
service #ord001 Orders { ... } // with stable ID
service AuthService in Platform { ... } // attach to a parent declared elsewhere
service Notifications // empty body, no braces

See Ch 4.

Interface

command Authorize // bare leaf
command 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 kind
facet Outer { facet Inner { ... } } // nested facets

resource 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 module
subprocess EmitX(arg) { Orders > Ledger.Record } // reusable helper

See 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.shop
version: "1.0.0"
widgets: "./widgets.js"
dependencies {
acme.shared: "../shared"
}
use * from arch.modules
use database, frontend from arch.modules
use Database as ManagedDB from acme.shared
export use payments_provider from acme.payments

See Ch 12.

Stable IDs

service #pay001 Payments { ... } // module ID
type #t001 module service { ... } // type ID
process #flow42 Checkout { ... } // process ID
view #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" } // subtype
export type ... // visible to importers

See Ch 15-15.

Required blanks

// Two and only two ways to address an inherited `required` blank:
field: value // fulfill
drop field // remove entirely

See Ch 17.

Propagation modes (set at the type)

ModifierBehavior
(none)localStays where set, doesn’t flow
cascadeFlows 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
appendFlows 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 metrics
drop metrics.Emit // remove a child

Move-set against an inherited required blank:

GoalSyntax
Refine to subtype kind, keep blankrequired <subtype> Name
Refine to subtype kind, fulfill<subtype> Name { ... }
Switch to non-subtype kind, keep blankoverride required <new-kind> Name
Switch to non-subtype kind, fulfilloverride <new-kind> Name { ... }
Fulfill keeping inherited kindName: value or Name { ... }
Remove entirelydrop Name

See Ch 19.

Widgets

widget: arch-service // custom-element form
widget.icon: server // widget prop
widget.accent: "#34d399"
widget: "<div class='card'>{{name}}</div>" // inline template form
widget: """<archui-card>{{name}}</archui-card>""" // triple-quoted, raw

See Ch 20.

CLI

Terminal window
archlang validate <path> # validate; exit non-zero on errors
archlang validate --watch <path>
archlang info <path> # summarize a package
archlang check <path> # validate + run derived checks
archlang format <file.arch> # canonical formatting (whitespace, indent)
archlang format --check # exit non-zero if format would change anything
archlang format --diff # print what would change

See 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
└── ...