Browse the documentation

Installation

Add the SDK, register NetlyDB, and know what an embedded host starts.

Requirements

  • .NET 10. NetlyDB.SDK targets net10.0.
  • Supported environments: Linux x64, Windows x64 and macOS on Apple silicon. Android arm64 is a build target only: it compiles, and nothing has run it. No other environment is claimed.
  • Memory for the data you store: collections are held in memory and persisted to disk.

Add the package

dotnet add package NetlyDB.SDK

NetlyDB.SDK is the one package you install. The engine, hosting, licensing, the REST API, the MCP server and the Management UI ship inside it. The optional modules need a few third-party packages that the SDK does not pull in; see Packages.

Quick start

A console application that stores a document and reads it back. This is the quick start shipped with the package; it is compiled and run against every release before publication.

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NetlyDB.Core.Stores;
using NetlyDB.SDK.Extensions;

var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddNetlyDB(options => options.StorageRoot = "netlydb-data");

using var host = builder.Build();
await host.StartAsync();

var people = host.Services.GetRequiredService<IDocumentStore>().GetCollection<Person>("People");
var id = people.Add(new Person { Name = "Ada", Age = 36 }) ?? throw new InvalidOperationException("Not stored.");
Console.WriteLine($"Stored {people.GetById(id)!.Data.Name}");

await host.StopAsync();

public class Person
{
    public Guid Id { get; set; }
    public string Name { get; set; } = "";
    public int Age { get; set; }
}

The data lives under netlydb-data, relative to the working directory. Start the host before using a collection: NetlyDB's hosted services - license enforcement, time-to-live cleanup and the memory governor among them - run as part of it.

What an embedded host starts

Embedded means no separate server process. It does not mean no network listener at all. With default options, AddNetlyDB() starts:

  • an internal event broker on localhost:9023 (BrokerHost, BrokerPort), used for logging and operational events;
  • a gRPC listener on port 9025 (EnableGrpcHosting, GrpcPort), used by cluster replication.
The listeners an embedded host starts by default, and the ports modules open only when registered your process after AddNetlyDB() DB event broker localhost:9023logging and operational events gRPC :9025cluster replication; can be turned off REST :9020 · UI :9021 · MCP :9026 only when you register them Embedded means no separate server process, not no network listener at all. Unclustered listeners bind to loopback.
What listens after AddNetlyDB() with default options, and the ports that stay closed until you register a module.

A single-node application that does not replicate can turn gRPC hosting off with options.EnableGrpcHosting = false. The optional modules - REST API, Management UI and MCP server - open their own ports only when you register them.

Next: define a document type and register a collection.

An unhandled error has occurred. Reload X

Reconnecting

Restoring the connection to the server...

Still trying

Next attempt in seconds

Connection lost

We could not reach the server.