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

@webmogilevtsev/nestjs-ddd-cli

v2.2.5

Published

Domain Driven Design (DDD) Structure Generator is a CLI tool for quickly creating well-organized application architectures based on DDD principles. It generates boilerplate code for essential building blocks, allowing developers to focus on solving comple

Downloads

57

Readme

Installation

To install the application for generating folder and file structures for your domain in a NestJS project, you can use the @webmogilevtsev/nestjs-ddd-cli package. You can install it using the following command:

npm install @webmogilevtsev/nestjs-ddd-cli --save-dev

After installing the package, you need to add a script to the package.json file to be able to run the generate:domain command. Add the following line to the "scripts" section:

"scripts": {
  ...
  "generate:domain": "ddd-cli domain --",
  "generate:command": "ddd-cli command",
  "generate:query": "ddd-cli query",
  "generate:event": "ddd-cli event"
}

Global Installation

You can also install @webmogilevtsev/nestjs-ddd-cli globally to use the generate-domain command in any NestJS project. To do this, run the following command:

npm install -g @webmogilevtsev/nestjs-ddd-cli

After the global installation, you can run the generate-domain command from any directory on your computer:

generate-domain my-name

Description

This is an application for generating folder and file structure for a domain in a NestJS project. The generate:domain command generates the folder and file structure for a new domain, including the following directories:

  • libs/domains/src/${name}-domain/application-services/commands
  • libs/domains/src/${name}-domain/application-services/dto
  • libs/domains/src/${name}-domain/application-services/events
  • libs/domains/src/${name}-domain/application-services/facade
  • libs/domains/src/${name}-domain/application-services/queries
  • libs/domains/src/${name}-domain/domain/services
  • libs/domains/src/${name}-domain/domain/repositories
  • libs/domains/src/${name}-domain/domain/sagas
  • libs/domains/src/${name}-domain/domain
  • src/infrastructure/${name}-adapter/${name}-adapter.service
  • src/infrastructure/infrastructure-module

Commands

generate:domain

Domain generation

Options:

To generate a new domain, run the generate:domain command with the name argument, which sets the domain name:

npm run generate:domain --name=my-name --format=true
# Shortened notation
npm run generate:domain my-name -f

generate:command

Command generation

Options:

To generate a new command for a domain, run the generate:command command with the name, domain, and optional --format arguments:

npm run generate:command --name=create-my-name -- --domain=my-name --format=true
# Shortened notation
npm run generate:command create-my-name -- -d my-name -f

generate:query

Query generation

Options:

To generate a new query for a domain, run the generate:query command with the name, domain, and optional --format arguments:

npm run generate:query --name=get-one-my-name -- --domain=my-name --format=true
# Shortened notation
npm run generate:query get-one-my-name -- -d my-name -f

generate:event

Event generation

Options:

To generate a new event for a domain, run the generate:event command with the name, domain, and optional --format arguments:

npm run generate:event --name=my-name-created -- --domain=my-name --format=true
# Shortened notation
npm run generate:event my-name-created -- -d my-name -f

Directory Structure

The folder and file structure created by the generate:domain command looks like this:

libs/
  domains/
    src/
      example-domain/
        application-services/
          commands/
            index.ts
          dto/
            index.ts
          events/
            index.ts
          facade/
            example-facade.factory.ts
            example-facade.service.ts
          queries/
            index.ts
        domain/
          services/
            example-domain.service.ts
          example-domain.interface.ts
          example-domain.aggregate.ts
          index.ts
        repositories/
          example-domain-repository.abstract.ts
          index.ts
        sagas/
          example-domain-saga.service.ts
        example-domain.module.ts
        index.ts
    index.ts
src/
  infrastructure/
    example-adapter/
      example-adapter.service
    infrastructure-module.ts
  • application-services/commands/ - directory with commands for managing the domain.
  • application-services/dto/ - directory with data transfer objects for use in the application.
  • application-services/events/ - directory with events emitted by the domain.
  • application-services/facade/ - directory with facade classes that provide a simple interface for interacting with the domain.
  • application-services/queries/ - directory with queries for retrieving data from the domain.
  • domain/services/ - directory with domain services that implement business logic.
  • domain/repositories/ - directory with domain repositories that provide access to data.
  • domain/sagas/ - directory with sagas that coordinate complex workflows between domain components.
  • domain/ - directory containing the domain interface, as well as aggregates and other components.
  • example-domain.module.ts - module that combines all domain components.
  • index.ts - file exporting all domains from the src/ folder.
  • infrastructure/ - implementation layer