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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@whytea/peppermint

v0.0.13

Published

A comprehensive Domain-Driven Design (DDD) library for NestJS applications

Readme

Herbal Peppermint - DDD NestJS Library

A comprehensive Domain-Driven Design (DDD) library for NestJS applications, providing a robust foundation for building scalable and maintainable applications.

Overview

Herbal Peppermint is designed to help developers implement DDD principles in their NestJS applications. It provides a structured approach to organizing code, handling errors, and implementing common patterns like CQRS and Event Sourcing.

Architecture

The library follows a clean architecture approach with clear separation of concerns:

src/
├── adapters/                 # External interface adapters
│   ├── http/                # HTTP-related adapters
│   │   └── rest/           # REST-specific implementations
│   │       └── decorators/ # REST-specific decorators
│   ├── graphql/            # GraphQL adapters
│   ├── messaging/          # Message queue adapters
│   └── persistence/        # Database adapters
├── core/                    # Core business logic
│   ├── application/        # Application services
│   ├── domain/            # Domain models and logic
│   ├── common/            # Shared utilities
│   └── infrastructure/    # Core infrastructure
├── errors/                 # Error handling
│   ├── application/       # Application-level errors
│   ├── domain/           # Domain-level errors
│   ├── infrastructure/   # Infrastructure-level errors
│   └── filters/         # Error filters
├── modules/               # Feature modules
├── patterns/             # Design patterns
│   ├── cqrs/            # CQRS implementation
│   ├── event-sourcing/  # Event sourcing
│   ├── messaging/       # Messaging patterns
│   └── repository/      # Repository pattern
└── testing/             # Testing utilities

Features

Domain Layer

  • Rich domain models
  • Value objects
  • Domain events
  • Domain services
  • Aggregates
  • Repositories

Application Layer

  • Application services
  • DTOs
  • Command/Query handlers
  • Event handlers
  • Use cases

Infrastructure Layer

  • Database adapters (TypeORM, Knex)
  • HTTP adapters (REST, GraphQL)
  • Message queue adapters
  • External service integrations

Error Handling

  • Hierarchical error system
    • Domain errors
    • Application errors
    • Infrastructure errors
  • Error filters and parsers
  • Metadata support for debugging
  • Custom error types for different layers

REST Decorators

  • Validation decorators
    • @IsTimeString()
    • @IsIsoDate()
    • @IsLessThan()
    • @IsMoreThan()
    • @IsLessThanOrEqual()
    • @IsMoreThanOrEqual()
    • @NotEqualTo()
  • Utility decorators
    • @EnsureArray()

Installation

npm install herbal-peppermint
# or
yarn add herbal-peppermint

Usage

Basic Setup

import { Module } from '@nestjs/common';
import { HerbalPeppermintModule } from 'herbal-peppermint';

@Module({
  imports: [HerbalPeppermintModule],
})
export class AppModule {}

Using Decorators

import { IsTimeString, IsLessThan, EnsureArray } from 'herbal-peppermint/adapters/http/rest/decorators';

export class CreateEventDto {
  @IsTimeString()
  startTime: string;

  @IsLessThan('startTime')
  endTime: string;

  @EnsureArray()
  tags: string[];
}

Error Handling

import { DomainError, ApplicationError, InfrastructureError } from 'herbal-peppermint/errors';

// Domain error
throw new DomainError('InvalidOperation', 'Cannot perform this operation');

// Application error
throw new ApplicationError('ValidationFailed', 'Invalid input data');

// Infrastructure error
throw new InfrastructureError('DatabaseConnectionFailed', 'Failed to connect to database');

Testing

The library includes comprehensive testing utilities:

import { TestUtils } from 'herbal-peppermint/testing';

describe('MyService', () => {
  let service: MyService;

  beforeEach(() => {
    service = TestUtils.createService(MyService);
  });

  it('should handle domain events', () => {
    // Test implementation
  });
});

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.