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

@bts-soft/common

v1.4.0

Published

Shared NestJS utilities (modules, guards, interceptors, decorators, DTOs, and entities) for all @bts-soft packages.

Downloads

2,192

Readme

@bts-soft/common

The foundational Standard Library for the BTS Soft ecosystem. A technology-agnostic, production-hardened collection of utilities, base classes, and infrastructure modules for NestJS applications.


Key Features

  • Technology Agnostic: Core logic is decoupled from specific ORMs or API protocols.
  • Multi-ORM Support: Pre-configured bases for TypeORM, Sequelize, Mongoose, Prisma, and Agnostic foundations.
  • Standardized Communication: Unified response structure and exception handling for both REST and GraphQL.
  • Robust Rate Limiting: Global throttling support with automatic handling for REST and GraphQL contexts.
  • Security by Default: Integrated SQL Injection protection and sensitive data filtering.
  • Enterprise Internationalization: Built-in support for multi-language applications (Arabic/English).
  • Centralized Logging: Consistent observability with specialized logger services.

Installation

npm install @bts-soft/common

Core Infrastructure Modules

1. Throttling Module

Provides global rate limiting with a robust guard that automatically detects and handles both HTTP and GraphQL requests.

import { ThrottlingModule } from '@bts-soft/common';

@Module({
  imports: [
    ThrottlingModule.forRoot([
      { name: 'short', ttl: 1000, limit: 3 },
      { name: 'medium', ttl: 10000, limit: 20 }
    ]),
  ],
})
export class AppModule {}

2. Translation Module

Integrated internationalization using nestjs-i18n with support for header-based and accept-language based language resolution.

3. GraphQL Module

A standardized Apollo Server configuration with custom error filters that bridge the gap between GraphQL errors and standard HTTP status codes.


Security & Interceptors

Activate the global security and response formatting suite in your main.ts:

import { setupInterceptors } from '@bts-soft/common';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  setupInterceptors(app);
  await app.listen(3000);
}

Included Interceptors:

  • SqlInjectionInterceptor: Scans all incoming payloads (Body, Query, Params) for malicious patterns.
  • GeneralResponseInterceptor: Wraps all REST responses in a standardized success/error envelope.
  • ClassSerializerInterceptor: Filters sensitive fields marked with @Exclude().

Base Entities

Choose the persistence foundation that matches your stack:

  • Agnostic: BaseEntity (ULID based)
  • TypeORM: TypeOrmBaseEntity
  • Mongoose: MongooseBaseEntity
  • Sequelize: SequelizeBaseEntity
  • Prisma: PrismaBase
  • GraphQL: GraphqlBaseEntity

API Reference: Decorators

| Decorator | Description | Context | | :--- | :--- | :--- | | @CurrentUser() | Safely extracts the authenticated user from the request. | REST & GraphQL | | @Public() | Bypasses global authentication guards for specific endpoints. | REST & GraphQL |


Testing

The package includes a comprehensive test suite with 100% pass rate for both Unit and End-to-End (E2E) tests.

Running Tests

Ensure you have Docker installed for database-dependent tests:

# Run all tests (Unit + E2E)
npm run test:all

# Run unit tests with coverage
npm run test:cov

# Run E2E tests
npm run test:e2e

License

MIT © 2025 BTS Soft - Developed by Omar Sabry.