NestboltNestbolt

@nestbolt/taggable

Installation

Install @nestbolt/taggable and its required and optional peer dependencies.

Install the Package

Install @nestbolt/taggable using your preferred package manager:

npm install @nestbolt/taggable
yarn add @nestbolt/taggable
pnpm add @nestbolt/taggable

Peer Dependencies

The following packages are required peer dependencies. In a typical NestJS project, most of these are already installed:

PackageRequired VersionPurpose
@nestjs/common^10.0.0 || ^11.0.0NestJS core decorators and utilities
@nestjs/core^10.0.0 || ^11.0.0NestJS application core
@nestjs/typeorm^10.0.0 || ^11.0.0TypeORM integration for NestJS
typeorm^0.3.0ORM used for entities and repositories
reflect-metadata^0.1.13 || ^0.2.0Metadata reflection for decorators

Install any missing peer dependencies:

npm install @nestjs/common @nestjs/core @nestjs/typeorm typeorm reflect-metadata

Optional Dependencies

Event Emitter (Tag Lifecycle Events)

Required if you want to listen to tag events such as tag.created, tag.deleted, tag.attached, and tag.detached.

npm install @nestjs/event-emitter

Supported versions: ^2.0.0 || ^3.0.0

You also need to register the EventEmitterModule in your application:

import { EventEmitterModule } from "@nestjs/event-emitter";

@Module({
  imports: [
    EventEmitterModule.forRoot(),
    // ... other imports
  ],
})
export class AppModule {}

If @nestjs/event-emitter is not installed, the package works normally but no events are emitted. The event emitter is injected as an optional dependency.

Verifying the Installation

After installing, verify everything is wired correctly by importing the module in your root AppModule:

import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { TaggableModule } from "@nestbolt/taggable";

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: "postgres",
      // ... your database config
      synchronize: true, // development only
    }),
    TaggableModule.forRoot(),
  ],
})
export class AppModule {}

If the application starts without errors and you see TaggableService initialized in the logs, the installation is complete. Continue to the Quick Start guide to start tagging your entities.