• Stars
    star
    277
  • Rank 148,875 (Top 3 %)
  • Language
    C#
  • License
    Other
  • Created over 4 years ago
  • Updated almost 4 years ago

Reviews

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

Repository Details

The Microservices Online Shop is an application with a modern software architecture that is cleanly designed and based on.NET lightweight technologies. The shop has two build variations. The first variant is the classic Microservices Architectural Style. The second one is with Dapr. Dapr has a comprehensive infrastructure for building highly decoupled Microservices; for this reason, I am using Dapr to achieve the noble goal of building a highly scalable application with clean architecture and clean code.

Quick Start

Modern Architecture Shop Part I(Article)

Modern Architecture Shop Part II(Article)

Microservices Online Shop

Microservices Online shop is a Modern Architecture Shop that is cleanly designed and based on.NET lightweight technologies. The shop has two build variations. The first variant is the classic Microservices Architectural style. The second one is with Dapr to get the most out of its infrastructure and achieve our noble goal of building a highly scalable application with clean architecture and clean code. The shop is still in the development phase, for example, user interface, user authentication, catalog service, basket service, and order service. The work in the payment service is still in progress.

Login Service

Catalog/Product service

Basket/Card Service

Payment Service

Order History

As you see, most of the views are done! One important thing is still missing, and that is the payment service. I am using Stripe API for this job.

You can run the shop as standalone services or on the Docker containers. Kubernetes stuff still under work. I have tried to simplify the build and start the application. To do that, you have to do it in few steps.

If you want to join the GitHub project development process, you are welcome to write to me please a request, and you are welcome on the board! Much work still open in the:

  • Blazor UI
  • IdentityServer 4
  • Kubernetes

Dependencies

I have generated the architecture dependencies with Visual Studio 2019, and I have ordered them from the bottom to the top, as seen in the figure below.

Currently, I am using the fantastic tool β€œNDepend” to find code and architecture problems.

Clean Architecture

Clean Architecture is the key to Loosely-Coupled-Application. It allows you to decouple the application from the infrastructure completely.

Clean Architecture Separates

β€’ User Interface
β€’ Database
β€’ Use Cases
β€’ Domain

User interface

Store.UI is the frontend of the shop, and it contains the shop user interface stuff.

Database

Each service owns its database (StoreDb, BasketDb, OrderDb, UserDb).

Use Cases

I have also divided each domain service into four parts or assemblies:

Business logic interfaces - Use cases

It contains the business logic interfaces; for example, StoreApplication.dll contains the interfaces for the Store service.

Infrastructure

It contains the implementation of the use case or business logic.

Domain

It contains the Domains entities or POCOs.

API

It contains the Web API stuff.

I have tried to keep the code as I can compact and readable. The core design concept is the separation of concerns in a clean way.

The shop Software Architecture

Classic architectural style

In the classic architectural style, I am using the classic domain-driven design and microservices design. Where each domain service calling the other service directly (Web API)

 Classic architectural style

Highly Scalable Design

I am using the Dapr infrastructure in this style, for example, RabbitMQ - message bus, Redis for the state management, and other Dapr stuff, which allows me to achieve the highly scalable architecture.

  Highly Scalable Design  

How can you test the Modern Shop?

Required

https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-preview Visual Studio 2019 https://www.docker.com/products/docker-desktop Docker Desktop

First Approach with Visual Studio

Build and Start the Shop

  1. Install tye dotnet tool install -g Microsoft.Tye --version "0.5.0-*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json

  2. Start tye-min.yaml in console tye run tye-min.yaml

  3. Open the solution file ModernArchitectureShop.sln with latest Visual Studio 2019 preview.

  4. Set the Startup projects as shown below

  1. PRESS F5 and enjoy it!

The Second Approach run the Shop with Dapr
Alternatively, to Visual Studio 2019

  1. Install Tye
    dotnet tool install -g Microsoft.Tye --version "0.5.0-*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json

  2. Start tye-min.yaml in the console tye run tye-min.yaml

  3. Install Dapr
    powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"

  4. Execute dapr_start.ps1 in the PowerShell
    ./dapr_start.ps1

Third Approach run it with Tye

  1. Tye install

This will install the newest available build from our CI.

dotnet tool install -g Microsoft.Tye --version "0.5.0-*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json

If you already have a build installed and you want to update, replace install with update
dotnet tool update -g Microsoft.Tye --version "0.5.0-*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json

  1. Execute the tye command
    tye run

Summary

Modern Architecture Shop is a clean-lightweight .NET and scalable application. Keep your eye on the Road Map (watch it on GitHub). The next version contains minimal features set so that you can pay an order with a Credit Card. The Shop manager service is also in my plan, which allows you to manage the shop users and administrators and the shop products. Recommendation service and all other AI services or features, I provide them later.

More Repositories

1

CSharp-9-CheatSheet

C# 9 Cheat Sheet with code example and pros and cons.
407
star
2

CSharp8CheatSheet

C# 8 Cheat Sheet, Default Interface Methods, Pattern Matching, Indices and Ranges, Nullable Reference Types, Asynchronous Streams, Caller Expression Attribute ,Static Local Functions, Default in Deconstruction., Alternative Interpolated Verbatim Strings, Using Declarations, Relax Ordering of ref and partial Modifiers, Disposable ref structs, Generic Attributes, Null Coalescing Assignment ,Disposable ref structs
82
star
3

CSharp7Features

New C# 7.0 features in Visual Studio 2017 RC
C#
30
star
4

CSharp_8_Async_Streams_Demo

C# 8 Demo for the new proposed feature Async Streams
C#
12
star
5

EntityFrameworkCoreDocker

C#Corner article Entity Framework Core with SQL Server / SQLite in Docker Container. use Docker with the Entity Framework Core with different databases
C#
10
star
6

IAsyncEnumerableDemo

C# 8 Demo IAsyncEnumerable interface
C#
5
star
7

FSharpDesktopApplication

F# demo desktop application for C# Developers, based on domain driven design, SQL Server Express: https://www.c-sharpcorner.com/article/easy-way-to-become-an-f-sharp-programmer-for-c-sharp-developers/
F#
3
star
8

EntityFrameworkCoreDemo

Entity Framework Core Demo, code sample, examples, for presentation, tutor, step by step learn, learn Entity Framework core.
C#
3
star
9

ParameterSniffingEFCore

ParameterSniffingEFCore Please read the article in DZone. Entity Framework Core SQL Server Parameter Sniffing
C#
3
star
10

Entity-Framework-Core-and-Cosmos-Db-with-Blazor

Entity Framework Core and Cosmos Db with Blazor demo application
C#
2
star
11

Cosmos-DB-Table-API

Source Code for my article Cosmos DB Table API in CShrapCorner
C#
1
star
12

NotificationsService

C#
1
star
13

CSharp_7.2_Demo

Examples for: DIGITAL SEPARATOR, Non-trailing Named Arguments, Conditional Ref Operator, Private Protected, Readonly struct and Ref Struct, Span
C#
1
star
14

Default-Interface-Methods-CSharp-8

Default Interface Methods in C# 8: - A Very simple example - Keyword abstract and virtual - Using the keyword This - Using Properties - Diamond Problem - Using Async - Generic - Player example - Limitations and errors
C#
1
star