Skip to main content

store

@rotorsoft/act-root


@rotorsoft/act-root / act/src / store

Variable: store

const store: (adapter?) => Store

Defined in: libs/act/src/ports.ts:169

Gets or injects the singleton event store.

By default, Act uses an InMemoryStore suitable for development and testing. For production, inject a persistent store like PostgresStore from @rotorsoft/act-pg before building your application.

Important: Store injection must happen before creating any Act instances. Once set, the store cannot be changed without restarting the application.

Parameters

adapter?

Store

Optional store implementation to inject

Returns

Store

The singleton store instance

Examples

import { store } from "@rotorsoft/act";
const s = store();
import { store } from "@rotorsoft/act";
import { PostgresStore } from "@rotorsoft/act-pg";

store(new PostgresStore({
host: "localhost",
port: 5432,
database: "myapp",
user: "postgres",
password: "secret",
}));

See