athena-test/Workflow/Architecture patterns.md
2023-03-09 19:59:42 +03:00

25 lines
1.8 KiB
Markdown

# Architectural patterns
To write quality code, you must read a lot about the architectural patterns we use.
## Microservice architecture
A _**microservice architecture**_ involves dividing an application into independent microservices, each responsible for a certain part of the business logic. During deployment, depending on the load on a particular microservice, a certain number of microservice instances can be created, which allows you to adjust the application load. For example, if the application frequently uses smart home device management functionality, but rarely uses messaging or SMS functionality, you can increase the number of microservice instances that are responsible for device management and reduce the number of notifier microservice instances. Each microservice is independent of the written language and is connected to each other using an HTTP connection or message brokers such as _**Kafka**_, _**RabbitMQ**_ or _**MQTT**_.
You can read about microservice architechture [here](https://microservices.io/patterns/microservices.html).
## Domain-driven design architecture
You can read about domain-driven architecture [here](https://www.domainlanguage.com/wp-content/uploads/2016/05/DDD_Reference_2015-03.pdf).
## Event-driven design architecture
You can read about event-driven architecture [here](https://elementallinks.com/el-reports/EventDrivenArchitectureOverview_ElementalLinks_Feb2011.pdf).
## CQRS
NestJS has own instruments for [CQRS implementation](https://docs.nestjs.com/recipes/cqrs). You can study an example implementation of NestJS [here](https://github.com/kamilmysliwiec/nest-cqrs-example).
## Design patterns
Design patterns are a powerful tool for writing reusable and comprehensive code. [Here](https://refactoring.guru/design-patterns/) you can find a good guide for all of them.