logo   async
machine.dev

/examples/README.md

Examples

Headers link to actual examples.

aRPC

aRPC client and server example.

  • #rpc #client #server #template
  • origin

Basic

Very basic, yet modern example of asyncmachine-go.

  • #relations #handlers #async #negotiation #auto

CLI

go-arg based CLI example.

  • #template #relations #handlers #template

CLI Daemon

go-arg based CLI with an aRPC daemon example.

  • #template #relations #handlers #arpc #payload #template

Mach Template

Copy-paste boilerplate to set up a new machine.

  • #template #handlers #telemetry #repl #relations #generator #negotiation #multi #template

Tree State Source

Single writer distributed to multiple readers in a tree structure.

  • #relations #negotiation #auto #arpc #otel #metrics #grafana #generator #data
  • origin

TUI

cview based TUI app example.

  • #relations #handlers #cview #ui #global-handlers

WASM

aRPC WASM architecture with a simple chat.

  • #relations #handlers #arpc-handlers #arpc #relay #ui #websocket

WASM Workflow

WebWorker WASM workflow example.

  • #relations #handlers #arpc-handlers #arpc #relay #websocket #webworkers #payload

DAG Dependency Graph

Sync and async DAG / dependency graph example.

  • #relations #handlers #async #auto #dependency-graph

Fan Out Fan In

Distributing work to multiple worker states and collecting the results.

  • #relations #handlers #async #auto #concurrency

FSM - Finite State Machine

Classic FSM example.

  • #relations #handlers #negotiation #auto
  • origin

NFA - Nondeterministic Finite Automaton

Classic NFA example.

  • #relations #handlers #async #multi
  • origin

PATH Watcher

Watch file system paths for changes.

  • #relations #handlers #async #negotiation #multi
  • origin

Pipes

How to pipe states between state machines.

  • #handlers #composition
  • origin

Raw Strings

Very basic and old school example of asyncmachine-go.

  • #relations #handlers #async #negotiation #auto
  • origin

Relations Playground

Code from the relations playground.

REPL

REPL boilerplate.

  • #arpc #repl #template
  • origin

Subscriptions

Very basic example of waiting for states.

Temporal Expense Workflow

Workflow ported from Temporal.

  • #relations #handlers #async #negotiation #auto #temporal
  • origin

Temporal FileProcessing Workflow

Workflow ported from Temporal.

Benchmarks

Benchmark State Source

Benchmark adding tree nodes to the state source example.

  • #docker #go-wrt #caddy
  • origin

Benchmark gRPC

Benchmark aRPC vs gRPC.

  • #relations #handlers #negotiation #arpc #grpc
  • origin

Benchmark libp2p PubSub

Very old benchmark of libp2p pubsub ported to asyncmachine-go.

  • #relations #handlers #async #negotiation #libp2p

Demos

am-dbg Debugger

Interactively use the TUI debugger with data pre-generated by a secai bot:

go run github.com/pancsta/asyncmachine-go/tools/cmd/am-dbg@latest \
  --import-data https://pancsta.github.io/assets/asyncmachine-go/am-dbg-exports/secai-cook.gob.br \
  mach://cook

Apps

asyncmachine-go synchronizes state for the following projects:

monorepo

Go back to the monorepo root to continue reading.