Skip to content

Introduction

Welcome to the Marten documentation! Join our friendly Discord channel to learn more with us and the community!

What is Marten?

Marten is a .NET library for building applications using a document-based approach and Event Sourcing. We're committed to removing boilerplate work and letting you focus on delivering business value.

Under the hood, we're using Postgresql, changing it into:

The basis for our work is the unique Postgresql support for JSON storage.

Thanks to that and other Postgresql capabilities, Marten brings strong consistency into those approaches.

Marten is feature-rich and focused on accessibility, and we do that without compromising performance.

Whether you're working on a new greenfield project or a bigger enterprise one, Marten will help you to quickly iterate and evolve your system with a focus on business value.

Main features

Some of the highlights of the main Marten features:

FeatureDescription
Document StorageMarten allows you to use Postgresql as a document database. That makes development much more flexible, as you store your entities as JSON. It helps you to evolve your data model easily.
Event storeAccordingly, you can also use Postgresql as a full-fledged event store for Event Sourcing. This approach can help you capture all the business facts in your system.
Strong consistencyMarten uses Postgresql transactions capabilities to allow you to have trust in your storage engine. That applies to both document-based and Event Sourcing approaches.
Advanced Linq querying capabilitiesYou can filter your documents using the LINQ queries. That's the most popular .NET way of doing that. We also support full-text search and custom SQL queries.
Events ProjectionsMarten has a unique feature to store both events and read models in the same storage. You can write your projections and get flexibility in interpreting your events. Projections can be applied in the same transaction as an appended event or asynchronously.
Automatic schema managementWe know that schema management in relational databases can be tedious, so that's why we're offering to deal with it for you. Thanks to the simpler storage with JSON format, that gets much easier.
Flexible indexing strategiesTo get better performance, you can define various indexing strategies to fit your usage characteristics. Document-based approach doesn't have to mean schema-less!
ASP.NET integration and Command Line toolingWe provided a set of build-in helpers to get you quickly integrated with Marten in your applications without much of a hassle.
Built-in support for Multi-tenancyBeing able to have data isolation for different customers is an essential feature for a storage engine. We provide multiple ways of dealing with multi-tenancy: multiple databases, different schemas, and sharded-table. Those strategies apply to both document and event store parts.

.NET Version Compatibility

Marten aligns with the .NET Core Support Lifecycle to determine platform support. Marten currently targets net6.0, net7.0, net8.0.

Marten Version.NET Framework.NET Core 3.1.NET 5.NET 6.NET 7.NET 8
7
6
5
4
3

Postgres Version Compatibility

Marten aligns with the PostgreSQL Support Lifecycle to determine platform support. Marten currently targets versions 12 and onwards.

History and origins

Marten was originally built to replace RavenDB inside a very large web application that was suffering stability and performance issues. The project name Marten came from a quick Google search one day for "what are the natural predators of ravens?" -- which led to us to use the marten as our project codename and avatar.

A Marten

The Marten project was publicly announced in late 2015 and quickly gained a solid community of interested developers. An event sourcing feature set was added, which proved popular with our users. Marten first went into a production system in 2016 and has been going strong ever since. The v4 release in 2021 marks a massive overhaul of Marten's internals and introduces new functionality requested by our users to better position Marten for the future.

Released under the MIT License.