Skip to content

nkz-soft/microservice-template

Repository files navigation

microservice-template

GitHub release (latest SemVer) license GitHub Workflow Status (with branch)

Template for microservice based on DDD and Clean Architecture with .NET

The main aim of this project is to provide a means for building microservices with the latest technology and architecture. I would like this project to help you find simplified and effortless solutions. You can treat it as a modular project and reuse the modules in your projects.

⭐ Give a star

If you're using this repository for your learning, samples or your project, please give a star. Thanks 👍

Table of Contents

Installation

Installing as a template

dotnet new install  .\

Creating a new application

dotnet new nkz-template -o My.NewApp

Also you can change the contents of the generated application by using the parameters.

dotnet new nkz-template -o My.NewApp1 --EnableGraphQL false --EnableGrpc false --EnableSignalR false --EnableRedisStorage false

image

Deployment

Deploy To Local Kubernetes

Plan

  • .NET 9
  • REST API samples
  • GRPC API samples
  • Improve integration tests to use Testcontainers
  • GraphQL API samples
  • MassTransit and RabbitMq
  • Minimal hosting model
  • HealthCheck
  • Websocket (SignalR)
  • GRPC Error handling in interceptors
  • Enabling Central Package Management
  • Uses Chiseled Ubuntu image
  • Adding Layer 2 caching for EF Core
  • Creating a Helm chart
  • OpenTelemetry
  • Redis data provider
  • MongoDB data provider

Technologies used

NET Core 9: .NET Core, including ASP.NET Core

EntityFrameworkCore: EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.

Npgsql: Npgsql is the open source .NET data provider for PostgreSQL. It allows you to connect and interact with PostgreSQL server using .NET.

Mapster: A mapper library for .NET.

GuardClauses: A simple extensible package with guard clause extensions.

Testcontainers: Testcontainers is a library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.

FluentValidation: A validation library for .NET that uses a fluent interface and lambda expressions for building strongly-typed validation rules.

FluentAssertions: A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests.

protobuf-net: protobuf-net is a contract based serializer for .NET code, that happens to write data in the "protocol buffers" serialization format engineered by Google.

hotchocolate: A GraphQL server to create GraphQL endpoints and merge schemas.

MassTransit: MassTransit is a free, open-source distributed application framework for .NET.

FluentResults: FluentResults is a lightweight .NET library developed to solve a common problem. It returns an object indicating success or failure of an operation instead of throwing/using exceptions.

Specification: Base class with tests for adding specifications to a DDD model. Also includes a default generic Repository base class with support for EF6 and EF Core.

Scrutor: Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection.

RestSharp: RestSharp is a lightweight HTTP client library. It's a wrapper around HttpClient, not a full-fledged client on its own.

SignalR: ASP.NET Core SignalR is a library for ASP.NET Core developers that makes it incredibly simple to add real-time web functionality to your applications.

EF Core Second Level Cache Interceptor: Second level caching is a query cache. The results of EF commands will be stored in the cache, so that the same EF commands will retrieve their data from the cache rather than executing them against the database again.

EasyCaching: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easily!

Helm: Helm is a tool for managing Charts. Charts are packages of pre-configured Kubernetes resources.

OpenTelemetry .NET: The .NET OpenTelemetry client.

Jaeger: Jaeger, is a distributed tracing platform created by Uber Technologies and donated to Cloud Native Computing Foundation. It can be used for monitoring microservices-based distributed systems.