Skip to content

Installation & Setup

Before starting, ensure you have:

  • .NET SDK (supports .NET 8.0, 9.0, and 10.0+)
  • PostgreSQL database (for persistent event store)
  • dbmate (optional, but highly recommended for migration management)

Add the NuGet package Sharpino to your project:

Terminal window
dotnet add package Sharpino

You can bootstrap a project quickly using the official dotnet templates:

Terminal window
# Install the templates
dotnet new install Sharpino.Templates
# Create a new project
dotnet new sharpino

This sets up a minimal project template including a docker-compose configuration for PostgreSQL.

  1. dbmate templates: Sharpino samples use dbmate templates to configure PostgreSQL tables for event and snapshot storage.
  2. Environment Variables: Set up a .env file in your project root containing the database connection URL:
    DATABASE_URL=postgres://username:password@localhost:5432/db_name?sslmode=disable
  3. Run Migrations: Run the migration tool:
    Terminal window
    dbmate up

Note that the template already contains a Docker-ready PostgreSQL database, so you can simply run:

Terminal window
docker-compose up -d
dbmate up
dotnet run

If you clone the entire project from GitHub, you will need to configure a .env file for each project.

Once the database and environment variables are configured, you can run all tests for a specific sample folder (e.g., Sharpino.Sample.12) using:

Terminal window
runTests.sh

To run a single project, navigate to its test folder, configure the .env file, and execute:

Terminal window
dotnet test

Some examples support RabbitMQ integration. Make sure RabbitMQ is running (e.g., via rabbitmq-server), then run the project with:

Terminal window
dotnet run --configuration:rabbitmq

Online Interactive Playground (StackBlitz)

Section titled “Online Interactive Playground (StackBlitz)”

You can run and test a memory-storage-based version of the Sharpino template directly in your browser without any local database setup: