Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wizardnet972 opened this issue Sep 3, 2021 · 2 comments
Closed

Comments

@wizardnet972
Copy link

wizardnet972 commented Sep 3, 2021

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
Copy link

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

  • The corresponding eslint boundaries config could look like this:

    • Feature
    {
       "sourceTag": "type:feature",
       "onlyDependOnLibsWithTags": ["type:ui", "type:api", "type:domain", "type:util"]
    },
    • Boarding
    {
       "sourceTag": "domain:boarding",
       "onlyDependOnLibsWithTags": ["domain:boarding", "domain:booking/domain-api", "domain:booking/shell-api", "domain:shared"]
    },
  • The corresponding nx boundaries config could look like this:

    "booking-domain-api": {
       "tags": ["domain:booking", "domain:booking/domain-api", "type:API"]
    },
    "booking-shell-api": {
       "tags": ["domain:booking", "domain:booking/shell-api", "type:API"]
    },

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.

@wizardnet972 wizardnet972 changed the title Can domain be shared? or have the option to make it shared? Can feature be share by default? or have the option to make it share? Oct 3, 2021
@manfredsteyer
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants