Function: createPraxisDBStore()

August 8, 2026 ยท View on GitHub

@plures/praxis


@plures/praxis / index / createPraxisDBStore

Function: createPraxisDBStore()

createPraxisDBStore<TContext>(db, registry, initialContext?, onRuleError?): PraxisDBStore<TContext>

Defined in: src/core/pluresdb/store.ts:615

Create a new PraxisDBStore

Type Parameters

TContext

TContext = unknown

Parameters

db

PraxisDB

The PraxisDB instance to use

registry

PraxisRegistry<TContext>

The PraxisRegistry for rules and constraints

initialContext?

TContext

Optional initial context

onRuleError?

RuleErrorHandler

Optional error handler for rule execution errors

Returns

PraxisDBStore<TContext>

PraxisDBStore instance

Example

const db = createInMemoryDB();
const registry = new PraxisRegistry();
const store = createPraxisDBStore(db, registry);

await store.storeFact({ tag: "UserLoggedIn", payload: { userId: "alice" } });
await store.appendEvent({ tag: "LOGIN", payload: { username: "alice" } });