- What is a microservice
- Interface layer
- What is Domain Driven Design
- Application layer
- Contents
- Domain layer
- Infrastructure Layer
- Project
What is a Microservice
A microservice is a independent compoent of a
business logic. mostly is a breakdown of a
monolith application into individual componetns
that can scale and make the service fault tolerant
There are many advantages of microservces
and they cater to different business needs as per
design an architecture.
They can be :-
Event driven
Domain driven
with webworker
What is Domain Driven Design
Domain Drivern Design is a software design pattern that saperates businesss logic from language infrastruture and other technical components. it has businss logic domain at its core and all other things
that changes are wrapped like onion onto it.
It is important as the core business logic never changes but the outlying technologies changes but doesnot affect the business logic, It is like a port and adapter pattern where technologies like databases or message queues can be replaced easily without affecting anything.
Domain Layer
The main business layer of the application that contains business models , methods, events and their working.
These are independent of any database or message queue or router and they mostly dont change.They have classes or structs that defines objects
or models and their methods and their interface signatures.
Application Layer
Application Layer is the layer that connects interface layer to the domain layer.Here there are many usecases of business present that may use more that one domain method for its working.Along with that it is responsible for authentication and transaction processing . sending notifications or
triggering events. when interface later recieves a resuqest it sends to
appropriate usecase method in application layer that may contain multiple domain methods and triggers events accordingly.
Interface Layer
Interface layer is the outer layer from where the applicaiton is accessed.
It can be a cli , a rest api or a grpc endpoint. even all three in one application. This takes the appropriate input and sends to the application layer usecase for further processing and sends response back.
Infrastructure Layer
Infrastructure layer is where all interfaces are implemented concrete. It has all the technologies in it such as database, message queue, external apis and other relevent external things that are required by the
application. It should implements domain interface methods to work and this infra related technologies are injected into the repository
or other related objects in the main setup. This process is called wiring.
Project
Github Link
https://github.com/subpxl/microservice-project
Top comments (0)