Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhuravlevma/ddd-nested-aggregates
Clean architecture for nest.js, typescript, clean architecture without domain events. Instead of events there are nested aggregates ⚡
https://github.com/zhuravlevma/ddd-nested-aggregates
acid aggregates architecture clean-architecture ddd ddd-architecture domain-driven-design domain-model example nest nested-aggregates nestjs nestjs-backend node nodejs strong-consistency typescript
Last synced: 16 days ago
JSON representation
Clean architecture for nest.js, typescript, clean architecture without domain events. Instead of events there are nested aggregates ⚡
- Host: GitHub
- URL: https://github.com/zhuravlevma/ddd-nested-aggregates
- Owner: zhuravlevma
- License: mit
- Created: 2023-08-27T18:49:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-04T10:51:06.000Z (12 months ago)
- Last Synced: 2024-11-15T02:12:50.639Z (3 months ago)
- Topics: acid, aggregates, architecture, clean-architecture, ddd, ddd-architecture, domain-driven-design, domain-model, example, nest, nested-aggregates, nestjs, nestjs-backend, node, nodejs, strong-consistency, typescript
- Language: TypeScript
- Homepage:
- Size: 204 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Clean Architecture with DDD(without Domain Events)
This implementation is without domain events, instead of events there are nested aggregates.
## Example
```typescript
export class WarehouseEntity implements Attributes {
id: string;
name: string;
orders: OrderEntity[];
report?: ReportEntity; // nested aggregateconstructor(attributes: Attributes) {
this.id = attributes.id;
this.name = attributes.name;
this.orders = attributes.orders;
}addOrder(order: OrderEntity) {
this.orders.push(order);
}changeOrderStatusToValid(orderId: string, report: ReportEntity) {
const order = this.orders.find((el) => el.id === orderId);
order.changeStatus(true);
this.report = report;
}
}
```If you are interested in the option with domain events, then follow the [link](https://github.com/zhuravlevma/typescript-ddd-architecture)
[Domain model](https://martinfowler.com/eaaCatalog/domainModel.html) with a clean architecture with ports and adapters. It takes into account some tactical patterns from DDD.
## Architecture
## Installation
```bash
npm install
```## Running the app
```bash
# development
$ cp .env.example .env
$ npm run start:dev
```## Test
```bash
# unit tests
$ npm run test# arch tests
$ npm run test:arch# test coverage
$ npm run test:cov
```