← 返回
未分类 中文

iii-reactive-backend

Builds reactive real-time backends on the iii engine. Use when building event-driven apps where state changes automatically trigger side effects, clients rec...
在 iii 引擎上构建响应式实时后端。适用于事件驱动应用,状态变化自动触发副作用,客户端...
rohitg00 rohitg00 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 374
下载
💾 0
安装
1
版本
#latest

概述

Reactive Backend

Comparable to: Convex, Firebase, Supabase, Appwrite

Key Concepts

Use the concepts below when they fit the task. Not every reactive backend needs every trigger or realtime surface shown here.

  • State is the "database" — CRUD via state::set, state::get, state::update, state::delete, state::list
  • State triggers fire automatically when any value in a scope changes
  • Side effects (notifications, metrics, stream pushes) are wired reactively, not imperatively
  • Streams deliver real-time updates to connected clients

Architecture

HTTP CRUD endpoints
  → `state::set`, `state::update`, `state::delete` (writes to 'todos' scope)
    ↓ (automatic state triggers)
    → on-change → stream::send (push to clients)
    → update-metrics → state::update (aggregate counters)

HTTP GET /metrics → reads from 'todo-metrics' scope
WebSocket clients ← stream 'todos-live'

iii Primitives Used

PrimitivePurpose
-----------------------------------------------------------------------------------------------
registerWorkerInitialize the worker and connect to iii
registerFunctionCRUD handlers and reactive side effects
trigger({ function_id: 'state::...', payload })Database layer
registerTrigger({ type: 'state', config: { scope } })React to any change in a scope
trigger({ ..., action: TriggerAction.Void() })Fire-and-forget stream push to clients
registerTrigger({ type: 'http' })REST endpoints

Reference Implementation

See ../references/reactive-backend.js for the full working example — a real-time todo app with

CRUD endpoints, automatic change broadcasting via streams, and reactive aggregate metrics.

Common Patterns

Code using this pattern commonly includes, when relevant:

  • registerWorker(url, { workerName }) — worker initialization
  • trigger state::set, state::get — CRUD via state module
  • registerTrigger({ type: 'state', function_id, config: { scope } }) — reactive side effects on state change
  • Event argument destructuring in reactive handlers: async (event) => { const { new_value, old_value, key } = event }
  • trigger({ function_id: 'stream::send', payload, action: TriggerAction.Void() }) — push live updates to clients
  • const logger = new Logger() — structured logging inside handlers

Adapting This Pattern

Use the adaptations below when they apply to the task.

  • State triggers fire on any change in the scope — use the event argument (new_value, old_value, key) to determine what changed
  • Multiple functions can react to the same scope independently (on-change and update-metrics both watch todos)
  • Stream clients connect via ws://host:port/stream/{stream_name}/{group_id}
  • Keep reactive functions fast — offload heavy work to queues if needed

Pattern Boundaries

  • If the request focuses on registering external/legacy HTTP endpoints via registerFunction (especially with endpoint lists like { path, id } plus iteration), prefer iii-http-invoked-functions.
  • Stay with iii-reactive-backend when state scopes, state triggers, and live stream updates are the core requirement.

When to Use

  • Use this skill when the task is primarily about iii-reactive-backend in the iii engine.
  • Triggers when the request directly asks for this pattern or an equivalent implementation.

Boundaries

  • Never use this skill as a generic fallback for unrelated tasks.
  • You must not apply this skill when a more specific iii skill is a better fit.
  • Always verify environment and safety constraints before applying examples from this skill.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 11:34 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Kubernetes Skills

rohitg00
针对 Kubernetes 仪表板和 Web UI 的浏览器自动化。适用于与 Kubernetes Dashboard、Grafana、ArgoCD UI 或其他 Web 界面交互。需要设置 MCP_BROWSER_ENABLED=true
★ 1 📥 3,159
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,692
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,938