Todo REST API with streams, durable topics, and cron — migrated from the Motia todo-app example to iii-sdk@0.11.0 using the Motia → Node migration guide.
| Area | Pattern |
|---|---|
| HTTP | registerFunction + registerTrigger with leading / paths, status_code responses, path_params, query_params |
| State | iii.trigger({ function_id: 'state::get' | 'state::set' | 'state::delete' | 'state::list', ... }) |
| Streams | stream::set / stream::delete mirror on stream_name: 'todo', group_id: 'all-todos' |
| Queues | iii::durable::publish + durable:subscriber triggers (notifications, analytics, completion workflow, achievements) |
| Cron | 7-field expression: hourly stats, daily cleanup |
No zod, no wrappers — plain iii.trigger() calls and TypeScript types.
- Bun
iiiengine v0.11.x withiii-http,iii-state,iii-queue,iii-cron,iii-stream,iii-exec(seeiii-config.yaml)
cd quickstart/examples/todo-app
pnpm install --ignore-workspace
iii --config ./iii-config.yamlThe iii-exec worker launches bun run src/main.ts with watch on src/**/*.ts.
HTTP listens on http://127.0.0.1:3000.
| Method | Path | Function ID |
|---|---|---|
POST |
/todos |
todo::create |
GET |
/todos (optional ?status=) |
todo::list |
GET |
/todos/:id |
todo::get |
PATCH |
/todos/:id |
todo::update |
DELETE |
/todos/:id |
todo::delete |
GET |
/todo-stats |
todo::stats |
bash test-todo-flow.shcurl -X POST http://127.0.0.1:3000/todos \
-H 'content-type: application/json' \
-d '{"title":"Buy milk","priority":"high"}'- Hourly stats snapshot —
0 0 * * * * *(todo::daily-stats-cron) - Daily cleanup (archive completed > 7 days) —
0 0 0 * * * *(todo::cleanup-cron)
Same names as the original Motia flow:
todo-created, todo-updated, todo-completed, todo-deleted,
track-analytics, cleanup-completed, notification-sent, achievement-unlocked.
pnpm run build
pnpm run startSwap the iii-exec command in iii-config.yaml to the bundled output for production.
Example code: Apache-2.0 (matches the rest of this monorepo outside engine/).