Skip to content

Latest commit

 

History

History

examples

Folders and files

README.md

Examples

Runnable Dex samples you can start on your machine. Each language application hosts a Worker plus an HTTP controller so you can start Flows, publish to Channels, and call RPCs locally.

You only need two small steps:

  1. Start Dex and one language example server.
  2. Start the examples playground, pointed at the example-server HTTP port and the Dex web UI port printed in step 1.

Step 1 — Dex and one example server

In one terminal, start Dex. In another, start one language application. dexcli dev starts a Dex server with a web UI. Ports are dynamic; use the addresses it prints.

Pick a language. Commands match that language's README.

Go — from go/ (README):

dexcli dev
make bins
./dex-samples

Java — from java/ (README):

dexcli dev
./gradlew bootRun

Python (async) — from python/ (README):

dexcli dev
uv sync --locked
uv run --frozen python main.py

Python (sync) — from python/ (README):

dexcli dev
uv sync --locked
uv run --frozen python sync-python/main.py

TypeScript — from typescript/ (README):

dexcli dev
npm install
npm start

Rust — from rust/ (README):

dexcli dev
cargo run --locked

Default example-server ports:

Service Default
Example HTTP 8080 (Python sync 8081)
Example Worker 8803 (Python sync 8804)

Dex ports are whatever dexcli dev prints.

Each language README lists env overrides for those addresses. Entity Store needs PostgreSQL plus dexcli dev --attribute-store-config; see entity-store/.

Step 2 — Examples playground Web UI

The playground Web UI is optional but recommended. From playground/ (README), point the page at the example HTTP port and the Dex web UI port from step 1:

./start.sh --port 3333 --example-server http://127.0.0.1:8080 --dex-web http://127.0.0.1:8802

Replace 8802 with the web UI port printed by dexcli dev. For Python sync, pass --example-server http://127.0.0.1:8081. ./start.sh with no flags defaults the example server to 8080 and the playground to 3333; still pass --dex-web with the printed port.

The script opens a browser tab to http://127.0.0.1:3333. You can also change the example server and Dex web UI URLs in the page header.

The Go Deal DSL application and Python-only AI Agent have their own UIs; they are not on the shared playground. Deal DSL Flow implementations also run in Java, Python, TypeScript, and Rust. The AI Agent UI reads the session snapshot and live events through the Dex Agents browser stream helpers.

Directory organization

Each language tree groups Flows the same way. HTTP controllers use these prefixes (some Worker-only examples have no HTTP surface):

Category Purpose HTTP prefix
products Real-world business scenarios /products/<kebab-name>/...
patterns Durable workflow design patterns /patterns/<kebab-name>/...
primitives One minimal example per Dex primitive /primitives/<kebab-name>/...

Shared primitives are step, attribute, channel, timer, rpc, subflow, and client-apis.

Path Role
go/ Go Worker + HTTP (8080 / 8803)
java/ Java Worker + HTTP (8080 / 8803)
python/ Python async Worker + HTTP (8080 / 8803)
python/sync-python/ Python sync Worker + HTTP (8081 / 8804)
typescript/ TypeScript Worker + HTTP (8080 / 8803)
rust/ Rust Worker + HTTP (8080 / 8803)
playground/ Shared static UI for the HTTP controllers
entity-store/ PostgreSQL + Attribute Store YAML for the user-profile pattern

Language-specific extras live next to those trees: the Go Deal DSL UI, PostgreSQL catalog, and dex-deal-dsl binary; and the Python AI Agent UI. The Deal DSL interpreter itself is implemented across all five language SDK examples.

Each language README has setup, env overrides, and verify steps. CI workflows are .github/workflows/examples-*-ci.yml.