Open lughino opened 5 years ago
Something like that? Not official but still matches the pattern -> https://github.com/juangonzaq/nestjs-ddd/tree/master/src
@Sumick yes, for the DDD looks like a good example. Looking for a Clean architecture one.
@Lughino @Sumick
As far as DDD with TypeORM, that example repo you provided appears to be using the decorated entities from TypeORM, which are a one-to-one mapping to the database table, as domain models and thus making them a domain layer concern, not an infrastructure one. Any thoughts on using TypeORM with a data mapper, to map between Domain Models and Database Entities?
Thanks.
I'm trying to incorporate clean architecture into nest, right now trying to figure out the relatiionship between the NestJs controller and the clean architecture "view".
"return" is not an option, trying to figure how to "return" from the view back to the router from the presenter which acts as a callback.
@Get()
public async getAllAccounts(): Promise<Account[]> {
const validator = new GetAllAccountsRequestMessageValidator();
const presenter = new GetAllAccountsResponsePresenter();
const repository = Factory.createDummyInMemoryAccountRepository();
const interactor = new GetAllAccountsInteractor(validator, repository);
const controller = new AccountLogicController(interactor, presenter);
**return** await controller.getAll(new GetAllAccountsRequestMessage());
}
when I'll have a full example I'll be happy to post it here
i created a repository with my "Production Ready" clean architecture NestJS based clean architecture.
Hope you'll enjoy it - I did.
https://github.com/adico1/clean-on-nest
1) it requires PostgresSQL locally installed 2) npm install
Seed DB and Run Test 3) npm run start:dev:db:seed && npm run test:e2e
Start in Dev mode 4) npm run "start:dev"
I'm submitting a...
Current behavior
NestJS is a really good framework designed with a module architecture.
Expected behavior
Would be really nice to have some official examples of how to design a nest application with
clean
andDDD
design architecture.What is the motivation / use case for changing the behavior?
Use those patterns allow us to write applications with "standard" design in mind. E.g. promoting the reuse of the layers when using different transport at the same time.