
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
@angular-architects/ddd
Advanced tools
Nx plugin for structuring a monorepo with domain driven design
The package versions are aligned with the Angular version.
Breaking change in v18.1.0:
The naming of the Nx includePaths
has changed to only use one "/".
Until v18.0.1, the generated includePaths
were like this, which is illegal in npm:
"@org/booking/domain": ["libs/booking/domain/src/index.ts"],
"@org/booking/feature-test": ["libs/booking/feature-test/src/index.ts"]
Starting with v18.1.0, the generated includePaths
are using dashes instead:
"@org/booking-domain": ["libs/booking/domain/src/index.ts"],
"@org/booking-feature-test": ["libs/booking/feature-test/src/index.ts"]
This plugin installs some schematics which automate slicing your Nx workspace into domains and layers according to Nrwl's best practices and our ideas about [client-side DDD with Angular](- Blog: All about DDD for Angular & Frontend Architectures):
The generated access restrictions prevent unwanted access between libraries respecting layers and domains:
--ngrx
switch, needs @ngrx/schematics)Add this plugin to a Nx workspace:
npm i @angular-architects/ddd
nx g @angular-architects/ddd:init
Instead, you can also use ng add, however, Nx currently emits a warning when using ng add:
nx add @angular-architects/ddd
Add domains and features manually:
nx g @angular-architects/ddd:domain booking --addApp
nx g @angular-architects/ddd:domain boarding --addApp
nx g @angular-architects/ddd:feature search --domain booking --entity flight
nx g @angular-architects/ddd:feature cancel --domain booking
nx g @angular-architects/ddd:feature manage --domain boarding
For NGRX support, just add the --ngrx
switch:
nx g @angular-architects/ddd:domain luggage --addApp --ngrx
nx g @angular-architects/ddd:feature checkin --domain luggage --entity luggage-list --ngrx
[...]
This example assumes that you have an app flight-app
in place.
These schematics also wire up the individual libs. To see the result, create a dependency graph:
npm run dep-graph
To see that the skeleton works end-to-end, call the generated feature component in your app.component.html
:
<booking-search></booking-search>
You don't need any TypeScript or Angular imports. The plugin already took care about that. After running the example, you should see something like this:
All generators have a switch --standalone
to support Standalone Components:
nx g @angular-architects/ddd:domain booking --addApp --standalone
nx g @angular-architects/ddd:feature search --domain booking --entity flight --standalone
Don't mix Standalone Components and traditional ones within the same domain.
Since version 19, standalone defaults to true.
The included schematics generate a folder for each domain. This folder contains feature libs as well as a library with the domain logic:
The domain layer is subdivided into three parts:
BehaviorSubject
, feel free to add a library like NGRX underneath. As such a modifications changes nothing from the component's perspective, you can use facades to introduce NGRX later on demand.As the access restrictions defined with Nx use linting, you can check against them at the command line too. Hence, you might consider including this into your automated build process.
see https://github.com/angular-architects/ddd-demo
FAQs
Nx plugin for structuring a monorepo with domain driven design
The npm package @angular-architects/ddd receives a total of 3,075 weekly downloads. As such, @angular-architects/ddd popularity was classified as popular.
We found that @angular-architects/ddd demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.