NestKit

@cisstech/nestjs-expand

A NestJS module to build Dynamic Resource Expansion for APIs

CI codecov codefactor GitHub Tag npm package NPM downloads licence code style: prettier

Overview

The NestJS Expandable Library is a powerful and flexible extension for NestJS applications, providing a generic pattern for resource expansion in REST APIs. It allows you to dynamically expand and include related resources in API responses, enhancing the flexibility of your API design.

Features

  • Dynamic Resource Expansion: Easily expand related resources in API responses using query parameters.
  • Dynamic Field Selection: Easily select only the fields you want to get from the API responses using query parameters.
  • Decorator-Based Configuration: Use decorators to mark classes and methods as expanders and expandable, simplifying configuration.
  • Enhanced Metadata Handling: Improved handling of metadata allows for multiple decorators of the same type on the same target.
  • Configuration and Customization: Configure and customize the library to suit your application's specific needs.
  • Comprehensive Error Handling: Configure how expansion errors are handled with multiple policies and customizable error responses.
  • Tested and Reliable: Extensive unit and integration tests ensure the reliability of the library.

Use cases

For a detailed explanation of use cases, please refer to this Medium article.

Installation

License

MIT © Mamadou Cisse

Edit this pageLast updated Jul 13, 2026