Overview
Build reactive state for .NET: update a value, and the computations that depend on it update too.
- Signals hold values you can read and write.
- Memos derive values from tracked reads.
- Effects run when a value they read changes.
- Bindings copy one fixed signal or memo into an external target.
A taste
open Ranvier
let graph = new Graph ()
let doubled =
graph.Run (fun () ->
let count = createSignal 1
let doubled = createMemo (fun _ -> count.Value * 2)
createEffect (fun () -> printfn "doubled = %d" doubled.Value)
count.Value <- 5
doubled)
doubled = 2
doubled = 10
Choose a starting point
- Derived state: Signals, Memos, Effects and Bindings connect writable state to cached calculations and external targets.
- Async work: Async and pending covers requests, streams, loading, errors and dispatch. Boundaries supply values while a request is unavailable.
- Collections: Projections preserve rows by key; direct edits update them without replacing the source list.
- UI: Views and Server rendering share templates across browser DOM, server HTML and hydration. C# bindings connect native XAML view models to the graph.
- Lifetime: Roots and Cleanup stop computations and subscriptions when their owner ends.
Targets
net10.0, netstandard2.1 and Fable (JavaScript).
Guide
- Installation: preview packages, supported targets and Native AOT.
- Getting started: a short walkthrough of a reactive graph.
- Examples: complete F# and C# console and Avalonia applications for real workflows.
- Ranvier or Adaptive for a desktop app?: a blog walkthrough with a complete F# window and comparisons of state, bindings, collections, async work and lifetime.
- Graphs, Signals, Memos and Effects: the core primitives.
- Fixed-dependency bindings: copy one signal or memo into a target, with batching and owner disposal.
- Equality: graph defaults and typed comparers for individual nodes.
- Roots and owners, Cleanup, Untrack and Batch: lifetime and tracking controls.
- Editable values and Drafts: local edits over upstream state.
- Async and pending: in-flight values, async memos, boundaries, and threading.
- Debounce and throttle: control admission before downstream or async work starts.
- Streams: fold a stream's items into a node that restarts when its inputs change.
- Testing async state: deterministic tests that decide when each flight lands.
- Blazor Server: one graph per circuit, with
ThreadAffinity.Serialised. - Collections: projections, editable keyed sources, change readers, lookups and collection views.
- Aggregates: totals, counts and folds over collection rows.
- Forms: records of reactive fields and batched resets.
- Tracing: why a node ran or did not run, where it was created, and the graph as it stands.
- Persisted inputs: restore signals and collections before building the graph.
- MCP inspection: expose selected values and messages from a running application.
- Input journal and replay: record a graph's external inputs, and replay them to reproduce or re-enact a run.
- Replay a production shop bug: capture an async race untraced, then reproduce it offline with tracing.
- Signal maps: how to read the live graph maps beneath the examples, and how to write one.
- Troubleshooting: each exception message and common symptom, with its cause and fix.
- Migrating from Elmish: an MVU model read through selector memos, one view at a time.
- Queries and mutations: shared remote queries, page leases and atomic reconciliation of partial data.
- C#: C# factories, XAML bindings and reactive commands.
- Views and Server rendering: template components for the browser DOM, server HTML and hydration, in the alpha
Ranvier.Viewpackages.
Packages in other repositories
The core packages are built here. The packages below build on them in their own repositories:
| Repository | Packages | Documentation |
|---|---|---|
| Ranvier.View | Ranvier.View, Ranvier.View.Dom, Ranvier.View.Anime, Fable.Ranvier.Anime, Ranvier.Analyzers | Views, server rendering, motion and analyzers |
| Ranvier.Css | Ranvier.Css, Ranvier.Css.Bindings, Ranvier.Css.View, Ranvier.Css.Build | Typed CSS |
| Ranvier.Persistence | Ranvier.Persistence, Ranvier.Persistence.Marten, Ranvier.Persistence.KurrentDB | Persisted inputs and stores |
Source and package status
The guide describes the current source. Installation distinguishes published previews from local package builds. Roadmap lists implemented areas and ideas under consideration.