npm.io
0.15.1 • Published 3d ago

@nwire/store-file

Licence
MIT
Version
0.15.1
Deps
1
Size
14 kB
Vulns
0
Weekly
1.0K

@nwire/store-file

File-snapshot ActorStore + ProjectionStore — survives process restart, no DB.

What it does

Persists actor state and projection rows to a single JSON file. Writes are debounced (50 ms) to coalesce bursts; tenant-partitioned. Not a production database — @nwire/mongo (or future -postgres, -dynamodb) for prod. Useful for dev/CI without infrastructure.

Install

pnpm add @nwire/store-file

Quick start

import { FileSnapshotStore, FileSnapshotProjectionView } from "@nwire/store-file";
import { createApp } from "@nwire/forge";

const store = new FileSnapshotStore("./data/snapshot.json");
const projView = new FileSnapshotProjectionView(store);

const app = createApp("learnflow", {
  modules,
  actorStore: store,
  projectionStore: projView,
});

API surface

  • FileSnapshotStore(path) — implements ActorStore.
  • FileSnapshotProjectionView(store) — implements ProjectionStore against the same snapshot.

When to use

Dev environments without a database, CI pipelines that need persistence across test phases, tiny single-node apps.

Within nwire-app

For developers using this package as part of the Nwire stack — register it via app.use(...) or it auto-wires when you compose createApp({ modules }).

import { createApp } from "@nwire/forge";

const app = createApp({
  /* ...config... */
});
// Adapter/plugin wiring happens here when applicable.

Keywords