diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55b6aa1..c658578 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: if: success() id: build-test-flight-step with: - project-path: '3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api' - tests-path: '3-Microservices-Architecture-Style/src/Services/Flight/tests/' + project-path: '3-microservices-architecture-style/src/Services/Flight/src/Flight.Api' + tests-path: '3-microservices-architecture-style/src/Services/Flight/tests/' # wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory # https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/ # https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not @@ -40,8 +40,8 @@ jobs: if: success() id: build-test-identity-step with: - project-path: '3-Microservices-Architecture-Style/src/Services/Identity/src/Identity.Api' - tests-path: '3-Microservices-Architecture-Style/src/Services/Identity/tests/' + project-path: '3-microservices-architecture-style/src/Services/Identity/src/Identity.Api' + tests-path: '3-microservices-architecture-style/src/Services/Identity/tests/' # wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory # https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/ # https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not @@ -55,8 +55,8 @@ jobs: if: success() id: build-test-passenger-step with: - project-path: '3-Microservices-Architecture-Style/src/Services/Passenger/src/Passenger.Api' - tests-path: '3-Microservices-Architecture-Style/src/Services/Passenger/tests/' + project-path: '3-microservices-architecture-style/src/Services/Passenger/src/Passenger.Api' + tests-path: '3-microservices-architecture-style/src/Services/Passenger/tests/' # wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory # https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/ # https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not @@ -70,8 +70,8 @@ jobs: if: success() id: build-test-booking-step with: - project-path: '3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api' - tests-path: '3-Microservices-Architecture-Style/src/Services/Booking/tests/' + project-path: '3-microservices-architecture-style/src/Services/Booking/src/Booking.Api' + tests-path: '3-microservices-architecture-style/src/Services/Booking/tests/' # wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory # https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/ # https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not @@ -98,7 +98,7 @@ jobs: tag-name: ${{ steps.last_release.outputs.tag_name }} registry-username: ${{ secrets.DOCKERHUB_USERNAME }} registry-password: ${{ secrets.DOCKERHUB_PASSWORD }} - dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Identity/Dockerfile' + dockerfile-path: '3-microservices-architecture-style/src/Services/Identity/Dockerfile' image-name: 'booking-microservices-identity' - name: Build and Publish Flight Microservice to Docker @@ -108,7 +108,7 @@ jobs: tag-name: ${{ steps.last_release.outputs.tag_name }} registry-username: ${{ secrets.DOCKERHUB_USERNAME }} registry-password: ${{ secrets.DOCKERHUB_PASSWORD }} - dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Flight/Dockerfile' + dockerfile-path: '3-microservices-architecture-style/src/Services/Flight/Dockerfile' image-name: 'booking-microservices-flight' - name: Build and Publish Passenger Microservice to Docker @@ -118,7 +118,7 @@ jobs: tag-name: ${{ steps.last_release.outputs.tag_name }} registry-username: ${{ secrets.DOCKERHUB_USERNAME }} registry-password: ${{ secrets.DOCKERHUB_PASSWORD }} - dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Passenger/Dockerfile' + dockerfile-path: '3-microservices-architecture-style/src/Services/Passenger/Dockerfile' image-name: 'booking-microservices-passenger' - name: Build and Publish Booking Microservice to Docker @@ -128,5 +128,5 @@ jobs: tag-name: ${{ steps.last_release.outputs.tag_name }} registry-username: ${{ secrets.DOCKERHUB_USERNAME }} registry-password: ${{ secrets.DOCKERHUB_PASSWORD }} - dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Booking/Dockerfile' + dockerfile-path: '3-microservices-architecture-style/src/Services/Booking/Dockerfile' image-name: 'booking-microservices-booking' diff --git a/3-microservices-architecture-style/README.md b/3-microservices-architecture-style/README.md index 42e018f..90cdab9 100644 --- a/3-microservices-architecture-style/README.md +++ b/3-microservices-architecture-style/README.md @@ -45,7 +45,7 @@ ## Microservices Architecture Design -![](../assets/booking-microservices.png) +![](./assets/booking-microservices.png) ## Development Setup @@ -61,8 +61,8 @@ dotnet tool restore ``` ### Husky -Here we use `husky` to handel some pre commit rules and we used `conventional commits` rules and `formatting` as pre commit rules, here in [package.json](./package.json). of course, we can add more rules for pre commit in future. (find more about husky in the [documentation](https://typicode.github.io/husky/get-started.html)) -We need to install `husky` package for `manage` `pre commits hooks` and also I add two packages `@commitlint/cli` and `@commitlint/config-conventional` for handling conventional commits rules in [package.json](./package.json). +Here we use `husky` to handel some pre commit rules and we used `conventional commits` rules and `formatting` as pre commit rules, here in [package.json](.././package.json). of course, we can add more rules for pre commit in future. (find more about husky in the [documentation](https://typicode.github.io/husky/get-started.html)) +We need to install `husky` package for `manage` `pre commits hooks` and also I add two packages `@commitlint/cli` and `@commitlint/config-conventional` for handling conventional commits rules in [package.json](.././package.json). Run the command bellow in the root of project to install all npm dependencies related to husky: ```bash @@ -140,4 +140,4 @@ dotnet test Each microservice provides `API documentation` and navigate to `/swagger` for `Swagger OpenAPI` or `/scalar/v1` for `Scalar OpenAPI` to visit list of endpoints. -As part of API testing, I created the [booking.rest](./../booking.rest) file which can be run with the [REST Client](https://github.com/Huachao/vscode-restclient) `VSCode plugin`. \ No newline at end of file +As part of API testing, I created the [booking.rest](./booking.rest) file which can be run with the [REST Client](https://github.com/Huachao/vscode-restclient) `VSCode plugin`. diff --git a/assets/booking-microservices.drawio b/3-microservices-architecture-style/assets/booking-microservices.drawio similarity index 100% rename from assets/booking-microservices.drawio rename to 3-microservices-architecture-style/assets/booking-microservices.drawio diff --git a/assets/booking-microservices.png b/3-microservices-architecture-style/assets/booking-microservices.png similarity index 100% rename from assets/booking-microservices.png rename to 3-microservices-architecture-style/assets/booking-microservices.png diff --git a/booking.rest b/3-microservices-architecture-style/booking.rest similarity index 100% rename from booking.rest rename to 3-microservices-architecture-style/booking.rest diff --git a/deployments/configs/dashboards.md b/3-microservices-architecture-style/deployments/configs/dashboards.md similarity index 100% rename from deployments/configs/dashboards.md rename to 3-microservices-architecture-style/deployments/configs/dashboards.md diff --git a/deployments/configs/grafana/dashboards/dotnet-core-endpoint.json b/3-microservices-architecture-style/deployments/configs/grafana/dashboards/dotnet-core-endpoint.json similarity index 100% rename from deployments/configs/grafana/dashboards/dotnet-core-endpoint.json rename to 3-microservices-architecture-style/deployments/configs/grafana/dashboards/dotnet-core-endpoint.json diff --git a/deployments/configs/grafana/dashboards/dotnet-core.json b/3-microservices-architecture-style/deployments/configs/grafana/dashboards/dotnet-core.json similarity index 100% rename from deployments/configs/grafana/dashboards/dotnet-core.json rename to 3-microservices-architecture-style/deployments/configs/grafana/dashboards/dotnet-core.json diff --git a/deployments/configs/grafana/dashboards/node-exporter.json b/3-microservices-architecture-style/deployments/configs/grafana/dashboards/node-exporter.json similarity index 100% rename from deployments/configs/grafana/dashboards/node-exporter.json rename to 3-microservices-architecture-style/deployments/configs/grafana/dashboards/node-exporter.json diff --git a/deployments/configs/grafana/dashboards/postgresql.json b/3-microservices-architecture-style/deployments/configs/grafana/dashboards/postgresql.json similarity index 100% rename from deployments/configs/grafana/dashboards/postgresql.json rename to 3-microservices-architecture-style/deployments/configs/grafana/dashboards/postgresql.json diff --git a/deployments/configs/grafana/dashboards/rabbitmq.json b/3-microservices-architecture-style/deployments/configs/grafana/dashboards/rabbitmq.json similarity index 100% rename from deployments/configs/grafana/dashboards/rabbitmq.json rename to 3-microservices-architecture-style/deployments/configs/grafana/dashboards/rabbitmq.json diff --git a/deployments/configs/grafana/provisioning/dashboards/dashboard.yml b/3-microservices-architecture-style/deployments/configs/grafana/provisioning/dashboards/dashboard.yml similarity index 100% rename from deployments/configs/grafana/provisioning/dashboards/dashboard.yml rename to 3-microservices-architecture-style/deployments/configs/grafana/provisioning/dashboards/dashboard.yml diff --git a/deployments/configs/grafana/provisioning/datasources/datasource.yml b/3-microservices-architecture-style/deployments/configs/grafana/provisioning/datasources/datasource.yml similarity index 100% rename from deployments/configs/grafana/provisioning/datasources/datasource.yml rename to 3-microservices-architecture-style/deployments/configs/grafana/provisioning/datasources/datasource.yml diff --git a/deployments/configs/loki-config.yaml b/3-microservices-architecture-style/deployments/configs/loki-config.yaml similarity index 100% rename from deployments/configs/loki-config.yaml rename to 3-microservices-architecture-style/deployments/configs/loki-config.yaml diff --git a/deployments/configs/otel-collector-config.yaml b/3-microservices-architecture-style/deployments/configs/otel-collector-config.yaml similarity index 100% rename from deployments/configs/otel-collector-config.yaml rename to 3-microservices-architecture-style/deployments/configs/otel-collector-config.yaml diff --git a/deployments/configs/prometheus.yaml b/3-microservices-architecture-style/deployments/configs/prometheus.yaml similarity index 100% rename from deployments/configs/prometheus.yaml rename to 3-microservices-architecture-style/deployments/configs/prometheus.yaml diff --git a/deployments/configs/tempo.yaml b/3-microservices-architecture-style/deployments/configs/tempo.yaml similarity index 100% rename from deployments/configs/tempo.yaml rename to 3-microservices-architecture-style/deployments/configs/tempo.yaml diff --git a/deployments/docker-compose/docker-compose.infrastructure.yaml b/3-microservices-architecture-style/deployments/docker-compose/docker-compose.infrastructure.yaml similarity index 100% rename from deployments/docker-compose/docker-compose.infrastructure.yaml rename to 3-microservices-architecture-style/deployments/docker-compose/docker-compose.infrastructure.yaml diff --git a/deployments/docker-compose/docker-compose.yaml b/3-microservices-architecture-style/deployments/docker-compose/docker-compose.yaml similarity index 100% rename from deployments/docker-compose/docker-compose.yaml rename to 3-microservices-architecture-style/deployments/docker-compose/docker-compose.yaml diff --git a/deployments/kubernetes/booking-cert-manager.yml b/3-microservices-architecture-style/deployments/kubernetes/booking-cert-manager.yml similarity index 100% rename from deployments/kubernetes/booking-cert-manager.yml rename to 3-microservices-architecture-style/deployments/kubernetes/booking-cert-manager.yml diff --git a/deployments/kubernetes/booking-microservices.yml b/3-microservices-architecture-style/deployments/kubernetes/booking-microservices.yml similarity index 100% rename from deployments/kubernetes/booking-microservices.yml rename to 3-microservices-architecture-style/deployments/kubernetes/booking-microservices.yml diff --git a/README.md b/README.md index c571d7b..7fcb78f 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,10 @@ - [The Goals of This Project](#the-goals-of-this-project) - [Technologies - Libraries](#technologies---libraries) -- [Architectural Style](#architectural-style) - - [How to Choose the Right Architecture](#how-to-choose-the-right-architecture) - - [1. Monolithic Architecture](#1-monolithic-architecture) - - [2. Modular Monolith Architecture](#2-modular-monolith-architecture) - - [3. Microservices Architecture](#3-microservices-architecture) +- [Architectural Styles and How to Choose the Right One](#architectural-styles-and-how-to-choose-the-right-one) + - [1. Monolithic Architecture](#1-monolithic-architecture-style) + - [2. Modular Monolith Architecture](#2-modular-monolith-architecture-style) + - [3. Microservices Architecture](#3-microservices-architecture-style) - [The Domain and Bounded Context - Service Boundary](#the-domain-and-bounded-context---service-boundary) - [Structure of Project](#structure-of-project) - [Support](#support) @@ -82,19 +81,12 @@ - ✔️ **[`Testcontainers`](https://github.com/testcontainers/testcontainers-dotnet)** - Testcontainers for .NET is a library to support tests with throwaway instances of Docker containers. - ✔️ **[`K6`](https://github.com/grafana/k6)** - Modern load testing for developers and testers in the DevOps era. -## Architectural Style +## Architectural Styles and How to Choose the Right One -The repository is organized into three folders, each representing a different `architectural style`: +The repository is organized into `three folders`, each representing a different `architectural style`. Below is an overview of each style, along with guidance on when to choose it based on your `project requirements`, `team size`, `scalability needs`, and `long-term maintenance` goals. -1. **1-monolith-architecture-style**: A traditional monolithic architecture where all components of the application are tightly coupled and deployed as a single unit. -2. **2-modular-monolith-architecture-style**: A modular monolith architecture where the application is divided into modules, but still deployed as a single unit. This approach promotes better separation of concerns and maintainability. -3. **3-microservices-architecture-style**: A microservices architecture where the application is broken down into small, independent services that can be developed, deployed, and scaled independently. - -## How to Choose the Right Architecture - -The choice of architecture depends on your project requirements, team size, scalability needs, and long-term maintenance goals. Below is a guide to help you decide which architecture to choose: - -### 1. Monolithic Architecture +### 1. Monolithic Architecture Style +> A traditional **monolithic architecture** where all components of the application are tightly coupled and deployed as a single unit. - **When to Choose**: - Your project is small or medium-sized. - You have a small development team. @@ -110,7 +102,8 @@ The choice of architecture depends on your project requirements, team size, scal - Scaling is limited to scaling the entire application. - Difficult to adopt new technologies or frameworks incrementally. -### 2. Modular Monolith Architecture +### 2. Modular Monolith Architecture Style +> A **modular monolith architecture** where the application is divided into modules, but still deployed as a single unit. This approach promotes better separation of concerns and maintainability. - **When to Choose**: - Your project is medium to large-sized. - You want better separation of concerns and maintainability than a traditional monolith. @@ -125,7 +118,8 @@ The choice of architecture depends on your project requirements, team size, scal - Still a single deployment unit, so scaling is limited. - Requires careful design to avoid tight coupling between modules. -### 3. Microservices Architecture +### 3. Microservices Architecture Style +> A **microservices architecture** where the application is broken down into small, independent services that can be developed, deployed, and scaled independently. - **When to Choose**: - Your project is large and complex. - You need to scale different parts of the application independently. diff --git a/assets/booking.png b/assets/booking.png deleted file mode 100644 index 7d0eb89..0000000 Binary files a/assets/booking.png and /dev/null differ diff --git a/assets/logo.png b/assets/logo.png deleted file mode 100644 index bb808f5..0000000 Binary files a/assets/logo.png and /dev/null differ