# @crowdlinker/nestjs-commons

> Commons for NestJS based projects

Latest version **0.1.4** (published 2025-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @crowdlinker/nestjs-commons
pnpm add @crowdlinker/nestjs-commons
yarn add @crowdlinker/nestjs-commons
bun add @crowdlinker/nestjs-commons
```

## Health

**Score 35/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2025-08-07 |
| First published | 2021-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 143.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Crowdlinker Inc. |
| Maintainers | ankesh_7, prateekkathal_cl |
| Keywords | nestjs, commons, nodejs |

## Links

- npm: https://www.npmjs.com/package/@crowdlinker/nestjs-commons
- Repository: https://github.com/CrowdLinker/nestjs-commons
- Homepage: https://github.com/CrowdLinker/nestjs-commons#readme
- Issues: https://github.com/CrowdLinker/nestjs-commons/issues
- npm.io page: https://npm.io/package/@crowdlinker/nestjs-commons

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Recent versions

- 0.1.4 (latest) — 2025-08-07
- 0.1.3 — 2025-05-14
- 0.1.2 — 2025-05-12
- 0.1.1 — 2024-09-12
- 0.1.0 — 2024-03-21
- 0.0.19 — 2024-03-21
- 0.0.18 — 2024-03-21
- 0.0.17 — 2024-02-26
- 0.0.16 — 2023-08-09
- 0.0.15 — 2021-11-18
- 0.0.14 — 2021-11-18
- 0.0.12 — 2021-08-18
- 0.0.11 — 2021-08-03
- 0.0.10 — 2021-07-04
- 0.0.9 — 2021-06-26
- … 8 more at https://npm.io/package/@crowdlinker/nestjs-commons/versions

## README

# NestJS Commons

Commons for NestJS

<p align="center">
  <a href="http://nestjs.com/" target="blank">
    <img src="https://nestjs.com/img/logo_text.svg" width="380" alt="Nest Logo" />
  </a>
</p>

## Packages

- [Lodash](https://www.npmjs.com/package/lodash/v/4.17.21) - lodash (v4.17.21)

## Installation

```bash
npm install --save @crowdlinker/nestjs-commons
// or
// yarn add @crowdlinker/nestjs-commons
```

## Usage

### Constants

#### Example

```ts
import dayjs from 'dayjs';
import { DATE_FORMAT } from '@crowdlinker/nestjs-commons/constants/date';

new days().format(DATE_FORMAT); // 2021-05-21
```

### Helpers

Helpers are common functions used throughout the codebase for performing some basic operations.

#### Example

```ts
import { isLeapYear } from '@crowdlinker/nestjs-commons/helpers/date';

if (isLeapYear()) {
  // const noOfDays = 366;
} else {
  // const noOfDays = 365;
}
```

### HttpExceptionFilter

To know about what an HttpExceptionFilter is, please read the [NestJS documentation](https://docs.nestjs.com/exception-filters#binding-filters).

```ts
import { Module } from '@nestjs/common';
import { APP_FILTER } from '@nestjs/core';
import { AppService } from './app.service';
import { AppController } from './app.controller';
import { AppConfigService } from './config/app/config.service';
import { HttpExceptionFilter } from '@crowdlinker/nestjs-commons/exceptions/filters/http-exception';

@Module({
  imports: [
    // ...
  ],
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: APP_FILTER,
      useFactory: async (appConfigService: AppConfigService) => {
        return new HttpExceptionFilter(appConfigService);
      },
    },
  ],
})
export class AppModule {}
```

**Note:** AppConfigService should implement AppConfigServiceInterface provided in `@crowdlinker/nestjs-commons/interfaces/config.interface. See example below:

```ts
import { Injectable } from '@nestjs/common';
import { AppConfig } from './config.interface';
import { ConfigService } from '@nestjs/config';
import { AppConfigServiceInterface } from '@crowdlinker/nestjs-commons/interfaces/config';

@Injectable()
export class AppConfigService implements AppConfigServiceInterface {
  // ....
}
```

## Important Points To Note

- Code is written in Typescript (v5.4.3)

## Contributors

- Team @Crowdlinker ([Github](https://github.com/CrowdLinker) | [Bitbucket](https://bitbucket.org/crowdlinker/))

---
_Source: https://npm.io/package/@crowdlinker/nestjs-commons · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
