@batono/core
v0.0.31
Published
The protocol engine behind Batono — server-driven UI interactions for the web.
Downloads
406
Maintainers
Readme
@batono/core
The protocol engine behind Batono — server-driven UI interactions for the web.
@batono/core is the foundation of the Batono protocol. It provides the InteractionGraph — a self-contained,
serializable description of UI interactions. The backend defines structure and behavior. The frontend renders and executes — nothing more.
Features
- ✅ No dependencies
- ✅ Backend-driven flow definitions
- ✅ Automatic flow gathering — no manual registration
- ✅ Graph instance tokens (
$graph) for response consistency - ✅ Sequential and parallel action flows out of the box
- ✅ Partial re-rendering via scopes
- ✅ Fully typed with TypeScript
Installation
npm install @batono/coreBasic Usage
import {bt} from '@batono/core'
import {RequestAction, NavigateAction} from '@batono/ui'
const deleteUser = bt.defineFlow(
new RequestAction('DELETE', '/users/42')
)
const graph = bt.graph(
bt.rows(
bt.row(
bt.action('Delete User', deleteUser)
)
)
)
res.json(graph)Documentation
| Topic | Description |
|-------------------------------------------------|------------------------------------------------------------------------|
| flows.md | defineFlow, sequential, parallel, withPayload |
| graph.md | InteractionGraph, output format, token generation |
| create-buildable.md | createBuildable, schema builder s, custom definitions |
| when.md | Conditional values with when, .else(), .elseif() |
| scope.md | Partial re-rendering with createScope, ScopedBuildable, scopable |
Design Goals
- Protocol over implementation —
@batono/coredefines the contract, not the UI - Flows are first-class — defined once, referenced anywhere, gathered automatically
- No magic — everything is explicit, serializable, and predictable
- Extensible — build custom
IBuildableimplementations on top of the core primitives - Package-boundary safe — internal symbols prevent accidental misuse across package boundaries
- Stateless by design — no server-side UI state required
License
MIT
