RSX application design

Seven short films teach an architect how to think when designing a whole app on cdk-rsx: which actors exist, what each one owns, who may come through each public door, which changes are written to a Rechain log, and how a feature that crosses an await is drawn as a workflow before anyone builds it.

Each lesson.md is a storyboard design. Its narration blocks, read in order, are the voiceover. The surrounding directions say what is on screen, where to point, which phrase starts each motion, and what state the beat leaves behind.

Watch the seven films in the series player. Each lesson has chapters, English captions, and a transcript. The films use the Crew Cards teaching simulator for the worked day. The workflow and delivery views illustrate the application design.

Audience and prerequisites

The viewer specifies an app for a developer team or an AI to implement. They know Internet Computer basics. They have watched:

Earlier material What this course assumes from it
RSX architecture films A module owns versioned memory. Services are rebuilt at start. Owning and calling are two drawings. Checks come before writes. Nothing borrowed crosses an await.
Rechain: Inside the Machine Action, dispatch, reducers, prepared commits, block, chain, replay, certification.
Reactor: Inside the Channel Per-peer outbox, batch, stored inbox, storage ACK, addressed result.
Takt: Inside the Workflow Execution, node, visit, attempt, Choice, Remote, retry, catch, blocked, reconcile.

This course repeats none of that. It uses those objects to make design decisions. Where a lesson needs a term, it uses the term's existing drawing and meaning.

Where this fits

Series Question it answers
Internal system How does the storage machinery work?
dev_coder What code do I write?
Architecture How do I design one actor's modules and memory, and change them over releases?
Rechain, Reactor, Takt primers How does each machine work?
This course How do I design the whole app: actors, doors, history and workflows, and hand it over?

Proposed order: architecture films 1 to 8, then the Rechain, Reactor and Takt primers, then these seven.

The worked app: Crew Cards

Crew Cards is an original, illustrative app made for this course. It exists in no repository.

A sailing school trains crew. When a student passes a course, a federation registry issues a crew card that anyone can verify. Many schools use the one registry. One school is on screen.

Feature Rule
Enroll A registered student enrolls in a course once.
Score The course's instructor records one score, 0 to 100. The pass mark is 70.
Request a card A student who passed asks for their card. They get a ticket at once and the result later.
Carded and uncarded courses Course 12 ends in a registry card. Course 15 is an evening class and ends in a local completion only.
Issue The registry issues a card only on the instruction of a school that is accredited for that course and in good standing.
Suspend, reinstate, revoke Only the federation board changes a school's standing or revokes a card.
Verify Anyone can ask the registry whether a card is valid.

Actors and modules

school/src/                              actor · school (controller: dean)
  lib.rs                                 public methods, transport entry
  api.rs                                 Ticket, AwardStatus, Refusal
  office.rs                              enroll, record_score, request_card; saves nothing
  root/{mod.rs, memory/}                 attachments, shared runtimes, wiring
  settings/{mod.rs, memory/}             pass mark, registry principal
  courses/{mod.rs, memory/}              course -> instructor, carded
  students/{mod.rs, memory/}             student -> principal
  roll/{mod.rs, selectors.rs, memory/}   reducer: course status and award receipts by ticket
  workflows/award/                       award.takt.json, rules.rs, operations.rs, memory/

registry/src/                            actor · registry (controller: board)
  lib.rs                                 public methods, transport entry
  api.rs                                 CardView
  wire.rs                                card.issue request and result
  root/{mod.rs, memory/}
  standing/{mod.rs, selectors.rs, memory/}   reducer: school -> standing, courses, issued
  cards/{mod.rs, selectors.rs, memory/}      reducer: card record and (school, award) -> card

Cast

Caller Role
mira (340), ode (341), pau (342), kit (343), sol (344) Students
tov Instructor of courses 12 and 15
dean Controller of the school canister
board Controller of the registry canister
anyone Verifier

The worked day

All seven lessons share one day and one set of numbers. At 08:00 the school's roll chain has tip 115 and the registry's chain has tip 040.

State at 08:00 Values
School · Settings pass mark 70
School · Courses 12 Day Skipper: instructor tov, carded. 15 Knots Evening: instructor tov, uncarded.
School · Roll 340·12 Passed{82}. 341·12 NotPassed{55}. 342·15 Passed{90}. 343·12 Passed{74}. open awards 0.
Registry · Standing harbour: Good, courses {12}, issued 5
Registry · Cards valid 31
Time Caller and command Reply School roll chain Registry chain
08:30 sol · enroll(12) Enrolled 116 Enroll(344, 12)
08:40 tov · record_score(344, 12, 91) Scored{passed} 117 Score(344, 12, 91, 70)
08:45 mira · record_score(344, 12, 100) Refused(NotInstructor) none
09:00 mira · request_card(12) Ticket 7 118 OpenAward(7, 340, 12) then 119 CloseAward(7, 41) 041 Issue(harbour, 7, 340, 12)
09:20 ode · request_card(12) Refused(NotPassed) none none
09:40 pau · request_card(15) Ticket 8 120 OpenAward(8, 342, 15) then 121 CloseAward(8) none
10:00 board · suspend(harbour) Ok 042 Suspend(harbour)
10:05 kit · request_card(12) Ticket 9 122 OpenAward(9, 343, 12) then 123 RefuseAward(9, SchoolSuspended) none
11:00 board · reinstate(harbour) Ok 043 Reinstate(harbour)
11:30 sol · request_card(12) Ticket 10 124 OpenAward(10, 344, 12) 044 Issue(harbour, 10, 344, 12)
11:30:30 award 10 passes its 30 second timeout award_status(10) is Pending none none
14:00 dean · reconcile_award(10) Carded{44} 125 CloseAward(10, 44) none

At the end of the day the roll chain has tip 125, the registry chain has tip 044, cards 41 and 44 are valid, registry valid is 33 and harbour's issued is 7. A card's number is the index of the registry block that issued it.

The award workflow

One feature crosses an await: awarding a card. Lessons 5 to 7 draw it, and this is the finished design sketch.

flowchart LR
  A([Ticket · roll says Awarding]) --> R{Route}
  R -- carded --> I[IssueCard · remote · card.issue]
  R -- uncarded --> L[CloseLocal · local]
  I -- Issued card, block --> C[Close · local]
  I -. Rejected reason .-> F[Refuse · local]
  I -.- Note["Stop marker · unresolved while the result is unknown"]
  C --> D([Done])
  L --> D
  F --> X([Refused])

The stop marker labels the blocked state of IssueCard. An authenticated result for that operation lets the node take its usual edge. After Done the roll says Carded or Completed. After Refused the student returns to Passed and the old ticket retains its refusal.

Edge Evidence needed to take it
admission → Route committed OpenAward and the admitted execution it belongs to
Route → IssueCard saved admission says the course is carded
Route → CloseLocal saved admission says the course is uncarded
IssueCard → Close registry result Issued{card, block}
IssueCard → Refuse registry result Rejected(reason)
Close → Done, CloseLocal → Done roll block CloseAward
Refuse → Refused roll block RefuseAward

If the timeout leaves IssueCard blocked, an authenticated Issued receipt for the same award can also come from the registry's card.for_award lookup. It lets IssueCard take the existing edge to Close.

The design method

The course teaches one method. Each lesson adds one step and one drawing.

  1. Facts. List what the app must do and the facts it must keep. For each fact, name who has the final say.
  2. Actors. Draw an actor line only where authority, audience, consistency or deployment differ. Otherwise the fact stays a module.
  3. Owners. Give each fact one owning module. Draw who calls whom.
  4. Doors. For each public method write the caller, the allowed action and the reply. The door decides who. The owner decides whether.
  5. History. Mark the accepted changes that someone must later verify or replay. Those become Rechain actions. Everything else stays out of the log.
  6. Flow. For each feature that crosses an await: milestones, the owner of each step, local and remote edges, the other routes, and the evidence each edge needs.
  7. Proof. Rehearse a refusal, a success, a known failure and an unknown. For each, write what the client sees and what changed.

Lessons

1. Draw the Actor Lines

Teaches. An architect starts from facts and who has the final say on each. Four tests decide whether a fact needs its own actor: a different authority, a different audience, a consistency need, a different deployment life. The viewer applies them to Crew Cards and gets two actors. They also see the cost of a line: an await, partial progress and outcomes that can stay unknown. Courses and the roll fail every test and stay modules of one actor.

Visualizes. A FactSheet lists eight facts with a final-say column. The BoundaryCard asks its four questions of each row. Facts slide into one canister first. On the card and standing rows the tests light up and a second canister draws to the right, which fixes the ActorMap for the course. A trial split of Courses from Roll shows a dashed arrow and a clock where a plain call used to be, then snaps back.

2. Owners Inside an Actor

Teaches. Inside the school, every fact gets one owner, and the architect writes an owner table: fact, owner, readers, who may ask for a change. The viewer decides which modules are plain memory, which one is a reducer behind the roll chain, and which service saves nothing. They learn that a reducer checks only its own state and what the action carries, so the command copies the pass mark into the action. Two synchronous operations run across several modules in one call.

Visualizes. The OwnerTable fills beside the school. Capsules for Settings, Courses and Students draw in a row, the canonical Rechain machine draws below with one roll reducer, and Office sits unattached. enroll(12) and record_score(344, 12, 91) travel the call lines in one write frame each. The action pill visibly gains 70 before dispatch.

3. The Public Door

Teaches. A public method is a contract with a caller: who may call, what they may ask for, what they get back. The viewer fills a door table for both actors and separates two questions that are easy to mix: the door decides who is asking, the owning module decides whether the change is valid, and nobody outside reaches memory. They learn which doors are queries, which are for the controller, and that the peer route between canisters is a door with its own caller rule.

Visualizes. Doors draw on the rim of each canister: solid for updates, hollow for queries, dashed for the peer route. CallerBadges wait outside. A badge that fails the door's rule stops at the rim and gets a neutral OutcomeCard. A badge that passes the door can still be refused by the owner inside, with nothing changed. The DoorTable fills row by row.

4. What Goes in the Log

Teaches. Rechain is the recorded history of accepted domain changes in one actor. The viewer sorts candidate changes with one question: will someone need to verify or replay this later? Scores and card issues go in. Settings, workflow attempts, timers and transport stay out. They learn how state and the block relate, what a committed receipt is, why a reply carries one, and why replay rebuilds local state and never repeats a remote call.

Visualizes. A SortTray of candidate pills is dealt into log and not log. The canonical machine in the registry runs one Issue: both reducers accept, commits queue, deltas land, the chain shifts and block 041 forges. An OutcomeCard leaves carrying the receipt. A replay strip rebuilds the roll from blocks while the channel to the registry stays dark.

5. Draw the Workflow

Teaches. The architect draws a workflow in five steps: business milestones, the owner of each step, local and remote edges, the other routes, and the evidence each edge needs. The viewer builds the award graph that way, including a Choice with two routes. Then they lay the same graph over the actors as lanes, and read off who may act and which saved state and blocks change at each step.

Visualizes. A MilestoneStrip of three plain cards becomes canonical Takt node cards one at a time. Solid and dashed edges draw, then a Choice diamond and a quiet second route, then EvidenceTags on every edge. The graph then drops into the lanes view, whose columns are the ActorMap extended downward, and one success run leaves two blocks in the school lane and one in the registry lane.

6. The Remote Leg

Teaches. One edge of the graph leaves the canister, and the architect specifies it in full. The viewer separates three signals: the delivery ACK that means stored, the terminal result that means decided, and the timeout that means nothing is known. They decide what makes a repeated send the same operation, what the registry lets a school instruct, what the client sees, and what stays private to the workflow and the transport. They assign each concern to Takt, Reactor or Rechain.

Visualizes. The leg view zooms on the channel between IssueCard and the registry's route door. A CertaintyStrip over the leg moves through sent, stored, then issued, rejected or unknown. A second attempt of the same saved request returns the original card and forges no block. A Holds panel splits three columns: client, workflow, transport.

7. Rehearse the Feature

Teaches. A design is ready to hand over when it has been rehearsed. The viewer runs five commands through the lanes: a refusal at the door, a committed success, the uncarded route, a known rejection and an unknown outcome that stays unresolved until the registry's own record settles it. For each they compare the client's view, the saved state and the two chains. They finish with the brief and its acceptance checks.

Visualizes. A ScenarioSheet sits beside the lanes view. Each command plays down the lanes and fills one sheet row with three columns: client sees, school changed, registry changed. Four invariant lights stay green. The unknown case holds with an amber unknown marker for a long beat. The film ends on the BriefCard.

Shared visual language

Use the light paper, restrained semantic colors, small title and focused balloons of the earlier films. Each concept has one drawing at every scale. Workspace teaching and style guide

World geometry

The ActorMap is fixed from the end of lesson 1. The school canister is large and left of center. The registry canister is smaller and to its right. A Reactor channel joins them at mid height. Callers wait outside the school's left rim. The board waits above the registry and the verifier below it. Every later view is a camera move over this map or the map's columns extended downward.

View Framing
map Both canisters, the channel and all callers.
school The school canister fills the frame.
registry The registry canister fills the frame.
sheet A paper sheet takes the left third. The map sits dimmed at right.
graph The award workflow region of the school, enlarged, with room above for the MilestoneStrip.
leg The channel, with IssueCard at its left end and the registry's route door at its right end.
lanes The map's columns extended downward as lanes: caller, school door, award workflow, roll chain, channel, registry route, registry chain. Time runs down.

Components

Concept Drawing Status
A canister Rounded solid boundary with a small label such as canister · school. Existing
A module ModuleCapsule from the architecture films: public rim, dashed service band, solid memory vault. Existing in the architecture build
Owning and calling OwnTree solid edges and thin CallLines. Frame outlines one call's reach. Existing in the architecture build
Rechain The canonical machine: dotted boundary, optional thunk slot, dispatch, enlarged reducers each holding their selector and state folder, prepared commit row, chain. Existing
An action The warm rounded pill with only its call, such as Issue(harbour, 7, 340, 12). Existing
A block The blue tile with padded index and action, such as 041 and Issue(harbour, 7, 340, 12). Existing
A workflow node The canonical Takt node card with status dot and remote accent. Existing
The channel The canonical Reactor tunnel with outbox, inbox, ACK and result motion. Existing
A result OutcomeCard from the architecture films. A refusal uses a neutral outline. Existing in the architecture build
A rehearsal ScenarioSheet and BriefCard from the architecture films. Existing in the architecture build
Explanation PauseAndExplain. Existing
Facts and final say FactSheet. One row per fact with a final-say column. Course design
The four tests BoundaryCard. Authority, audience, consistency, deployment. Each lights when it applies. Course design
Who owns what OwnerTable. Fact, owner, readers, who may ask for change. Course design
A public method Door on the canister rim. Solid for update, hollow for query, dashed for a peer route. A small lock for controller-only. Course design
A caller CallerBadge. A small round badge with the principal's name. Course design
The public contract DoorTable. Method, kind, caller, allowed when, reply. Course design
Log or not SortTray. Two trays labeled log and not log. Course design
Business milestones MilestoneStrip. Plain paper cards in a row, before any machinery. Course design
Evidence on an edge EvidenceTag. A small tag on a graph edge naming the receipt that allows it. Course design
Certainty of a remote leg CertaintyStrip. sent, stored, then issued, rejected or unknown. Course design
Who holds what Holds. Three columns: client, workflow, transport. Course design

Every workflow graph and lane trace carries a small design sketch tab. None of them is an imported native inspection capture, and the films show no inspector Timeline or Instructions view.

State changes follow the workspace rules. A decrease is red with a negative delta. An increase is green with a positive delta. Deltas come from the worked values in the storyboard.

SDK features and teaching decisions

The lessons keep two things apart. The left column is what the SDK ships at the pinned commit. The right column is what this course chose for Crew Cards.

Available in the SDK Crew Cards decision, illustrative
Rechain dispatch prepares every reducer and commits only if all accept. A rejection consumes no block. Roll is a reducer. Standing and Cards are two reducers on one registry chain.
A reducer's prepare reads only its own memory, the action and fixed configuration. Score carries the pass mark in force, so the block stands on its own.
Rechain idempotency: caller, memo, created_at_time and identity bytes make a fingerprint. A repeat inside the 24 hour window returns DuplicateOf(block). expire_at refuses late execution. The memo is the ticket. The route turns DuplicateOf(41) into the original Issued{41}. The request expires at 08:00 the next day.
Takt nodes: Choice, Local, Remote, Succeed, Fail and others. Catch for known failure. Retry, TimeoutMillis, OnExhausted. The award graph, its node names, its two routes and its policy values.
A Remote node names a ParticipantContract with a safety of ReadOnly, Idempotent or Reconcile. card.issue.v1 is Idempotent. card.for_award.v1 is ReadOnly.
A blocked node can be settled with resolve and a known result. Resolving a Reactor request fences its response address. reconcile_award is a dean-only door. Its only evidence is the registry's answer.
Reactor delivers saved frames in order, retries the same bytes and answers through a response address. Peers are added explicitly. The school and the registry add each other as peers. card.issue is a Reactor route.
Endpoint guards and msg_caller checks are app code. Every row of the two door tables.
Opening the award and admitting the execution in one update call. The SDK allows both in one synchronous call. A ticket always means both happened. This is a design rule of Crew Cards, with an expected test.

Source anchors

Statements about SDK behavior were checked against ../newstack at commit f6c863661ada43a6766448fc84fc6923944dd98b. The Rust crates in cdk-rsx are the authority for this course. The Motoko repositories and the three primers explain the same model with different syntax, and the lessons do not show Motoko code.

Guarantee used in the lessons Anchor
The three libraries have separate responsibilities. Orchestration guide, lines 9 to 16
One root attaches module owners and binds one shared Reactor scheduler, Rechain runtime and Takt runtime. Chat fixture README, lines 9 to 11
Owning and calling are separate graphs. Nothing borrowed crosses an await. Check before mutation. Store architecture, line 17 · Conventions, lines 220 to 226
Controller-only and open endpoints are declared per method. Shop endpoints
A caller-scoped status query and an admission that returns a receipt. Heavy16 endpoints, start and request_status · Heavy16 API types, line 24 · Chat endpoints, send and workflow_status
Peers are added by the owner. A route handler receives the authenticated origin. Heavy16 endpoints, add_peer and route
Reducers prepare without write access and commit only under dispatch. Rechain reducer traits
All reducers validate before any commits. A rejection consumes no block. Basic Rechain fixture, lines 20 to 21 · Rechain README, lines 3 to 8
The recorded payload must hold everything replay needs. A Reader replays a checked original prefix. Rechain README, lines 22 to 29 and 70 to 78
Certified tips. Rechain README, lines 100 to 106 · Composed certification
Idempotency window, DuplicateOf, TransactionExpired, fingerprint inputs. Rechain idempotency, lines 13, 43 to 51 and 166 to 204
Workflow files, Rules and Operations, graph owns sequence, retries and recovery. Takt authoring, lines 8 to 59
Node types, Contract required on Remote, SafeUntil, OnExhausted, Capabilities. Workflow schema
Known, Reply, Problem, default task policy, ParticipantContract. Takt types, lines 63 to 74, 165 to 185, 449 to 461 and 482 to 506
Safety contracts and block reasons. Takt memory V1, lines 172 to 195
Retry, timeout and blocking rules. resolve needs a blocked node. Resolving fences the Reactor address. Takt engine, retry_candidate, resolution_task, resolve · Takt adapters, resolve_reactor
A worked Choice, a Remote with Catch, and an Idempotent contract with retries and Pause. Chat send graph · Heavy16 Sequence graph · Sequence rules
Retries reuse saved bytes, origin and sequence. A partial acknowledgement removes the accepted prefix. Reactor README, lines 23 to 29
A timeout cancels nothing and authorizes no replacement effect. Orchestration guide, lines 88 to 90
Physical delivery, acknowledgement and unknown are separate. Orchestration guide
Uncertain effects need explicit reconciliation. Takt README, lines 28 to 30
Design rules for state ownership and remote safety, in the Motoko guide's words. Takt guide, lines 588 to 670
Tests: native checks do not establish lifecycle behavior. Build and recovery tests are still needed for workflows. SDK tests · Takt authoring, lines 137 to 141

Written references for the primers: Rechain · Reactor · Takt. Film transcripts: Rechain · Reactor · Takt.

Examples studied as off-screen evidence and never shown: Shop, RRT Heavy16, the chat fixture and the basic Rechain fixture in ../newstack, and the example apps in ../takt, ../rechain and ../reactor.

Status and limits

  • Crew Cards is a teaching app. Its numbers and diagrams come from a local TypeScript simulator with seeded chains. A deployed cdk-rsx canister is outside the course's scope.
  • npm run test:crew-cards checks simulated commits, refusals, retries, reconciliation, and replay. The storyboards' acceptance checks describe what to validate in a future canister implementation.
  • npm run build:newstack-app regenerates the teaching capture and produces the narration, films, and players.
  • The SDK is an unreleased prototype. Line numbers refer to the pinned commit. Find the item by name if a file has moved on.
  • The reconcile door, the card.for_award read and the rule that a ticket means both an open award and an admitted execution are designs of this course. The SDK supplies the pieces, and no checked example combines them this way.
  • The lessons do not cover upgrades of an app with open workflows, archives, redacted reads, parallel branches, child workflows or event waits. The primers and the orchestration guide cover those.

Editing the drafts

  • Read the narration straight through. Each new term needs a visible object, and each sentence should move a design decision forward.
  • Walk the beats with the narration muted. At each cue the named object is in frame, the cause comes before its effect, and the next beat starts from the visible result.
  • If a sentence begins to explain how a library enforces a rule, replace it with what the architect decides and what they can observe.
  • Check any changed number against the worked day before saving.
  • Keep scene and beat IDs stable through wording edits.