Giter Club home page Giter Club logo

dotnet-microservices-boilerplate's Introduction

.NET Microservices Boilerplate

fluentpos

The goal is to build a framework that can make building microservices in .NET easy for developers. This project follows Vertical Slice Architecture along with other latest best practices and tools like CQRS, NoSQL, SQL, MediatR, Serilog, FluentValidations and more.๐Ÿš€

Table of Contents

Goals

  • โ‡๏ธ Using Vertical Slice Architecture for architecture level.
  • โ‡๏ธ Using Domain Driven Design (DDD) to implement all business processes in microservices.
  • โ‡๏ธ Using Rabbitmq on top of MassTranit for Event Driven Architecture between our microservices.
  • โ‡๏ธ Using CQRS implementation with MediatR library.
  • โ‡๏ธ Using Entity Framework Core for some microservices.
  • โ‡๏ธ Using MongoDB for some microservices.
  • โ‡๏ธ Using Fluent Validation and a Validation Pipeline Behaviour on top of MediatR.
  • โ‡๏ธ Using Minimal API for all endpoints.
  • โ‡๏ธ Using Health Check for reporting the health of app infrastructure components.
  • โ‡๏ธ Using Tye for local development and debugging.
  • โ‡๏ธ Using Built-In Containerization for Docker images.
  • โ‡๏ธ Using Zipkin for distributed tracing.
  • โ‡๏ธ Using OpenIddict for authentication and authorization base on OpenID-Connect and OAuth2.
  • โ‡๏ธ Using Yarp as a microservices gateway.

FluentPos

FluentPos is a sample project that consumes the microservice framework. You will learn a lot by exploring this project, which is located under the ./fluentpos folder.

Services Status
Gateway Completed โœ”๏ธ
Identity Completed โœ”๏ธ
Catalog Completed โœ”๏ธ
Cart WIP ๐Ÿšง
People WIP ๐Ÿšง
Ordering WIP ๐Ÿšง
Payment WIP ๐Ÿšง

How to Run ?

Tye

Tye is a super-awesome way to run your applications quickly. The fluentpos project already has this support. Simply run the following at the ./fluentpos directory :

make tye

That's it!

This will spin up all the services required.

  • Gateway will be available on https://localhost:7002.
  • Identity Service will be available on https://localhost:7001.
  • Catalog Service will be available on https://localhost:7003.

To Test these APIs, you can use open up Visual Code from the ./fluentpos directory, install the Thunder Client extension. I have already included the required Test collections at ./fluentpos/thunder-tests.

You can find the specification of services under the ./fluentpos/tye.yaml file.

Docker & Docker-Compose

The fluentpos project comes included with the required docker-compose.yaml and makefile file for your reference.

There are some prerequisites for using these included docker-compose.yml files:

  1. Make sure you have docker installed (on windows install docker desktop)

  2. Create and install an https certificate:

    dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\cert.pfx -p password!
    

    Note that the certificate name and password should match the ones that are mentioned in the docker-compose.yaml file.

  3. It's possible that the above step gives you an A valid HTTPS certificate is already present error. In that case you will have to run the following command, and then Re-Run Step #2.

     dotnet dev-certs https --clean
    
  4. Trust the certificate

     dotnet dev-certs https --trust
    

Once your certificate is trusted, simply navigate into the ./fluentpos folder of the project and run the following command.

make docker-up

This will spin up all the containers required. Your Gateway URL will be available on https://localhost:7002.

To bring down all the fluentpos container, simply run the following.

make docker-down

Note that the default Docker Images that will be pulled are from my public Image Repository (for eg, iammukeshm/fluentpos.identity:latest). You can switch it your variants if required.

Technologies & Libraries

  • .NET 7 - .NET Framework and .NET Core, including ASP.NET and ASP.NET Core
  • MVC Versioning API - Set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core
  • EF Core - Modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations
  • MediatR - Simple, unambitious mediator implementation in .NET.
  • FluentValidation - Popular .NET validation library for building strongly-typed validation rules
  • Swagger & Swagger UI - Swagger tools for documenting API's built on ASP.NET Core
  • Serilog - Simple .NET logging with fully-structured events
  • OpenIddict - OpenIddict aims at providing a versatile solution to implement OpenID Connect client, server and token validation support.
  • Mapster - Convention-based object-object mapper in .NET.
  • Yarp - Reverse proxy toolkit for building fast proxy servers in .NET
  • Tye - Developer tool that makes developing, testing, and deploying microservices and distributed applications easier.
  • MongoDB.Driver - .NET Driver for MongoDB.

Documentation

Read Documentation related to this Boilerplate here - https://fullstackhero.net/dotnet-microservices-boilerplate/

Feel free to contribute to the Documentation Repository - https://github.com/fullstackhero/docs Docs are not yet updated.

Changelogs

View Complete Changelogs.

Community

License

This project is licensed with the MIT license.

Support โญ

Has this Project helped you learn something New? or Helped you at work? Here are a few ways by which you can support.

Code Contributors

This project exists thanks to all the people who contribute. Submit your PR and join the elite list!

fsh dotnet microservices contributors

Financial Contributors

Become a financial contributor and help me sustain the project. Support the Project!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.