angular-architects / nx-ddd-plugin

Nx plugin for structuring a monorepo with domains and layers
313 stars 56 forks source link

Can feature be share by default? or have the option to make it share? #88

Closed wizardnet972 closed 2 years ago

wizardnet972 commented 2 years ago

Hi @manfredsteyer ,

(edit due to confusion)

Can feature be share by default?

Please consider this case:

In my application I have notification domain. this notification folder under libs folder have domain contains all the services for create, delete and update notification.

Also this folder contains features such create new notification and shell page to display all notifications in the list.

Now my client want to have a button in the app-shell component. when I click this button then should popup a create notification component from notification folder under libs folder.

So notification which is feature-domain must be use in app-shell from core domain.

One way I think about is to export the feature using public-api lib. (In order not to break the roles). Another way is to export the dumb component and the domain service and reassemble them in the app-shell component and everywhere I need to use them.

Both not breaking the ddd roles.

But they not easy to implement. Maybe if it's possible to have share tag to the features?

From your experience. What do you think?

gernsdorfer commented 2 years ago

In my opinion, I would split the API Module into domain-api and shell-api. ddd-1 ddd.pdf

The benefit of splitting the API into shell-api and domain-api is, that a shell-api should be lazy loaded and has no effects to the current Feature Module bundle size. A domain-api could not be lazy loaded and increase the bundle size.

manfredsteyer commented 2 years ago

We don't do this by default, because it could cause cycles. however, feel free to adjust the generated rules.