← Back to DAGDA | Support | Source: https://github.com/junoddev/temporal-payments-workshop
Skip to content

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

moving money without losing your mind

A Temporal workshop for fintechs — fintech_devcon 2026 Tue, Aug 4 · 10:30am MT · Sheraton Denver · Aaron Junod, Trabian

We build a payment orchestrator that survives crashes, retries without double-charging, compensates when the bank says no, and waits for a human when the amount is big — and we break it on purpose, live, to prove it.


⚡ Do this BEFORE the workshop (5 minutes, hotel wifi is a lie)

You need Node 20+, pnpm 9+, and the Temporal CLI:

# macOS
brew install temporal
# other platforms: https://docs.temporal.io/cli#install

git clone https://github.com/junoddev/temporal-payments-workshop
cd temporal-payments-workshop
pnpm install
pnpm preflight   # ✅-checks node, pnpm, temporal cli

No laptop setup? Open this repo in GitHub Codespaces (badge: Code → Codespaces → Create) — the devcontainer installs everything, including the Temporal CLI.

🚀 Running it (three terminals)

# terminal 1 — temporal server + web ui on http://localhost:8233
temporal server start-dev

# terminal 2 — everything else: bank + ledger, worker, dashboard
pnpm dev

# terminal 3 — you
pnpm transfer 50.00

pnpm dev starts three processes:

process what where
services mock bank + append-only ledger (Hono) http://localhost:4000
worker Temporal worker — workflows + activities task queue payments
web workshop dashboard (React Router) http://localhost:3000

Open the dashboard (localhost:3000) and the Temporal Web UI (localhost:8233) side by side. The dashboard shows your view (ledger, bank statement, balances); the Temporal UI shows the orchestrator's view (event history, retries, replays).

💸 The chaos amounts

The mock bank misbehaves based on the cents of the amount, so the whole room can break things in sync:

amount the bank... teaches
$50.00 behaves the happy path
$50.07 posts the money, then returns 500 retry ⇒ double-charge
$50.09 posts the money, then hangs past your 30s timeout the ambiguous timeout
$50.13 rejects it (compliance says no) compensation / sagas
$2500.00 fine — but it's over the review limit signals: human approval

🤖 Going solo? Let Claude tutor you

Doing this outside the live session? Open the repo in Claude Code and say "be my workshop tutor." It reads CLAUDE.md + tutorial/ and walks you through every segment Socratically — planting each idea, having you run it, and never just handing you the answer. You still write the code; it guides.

🧗 The exercises

Work through exercises/ in order. Fall behind? Jump to the finished state of any exercise:

git stash && git checkout checkpoint-03   # for example
checkpoint exercise kills failure mode
checkpoint-01 run the happy path —
checkpoint-02 kill the worker mid-transfer 02 dropped transaction
checkpoint-03 make sendToBank idempotent 01 double-charge · 04 ambiguous timeout
checkpoint-04 add the compensation path 03 partial saga
checkpoint-05 approval signals (stretch) —

main is the starter state. checkpoint-01/02 match it (those exercises change no code); 03–05 add the fixes cumulatively.

🗺 Repo map

apps/services   the outside world: mock bank + ledger (Hono, one process)
apps/worker     the temporal side: workflows.ts, activities.ts, worker.ts + CLI
apps/web        the dashboard (React Router) — loaders query temporal directly
packages/shared types, chaos amounts, policy constants
exercises/      the five guided exercises

Useful commands:

pnpm transfer 50.13 --from alice --to carol   # start a transfer
pnpm approve transfer-<id> [--deny]           # signal a waiting workflow
pnpm ledger                                   # ledger vs bank statement, in your terminal
pnpm reset                                    # wipe bank + ledger state

🧨 Things that break replay (read this before editing workflows.ts)

Workflow code must be deterministic — Temporal recovers a crashed workflow by replaying its history, and every decision must come out identical. The TS SDK sandbox catches most violations with an error containing determinism — if you see one, you did one of these:

  • ❌ Date.now(), new Date() → use workflow.now()
  • ❌ Math.random(), crypto.randomUUID() → use workflow.uuid4(), or pass values in
  • ❌ fetch / db / fs / queue calls in a workflow → that's what activities are for
  • ❌ setTimeout → use workflow.sleep() (durable — survives restarts!)
  • ❌ mutating module-level globals, iterating Set/Map of non-deterministic content
  • ✅ activities can do all of the above freely — they run in plain Node

🧯 Troubleshooting

  • pnpm dev shows red on services → is something else on :4000?
  • worker can't connect → is temporal server start-dev running? (pnpm preflight)
  • stuck workflow from a previous run → terminate it in the Temporal UI (:8233), or pnpm reset + restart temporal server start-dev for a clean slate.
  • dashboard shows "no worker?" → that's not an error, that's exercise 02.

📚 Take it home

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages