Skip to content

A comprehensive Micro-services application built with .NET Core demonstrating a real-world Ecommerce system where different modules were implemented as independent services. Highly-recommended practices like Design Patterns or Strategies were also applied in the app codebase.

Notifications You must be signed in to change notification settings

0xthomasit/ecommerce_microservices

Repository files navigation

E-commerce application using Microservices with .NET Core

Prepare environment:

  • Install dotnet core version in file global.json
  • IDE: Visual Studio 2022+, Rider, Visual Studio Code
  • Docker Desktop

Architecture overview:

  • Introduction:
    • The project is Micro-services based architecture where each separate service can use different technologies.
      E.g. Product uses MySQL, Customer uses PostgresQL, Inventory uses MongoDB and so on.
    • By the end of the day, these separate services can get connected and talked to each other though they use different technologies. So, together they will get a full flow of features completed for the whole system.
  • Screenshot:

    Architecture

Warning:

Some docker images are not compatible with Apple Chip (M1, M2). You should replace them with appropriate images. Suggestion images below:

  • sql server: mcr.microsoft.com/azure-sql-edge
  • mysql: arm64v8/mysql:oracle

How to run the project

Run command for build project

dotnet build

Go to folder contain file docker-compose

  1. Using docker-compose
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d --remove-orphans

Application URLs - LOCAL Environment (Docker Container):

Docker Application URLs - LOCAL Environment (Docker Container):

  1. Using Visual Studio 2022
  • Open ecommerce_microservices.sln - ecommerce_microservices.sln
  • Run Compound to start multi-projects

Application URLs - DEVELOPMENT Environment:


Application URLs - PRODUCTION Environment:


Packages References

Install Environment

References URLS

Docker Commands: (cd into folder contain file docker-compose.yml, docker-compose.override.yml)

  • Up & running:
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d --remove-orphans --build
  • Stop & Removing:
docker-compose down

Useful commands:

  • ASPNETCORE_ENVIRONMENT=Production dotnet ef database update
  • dotnet watch run --environment "Development"
  • dotnet restore
  • dotnet build
  • Migration commands for Ordering API:
    • cd into Ordering folder
    • dotnet ef migrations add "Init_OrderDB" -p Ordering.Infrastructure --startup-project Ordering.API --output-dir Persistence/Migrations
    • dotnet ef migrations add "Order_Add_Status" -p Ordering.Infrastructure --startup-project Ordering.API --output-dir Persistence/Migrations
    • dotnet ef database update -p Ordering.Infrastructure --startup-project Ordering.API
  • Revert everything before removing migrations when there's any error: // The number 0 is a special case that means before the first migration and causes all migrations to be reverted.
    • " dotnet ef database update 0 -p Ordering.Infrastructure --startup-project Ordering.API
      dotnet ef migrations remove -p Ordering.Infrastructure --startup-project Ordering.API dotnet ef database drop -p Ordering.Infrastructure --startup-project Ordering.API "

About

A comprehensive Micro-services application built with .NET Core demonstrating a real-world Ecommerce system where different modules were implemented as independent services. Highly-recommended practices like Design Patterns or Strategies were also applied in the app codebase.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published