Nexus.Stratum.Browser (0.1.0-alpha.2)

Published 2026-06-14 06:51:03 +00:00 by nexus-ci

Installation

dotnet nuget add source --name NEXUS --username your_username --password your_token 
dotnet add package --source NEXUS --version 0.1.0-alpha.2 Nexus.Stratum.Browser

About this package

STRATUM browser durable backings (OPFS) for Blazor WASM, over the Nexus.Stratum event-store contract.

Nexus.Stratum.Browser

The browser durable backings for STRATUM, the NEXUS storage abstraction. This package adds an OPFS (Origin Private File System) event store for Blazor WebAssembly, behind the same EventStore<'e> contract as the in-memory and filesystem backings in the core Nexus.Stratum package.

  • F# on .NET 10. License: AGPL-3.0-or-later.
  • Depends on Nexus.Stratum (the core contracts); bind both to an exact pre-release pin.
<PackageReference Include="Nexus.Stratum" Version="0.1.0-alpha.7" />
<PackageReference Include="Nexus.Stratum.Browser" Version="0.1.0-alpha.2" />

What it is

One TOML file per event (<stream>/<uuid>.toml) — the same on-disk shape as the filesystem backing — but the IO runs through a JS module (stratum-opfs.js) reached over IJSRuntime. The JS module ships as a static web asset, so a consuming Blazor app collects it automatically (no manual <script> wiring); it loads lazily on first store use.

Usage

BrowserOpfs.create is a synchronous factory; every store operation is fully async (the single-threaded WASM main thread deadlocks on a blocking interop wait, so nothing blocks on a JS promise).

open Nexus.Stratum

// `js` is the Blazor IJSRuntime (inject it); `codec` is your PayloadCodec<'e>
// (see the Nexus.Stratum README for how to build one).
let store : EventStore<Vital> =
    match StreamName.create "vitals" with
    | Ok stream -> BrowserOpfs.create js stream codec
    | Error msg -> failwith msg     // validate the stream name once, at startup

Composing with other backings. To pair OPFS with an in-memory read-source (the recommended shape for responsive reads + durable writes), build a composite with Composite.createAsync, never Composite.create: create blocks on hydration and will deadlock the WASM main thread.

let! composite = Composite.createAsync config   // AWAIT — do not use Composite.create on WASM

Current limits (tracked follow-ups)

  • Subscribe is in-process (this runtime). Cross-tab notification via BroadcastChannel is a follow-up; the contract already promises cross-tab delivery once it lands.
  • The same-id / idempotence check is a read-then-write spanning awaits (no synchronous lock can cross interop), so under genuinely concurrent same-id appends it is best-effort. In a composite the in-memory read-source is the refusal gate, so this backing rarely sees a conflicting append.
  • Not verifiable headless. Conformance to the STRATUM store-law suite is exercised in a real Blazor WASM host (see tests/Browser/ in the repo).

Where to learn more

  • API surface — this package ships per-member XML docs (lib/net10.0/*.xml); your IDE shows them on hover, and agents can read them with nuget-xml.sh Nexus.Stratum.Browser <version> --surface.
  • Concepts, codec authoring, quickstart — the core Nexus.Stratum README.
  • Design rationalemodel.fsx (living, decision-cited) and the NEXUS CHRONICON events tagged stratum.

Dependencies

ID Version Target Framework
Nexus.Stratum 0.1.0-alpha.7 net10.0
FSharp.Core 10.1.301 net10.0
Microsoft.JSInterop 10.0.9 net10.0
Details
NuGet
2026-06-14 06:51:03 +00:00
6
Ivan The Geek
20 KiB
Assets (2)
Versions (2) View all
0.1.0-alpha.2 2026-06-14
0.1.0-alpha.1 2026-06-14