Extracted from uncaged monorepo (oc-xiaoju/uncaged). Resolves oc-xiaoju/uncaged#224. - @uncaged/ograph: CF Worker engine (events, projections, reactions) - @uncaged/ograph-cli: CLI for managing OGraph instances - Removed @uncaged/oid dependency (unused) - 116 tests, all passing - CI: GitHub Actions 小橘 🍊(NEKO Team)
1.6 KiB
1.6 KiB
OGraph
Event Sourcing + Projection + Reaction engine on Cloudflare Workers.
Part of the Uncaged ecosystem.
Packages
| Package | Description | npm |
|---|---|---|
@uncaged/ograph |
CF Worker engine — events, projections, reactions | |
@uncaged/ograph-cli |
CLI for managing OGraph instances |
Core Concepts
- Event — Immutable facts with typed properties and object references
- Projection — Derived state computed incrementally from events via reducers
- Reaction — Side effects triggered by projection state changes (webhooks, event emission, handlers)
Quick Start
npm install -g @uncaged/ograph-cli
ograph deploy # Deploy to Cloudflare Workers
ograph event-def add # Define event types
ograph event add # Emit events
ograph projection list # Query projections
Development
npm install
npm test # Run all tests
cd packages/engine && npm run dev # Local dev server
Architecture
- D1 for storage (events, projections, reactions)
- Hono for API routing
- Incremental reduce — projections track
last_event_idfor O(delta) updates - Dynamic handlers —
new Function()sandboxed execution with emit/log/kv API injection
License
MIT
Built by 小橘 🍊 & 小墨 🖊️ — NEKO + KUMA Teams