• Stars
    star
    854
  • Rank 53,369 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ• A practical and imaginary food delivery microservices, built with golang, domain-driven design, cqrs, event sourcing, vertical slice architecture, event-driven architecture, and the latest technologies.

๐Ÿงบ Store Golang Microservices Sample

CI Go Report Card Go Version Gitpod ready-to-code

A practical store sample, built with Golang and different software architecture and technologies like Microservices Architecture, Vertical Slice Architecture , CQRS Pattern, Domain Driven Design (DDD), Event Sourcing, Event Driven Architecture. For communication between independent services, We use asynchronous messaging with using RabbitMQ, and sometimes we use synchronous communication for real-time communications with using REST and gRPC calls.

๐Ÿ’ก This application is not business oriented and my focus is mostly on technical part, I just want to implement a sample with using different technologies, software architecture design, principles and all the thing we need for creating a microservices app.

๐ŸŒ€ This Application is in-progress and I will add new features and thecnologies over time.

Features

  • โœ… Using Vertical Slice Architecture as a high level architecture
  • โœ… Using Event Driven Architecture on top of RabbitMQ Message Broker with a custom Event Bus
  • โœ… Using Data Centeric Architecture based on CRUD in Catalogs Read Service
  • โœ… Using Event Sourcing in Audit Based services like Orders Service
  • โœ… Using CQRS Pattern and Mediator Patternon top of Go-MediatR library
  • โœ… Using RESTFul api with Echo framework and using swagger with swaggo/swag library
  • โœ… Using gRpc for internal service communication
  • โœ… Using go-playground/validator for validating input data in the REST and gRpc
  • โœ… Using Postgres and EventStoreDB for write databases as relational DB and MongoDB and Elasric Search for read databases
  • โœ… Using OpenTelemetry for collection Metrics and Distributed Tracing
  • โœ… Using docker and docker-compose for deployment

Roadmap

  • ๐Ÿšง Add Dependecny Injections with using uber-go/fx
  • ๐Ÿšง Using Domain Driven Design in some of services like Catalogs Write Service
  • ๐Ÿšง Using Helm and Kubernetes for deployment
  • ๐Ÿšง Add Identity Management and OAuth

Technologies - Libraries

System Architecture

Application Structure

In this project I used vertical slice architecture or Restructuring to a Vertical Slice Architecture also I used feature folder structure in this project.

  • We treat each request as a distinct use case or slice, encapsulating and grouping all concerns from front-end to back.
  • When We adding or changing a feature in an application in n-tire architecture, we are typically touching many different "layers" in an application. we are changing the user interface, adding fields to models, modifying validation, and so on. Instead of coupling across a layer, we couple vertically along a slice and each change affects only one slice.
  • We Minimize coupling between slices, and maximize coupling in a slice.
  • With this approach, each of our vertical slices can decide for itself how to best fulfill the request. New features only add code, we're not changing shared code and worrying about side effects. For implementing vertical slice architecture using cqrs pattern is a good match.

Also here I used CQRS for decompose my features to very small parts that makes our application:

  • maximize performance, scalability and simplicity.
  • adding new feature to this mechanism is very easy without any breaking change in other part of our codes. New features only add code, we're not changing shared code and worrying about side effects.
  • easy to maintain and any changes only affect on one command or query (or a slice) and avoid any breaking changes on other parts
  • it gives us better separation of concerns and cross cutting concern (with help of MediatR behavior pipelines) in our code instead of a big service class for doing a lot of things.

With using CQRS, our code will be more aligned with SOLID principles, especially with:

  • Single Responsibility rule - because logic responsible for a given operation is enclosed in its own type.
  • Open-Closed rule - because to add new operation you donโ€™t need to edit any of the existing types, instead you need to add a new file with a new type representing that operation.

Here instead of some Technical Splitting for example a folder or layer for our services, controllers and data models which increase dependencies between our technical splitting and also jump between layers or folders, We cut each business functionality into some vertical slices, and inner each of these slices we have Technical Folders Structure specific to that feature (command, handlers, infrastructure, repository, controllers, data models, ...).

Usually, when we work on a given functionality we need some technical things for example:

  • API endpoint (Controller)
  • Request Input (Dto)
  • Request Output (Dto)
  • Some class to handle Request, For example Command and Command Handler or Query and Query Handler
  • Data Model

Now we could all of these things beside each other and it decrease jumping and dependencies between some layers or folders.

Keeping such a split works great with CQRS. It segregates our operations and slices the application code vertically instead of horizontally. In Our CQRS pattern each command/query handler is a separate slice. This is where you can reduce coupling between layers. Each handler can be a separated code unit, even copy/pasted. Thanks to that, we can tune down the specific method to not follow general conventions (e.g. use custom SQL query or even different storage). In a traditional layered architecture, when we change the core generic mechanism in one layer, it can impact all methods.

Catalogs Service Structure

High Level Structure

References

More Repositories

1

awesome-software-architecture

๐Ÿš€ A curated list of awesome articles, videos, and other resources to learn and practice software architecture, patterns, and principles.
7,836
star
2

food-delivery-microservices

๐Ÿ” A practical and imaginary food delivery microservices, built with .Net 8, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
C#
790
star
3

awesome-go-education

A curated list of awesome articles and resources for learning and practicing Go and its related technologies.
Go
371
star
4

food-delivery-modular-monolith

๐ŸŒญ A practical and imaginary food and grocery delivery modular monolith, built with .Net 8, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
C#
309
star
5

Go-MediatR

๐Ÿšƒ A library for handling mediator patterns and simplified CQRS patterns within an event-driven architecture, inspired by csharp MediatR library.
Go
207
star
6

ecommerce-microservices

๐Ÿ›๏ธ A practical e-commerce Microservices based on Domain Driven Design, Vertical Slice Architecture, CQRS pattern, Event Driven Architecture.
C#
164
star
7

vertical-slice-api-template

An asp.net core template based on .Net 8, Vertical Slice Architecture, CQRS, Minimal APIs, API Versioning and Swagger.
C#
139
star
8

awesome-dotnet-async

A curated list of awesome articles and resources to learning and practicing about async, threading, and channels in .Net platform. ๐Ÿ˜‰
C#
91
star
9

micro-bootstrap

A Full Stack framework written in .NET Core to speed up your development process in microservices and modular monolith apps. It gathers most widely used frameworks in .NET world and pack them into a simple bootstrap package.
C#
77
star
10

go-vertical-slice-template

A Golang boilerplate template, based on Vertical Slice Architecture and CQRS pattern with using Echo, Gorm, Zap, Viper, MediatR for CQRS and sarulabs/di for Dependency Injection.
Go
71
star
11

game-leaderboard-microservices

๐ŸŽฎ Implementation of an imaginary Game Leader Board application, based on Microservices Architecture, Event Driven Architecture, Vertical Slice Architecture, Event Sourcing with EventStoreDB, Redis SortedSet, Redis Pub/Sub, SignalR and .Net 8.
C#
48
star
12

movie-search-application

๐ŸŽฌ A simple movie search app, built with .Net 8, Vertical Slice Architecture and using TMDB APIs and YouTube APIs for searching and details of the movies.
C#
36
star
13

store-modular-monolith

๐Ÿ›’ Implementing an โ€œonline storeโ€ modular monolith application with domain-driven design and CQRS with using in-memory message broker based on .Net Core.
C#
34
star
14

distributed-chat-system

A simple distributed chat system based on .net core, signalr and NATS messaging queue.
C#
11
star
15

tdd-sample

A sample project demonstrating Test-Driven Development (TDD) using .Net 8 and Vertical Slice Architecture based on Minimal APIs in .NET Core
C#
10
star
16

Jwt-Authentication-Server

This repository is an Auth Server with jwt token for .net core
C#
8
star
17

awesome-dotnet-core-education

A curated list of awesome articles and resources for learning and practicing .Net Core and its related technologies.
C#
7
star
18

.Net-Core-CQRS-Shopping

This project in a shopping app using DDD, CQRS, Clean Architecture, .Net Core, Unit, and E2E Testing.
C#
6
star
19

mehdihadeli

5
star
20

ecommerce-microservices-wolverine

๐Ÿ›๏ธ A practical e-commerce microservices, built with .Net 8, Wolverine, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
5
star
21

game-microservices

This project is a leader board gaming microservices with using some cloud native tools and technologies based on .net core.
C#
4
star
22

blog-samples

Sample codes for mehdihadeli's blog
C#
3
star
23

thesaurus-application

This application is a thesaurus app for defining and searching some words and their meanings, synonyms built on top of a vertical slice architecture, cqrs, mongodb and unit and integration testing in backend and using angular in frontend.
C#
3
star
24

design-pattern-samples

JavaScript
2
star
25

leetcode-playground

Leetcode problems and solutions in C# and Golang
Go
2
star
26

store-microservices

Implementing an โ€œonline storeโ€ microservices application with domain-driven design and CQRS with using the latest technologies and cloud native technologies.
2
star
27

dotnet-gitpod

Shell
1
star
28

envoy-samples

Go
1
star
29

Go-Bus

1
star
30

Vertical-Slice-Architecture-Sample

C#
1
star
31

partners-management

C#
1
star
32

energy-management

C#
1
star
33

release-note

Shell
1
star
34

ProblemSolving

C#
1
star
35

blog-comments

The blog comments discussions for https://dotnetuniversity.com
1
star
36

ecommerce-microservices-aspire

๐Ÿ›๏ธ A practical e-commerce microservices, built with .Net 8, Microsoft Aspire, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
1
star