Git Product home page Git Product logo

sandeepsuvit / airline-microservices Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nicojuicy/airline-microservices

0.0 1.0 0.0 437 KB

Airline Microservice is a managerial software which targets to control all operations of an airline. Airlines provide transport services for their passengers. They carry or hire aircraft for this purpose. All operations of an airline company are controlled by their airline management system.

License: MIT License

C# 96.74% Dockerfile 3.26%

airline-microservices's Introduction

License: MIT Open in Visual Studio Code

โœˆ๏ธ Airline-Microservices

Airline Microservice is a simple Airline application that has the basic business scenario for online reserving flight ticket. Airlines provide transport services for their passengers. All operations of an airline company are controlled by their airline management system.

๐Ÿ“ Table of Contents

๐Ÿš€ The Goals of This Project

  • The microservices base on Domain Driven Design (DDD) implementation.
  • Correct separation of bounded contexts for each microservice.
  • Communications between bounded contexts through asynchronous MessageBus and events.
  • Simple CQRS implementation and event driven architecture.
  • Using Inbox Pattern for guaranty message Idempotency for receiver microservice and Exactly-once Delivery pattern and using Outbox Pattern for ensuring about any message lost and At-Least one Delivery rule.
  • Using Best Practice and New Technologies and Design Patterns.
  • Using Docker-Compose and Kubernetes for our deployment mechanism.

๐ŸŽฏ Plan

This project is in progress, New features will be added over time.

I will try to register some Issues for my TODO works, just to not forget and also for tracking my works in future.

High-level plan is represented in the table

Feature Status
API Gateway Completed โœ”๏ธ
Identity Service Completed โœ”๏ธ
Flight Service Completed โœ”๏ธ
Passenger Service Completed โœ”๏ธ
Reservation Service Completed โœ”๏ธ
Building Blocks In Progress ๐Ÿ‘ทโ€โ™‚๏ธ

โค๏ธ Technologies - Libraries

  • โœ”๏ธ .NET 6 - .NET Framework and .NET Core, including ASP.NET and ASP.NET Core
  • โœ”๏ธ MVC Versioning API - Set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core
  • โœ”๏ธ EF Core - Modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations
  • โœ”๏ธ Masstransit - Distributed Application Framework for .NET.
  • โœ”๏ธ MediatR - Simple, unambitious mediator implementation in .NET.
  • โœ”๏ธ FluentValidation - Popular .NET validation library for building strongly-typed validation rules
  • โœ”๏ธ Swagger & Swagger UI - Swagger tools for documenting API's built on ASP.NET Core
  • โœ”๏ธ Serilog - Simple .NET logging with fully-structured events
  • โœ”๏ธ Polly - Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner
  • โœ”๏ธ Scrutor - Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection
  • โœ”๏ธ Opentelemetry-dotnet - The OpenTelemetry .NET Client
  • โœ”๏ธ DuendeSoftware IdentityServer - The most flexible and standards-compliant OpenID Connect and OAuth 2.x framework for ASP.NET Core
  • โœ”๏ธ EasyCaching - Open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier.
  • โœ”๏ธ Mapster - Convention-based object-object mapper in .NET.
  • โœ”๏ธ Hellang.Middleware.ProblemDetails - A middleware for handling exception in .Net Core
  • โœ”๏ธ IdGen - Twitter Snowflake-alike ID generator for .Net
  • โœ”๏ธ Refit - The automatic type-safe REST library for Xamarin and .NET.
  • โœ”๏ธ Yarp - Reverse proxy toolkit for building fast proxy servers in .NET
  • โœ”๏ธ Tye - Developer tool that makes developing, testing, and deploying microservices and distributed applications easier

๐Ÿ”† The Domain And Bounded Context - Service Boundary

  • Identity Service: The Identity Service is a bounded context for authenticate and authorize users through with Identity Server. Also, this service is responsible for creating users and their corresponding roles and permission with using .Net Core Identity and Jwt authentication and authorization.

  • Flight Service: The Flight Service is a bounded context for all operation related to flight and get available filght and seat.

  • Passenger Service: The Passenger Service is a bounded context for managing our passengers information, track the activities and subscribing to get notification for out of stock products

  • Reservation Service: The Passenger Service is a bounded context for managing all operation related to reserve flight ticket.

๐Ÿ”จ Structure of Project

I used a mediator pattern with using MediatR library in my controllers for a clean and thin controller, also instead of using a application service class because after some times our controller will depends to different services and this breaks single responsibility principle. We use mediator pattern to manage the delivery of messages to handlers. One of the advantages behind the mediator pattern is that it allows the application code to define a pipeline of activities for requests . For example in our controllers we create a command and send it to mediator and mediator will route our command to a specific command handler in application layer.

To support Single Responsibility Principle and Don't Repeat Yourself principles, the implementation of cross-cutting concerns is done using the mediatr pipeline behaviors or creating a mediatr decorators.

Also in this project I used mix of clean architecture and vertical slice architecture and also I used feature folder structure in this project.

Also here I used cqrs for decompose my features to very small parts that make 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 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.

I treat each request as a distinct use case or slice, encapsulating and grouping all concerns from front-end to back. When 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. 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.

With using CQRS pattern, we cut each business functionality into some vertical slices, and inner each of this slices we have technical folders structure specific to that feature (command, handlers, infrastructure, repository, controllers, ...). 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.

๐Ÿƒ How to Run

Config Certificate

Runt the following commands for Config SSL in your system

dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p {password here}
dotnet dev-certs https --trust

Note: for running this command in powershell use $env:USERPROFILE instead of %USERPROFILE%

Docker Compose

Run this app on docker with this docker-compose.yaml file with bellow command in root of application:

docker-compose -f ./deployments/docker-compose/docker-compose.yaml up -d

Kubernetes

#ToDo

Documention Apis

For testing apis I used REST Client plugin of VSCode and this file airline.rest is in root of project. Also after running api you have access to swagger open api for all microservices in /swagger route path.

Support โญ

If you like my work, feel free to:

  • โญ this repository. And we will be happy together :)

Thanks a bunch for supporting me!

:octocat: Contribution

Contributions are always welcome! Please take a look at the contribution guidelines pages first.

Thanks to all contributors, you're awesome and wouldn't be possible without you! The goal is to build a categorized community-driven collection of very well-known resources.

airline-microservices's People

Contributors

meysamhadeli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.