npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kryptand/ddd

v0.4.8

Published

Nx plugin for structuring a monorepo with domains and layers

Downloads

1

Readme

This is a fork of https://github.com/angular-architects/nx-ddd-plugin bringing DDD to Stencil Web components

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:

domains and layers

The generated access restrictions prevent unwanted access between libraries respecting layers and domains:

access restrictions

Features

  • 🗺️ Generating domains with domain libraries including a facades, models, and data services
  • ⚙️ Generating feature libraries including a feature components using the facades
  • 🙅‍♂️ Adding linting rules for access restrictions between domains as proposed by Nrwl
  • 🙅‍♀️ Adding linting rules for access restrictions between layers as proposed by Nrwl

Usage

Add this plugin to an Nx workspace:

ng add @angular-architects/ddd

Add domains and features:

ng g @angular-architects/ddd:domain booking
ng g @angular-architects/ddd:domain boarding
ng g @angular-architects/ddd:feature search --domain booking --app flight-app --entity flight
ng g @angular-architects/ddd:feature cancel --domain booking --app flight-app
ng g @angular-architects/ddd:feature manage --domain boarding --app flight-app

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

dependency 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:

Result proving that the generated skeleton works end-to-end

Generated Structure

The included schematics generate a folder for each domain. This folder contains feature libs as well as a library with the domain logic:

Folder per Domain

The domain layer is subdivided into three parts:

Structured Domain Layer

Generated Structure for Domain Library

  • application: Contains application services. This is a DDD term for what we call facades in Angular nowadays. They orchestrate everything for a use case given so that a feature component only needs to communicate with one such facade. Also, it hides details for state management. While the generates facades just use a 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.
  • entities: Client-side data model including logic operating on it (like validations).
  • infrastructure: Services for communicating with the backend.

Consider Automatically Checking Access Restrictions

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.

Access restrictions via linting

Example Application

see https://github.com/angular-architects/ddd-demo

Credits