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

nest-workflow-engine

v1.0.2

Published

A flexible workflow engine for NestJS

Readme

nest-workflow-engine

A flexible workflow engine for NestJS that enables building configurable approval flows, task routing systems, and case management pipelines.

This package provides a structured way to model processes, tasks, transitions, and workflow cases while integrating seamlessly with NestJS and TypeORM.

Typical use cases include:

  • Approval systems
  • Procurement workflows
  • Document review pipelines
  • Ticket escalation systems
  • Business process management (BPM)

Features

  • Process Management

    • Define workflow processes
    • Configure tasks and transitions
  • Task Routing

    • Tasks connected with gates
    • Action-based transitions
  • Case Management

    • Start workflow cases
    • Move cases through workflow steps
    • Maintain complete workflow history
  • Role-Based Assignment

    • Tasks assigned to users based on roles
    • Fully customizable user provider
  • Workflow Canvas

    • Save workflow diagrams and structures
  • Highly Extensible

    • Plug in your own user system
    • Works with existing NestJS applications

Installation

npm install nest-workflow-engine

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


Quick Start

Import the module into your NestJS application.

import { Module } from '@nestjs/common';
import { WorkflowEngineModule } from 'nest-workflow-engine';
import { RoleProvider } from './role.provider';

@Module({
  imports: [
   WorkflowEngineModule.forRootAsync({
      imports: [RoleModule],
      inject: [RoleService],
      useFactory: (roleService: RoleService) => ({
        roleProvider: roleService,
      }),
    }),
  ],
})
export class AppModule {}

Role Provider

The workflow engine does not manage users directly. Instead, it relies on a Role Provider to fetch users assigned to roles.

You must implement the IRoleProvider interface.

import { IRoleProvider } from 'nest-workflow-engine';

export class RoleProvider implements IRoleProvider {
  async findRoleUsersByRoleNames(roles: string) {
    return [
      {
        id: 1,
        name: 'John Doe',
        email: '[email protected]',
      },
    ];
  }
}

Then pass it when registering the module:

Database Setup

The workflow engine provides a list of entities you can register with TypeORM.

import { WORKFLOW_ENTITIES } from 'nest-workflow-engine';

TypeOrmModule.forRoot({
  type: 'postgres',
  host: 'localhost',
  port: 5432,
  username: 'postgres',
  password: 'password',
  database: 'workflow',
  entities: [...WORKFLOW_ENTITIES],
  synchronize: true,
});

Exported Services

The module exports three main services:

WorkflowProcessService

WorkflowTaskService

WorkflowCaseService


Entities

The workflow engine includes the following entities:

WorkflowProcessEntity

WorkflowTaskEntity

WorkflowTaskRoleEntity

WorkflowTaskGateEntity

WorkflowTransitionEntity

WorkflowCaseEntity

WorkflowCaseHistoryEntity

WorkflowUserDelegationEntity

WorkflowParticipatedCaseViewEntity


Testing

Run unit tests using:

npm run test

License

MIT