mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-14 12:48:34 +08:00
chore: clean up folder structure in microservices architecture
This commit is contained in:
parent
28651fe9b1
commit
b9e76e7183
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@ -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'
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
## Microservices Architecture Design
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## 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`.
|
||||
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`.
|
||||
|
||||
|
Before Width: | Height: | Size: 558 KiB After Width: | Height: | Size: 558 KiB |
30
README.md
30
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.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
BIN
assets/logo.png
BIN
assets/logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
Loading…
x
Reference in New Issue
Block a user