Skip to content

nstoredev/NStore

Repository files navigation

logo

NStore

(Yet Another) Opinionated Event Sourcing Library

NStore started as a playground for experimenting with .net Standard, async and a simple API for a Sql/NoSql backed EventStore.

After years of experience running NEventStore in production we wrote NStore from scratch with a simpler and extensible API.

CI Status

Build server Platform Build Status
AppVeyor Windows Build status
GH Actions Linux Build status
Azdo Windows Build status

Quickstart

Setup the streams factory

var streams = new StreamsFactory(new InMemoryPersistence());

open the stream

var post = streams.Open("post/123");

append new data

await post.AppendAsync(new Favorited("users/200", DateTime.UtcNow));

read the stream

await post.ReadAsync(chunk =>
{
    Console.WriteLine($"{chunk.PartitionId} #{chunk.Index} => {chunk.Payload}");
    return Subscription.Continue;
});

Process the stream

var favs = await post.AggregateAsync<UniqueFavs>();

Console.WriteLine($"{favs.Count} users added '{post.Id}' as favorite");

Full source at src/NStore.Quickstart/Program.cs


Learn

The source comes with a Sample App to illustrate some basic stuff you can do.

Status

In production (MongoDB & SqlServer) since 2017 on two major products.