Convert Figma logo to code with AI

golevelup logonestjs

A collection of badass modules and utilities to help you level up your NestJS applications 🚀

2,567
285
2,567
16

Top Related Projects

72,888

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀

Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage in Express / Koa using TypeScript and Routing Controllers Framework.

67,790

Fast, unopinionated, minimalist web framework for node.

34,711

Fast and low overhead web framework, for Node.js

15,203

The API and real-time application framework

18,082

AdonisJS is a TypeScript-first web framework for building web apps and API servers. It comes with support for testing, modern tooling, an ecosystem of official packages, and more.

Quick Overview

The golevelup/nestjs repository is a collection of NestJS modules and utilities that provide additional functionality and features to the NestJS framework. NestJS is a progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications.

Pros

  • Modular Design: The repository offers a modular approach, allowing developers to selectively integrate the desired features and utilities into their NestJS applications.
  • Extensive Functionality: The repository covers a wide range of functionalities, including logging, caching, rate limiting, and more, enhancing the capabilities of NestJS applications.
  • Active Development: The project is actively maintained, with regular updates and bug fixes, ensuring the reliability and compatibility of the provided modules.
  • Community Support: The NestJS community actively contributes to the repository, providing feedback, bug reports, and additional features, making it a valuable resource for NestJS developers.

Cons

  • Dependency on NestJS: The golevelup/nestjs repository is tightly coupled with the NestJS framework, limiting its applicability to non-NestJS projects.
  • Potential Complexity: The extensive functionality and modular design of the repository may introduce additional complexity for developers, especially those new to NestJS.
  • Documentation Quality: While the repository provides documentation, it may not always be comprehensive or up-to-date, potentially making it challenging for developers to quickly understand and integrate the provided modules.
  • Compatibility Concerns: As the NestJS framework evolves, there may be compatibility issues with older versions of the golevelup/nestjs modules, requiring developers to carefully manage version dependencies.

Code Examples

Rate Limiting Module

import { Module } from '@nestjs/common';
import { RateLimitingModule } from '@golevelup/nestjs-rate-limiting';

@Module({
  imports: [
    RateLimitingModule.forRoot({
      points: 100,
      duration: 60,
      keyGenerator: (req) => req.ip,
    }),
  ],
})
export class AppModule {}

This code demonstrates the integration of the RateLimitingModule from the golevelup/nestjs repository. It sets up a rate-limiting policy that allows 100 requests per 60-second window, using the client's IP address as the key for rate limiting.

Caching Module

import { Module } from '@nestjs/common';
import { CachingModule } from '@golevelup/nestjs-caching';

@Module({
  imports: [
    CachingModule.forRoot({
      ttl: 3600,
      max: 1000,
    }),
  ],
})
export class AppModule {}

The above code sets up the CachingModule from the golevelup/nestjs repository. It configures the caching module to have a time-to-live (TTL) of 1 hour (3600 seconds) and a maximum cache size of 1000 items.

Logging Module

import { Module } from '@nestjs/common';
import { LoggingModule } from '@golevelup/nestjs-logging';

@Module({
  imports: [
    LoggingModule.forRoot({
      transports: [
        new winston.transports.Console({
          format: winston.format.combine(
            winston.format.timestamp(),
            winston.format.printf(({ level, message, timestamp }) => {
              return `${timestamp} [${level}]: ${message}`;
            })
          ),
        }),
      ],
    }),
  ],
})
export class AppModule {}

This code demonstrates the integration of the LoggingModule from the golevelup/nestjs repository. It sets up a logging configuration that uses the Winston logging library to log messages to the console with a custom format.

Getting Started

To get started with the golevelup/nestjs repository, follow these steps:

  1. Install the required dependencies:
npm install @golevelup/nestjs-rate-limiting @golevelup/nestjs-caching @golevelup/nestjs-logging
  1. Import and configure the desired modules in your NestJS application's main module (

Competitor Comparisons

72,888

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀

Pros of nest

  • Official NestJS framework repository with comprehensive documentation
  • Larger community and ecosystem with more frequent updates
  • Built-in support for a wide range of features and integrations

Cons of nest

  • Steeper learning curve for beginners due to its extensive feature set
  • Potentially more complex setup for simple applications
  • Heavier footprint compared to minimal NestJS implementations

Code Comparison

nest:

import { Controller, Get } from '@nestjs/common';

@Controller('cats')
export class CatsController {
  @Get()
  findAll(): string {
    return 'This action returns all cats';
  }
}

golevelup/nestjs:

import { createParamDecorator } from '@nestjs/common';
import { GqlExecutionContext } from '@nestjs/graphql';

export const CurrentUser = createParamDecorator(
  (data, context) => GqlExecutionContext.create(context).getContext().req.user
);

The nest example showcases a basic controller setup, while the golevelup/nestjs example demonstrates a custom decorator for GraphQL context. golevelup/nestjs focuses on providing additional utilities and enhancements to the core NestJS framework, making it a complementary tool rather than a direct alternative.

Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage in Express / Koa using TypeScript and Routing Controllers Framework.

Pros of routing-controllers

  • Framework-agnostic, can be used with Express, Koa, or other Node.js frameworks
  • Simpler setup and less boilerplate code for basic routing and controller functionality
  • More flexible and customizable decorator-based approach

Cons of routing-controllers

  • Less comprehensive ecosystem compared to NestJS
  • Fewer built-in features and modules for complex applications
  • May require more manual configuration for advanced use cases

Code Comparison

routing-controllers:

@JsonController()
export class UserController {
  @Get("/users")
  getAll() {
    return userRepository.findAll();
  }
}

nestjs:

@Controller('users')
export class UserController {
  @Get()
  findAll() {
    return this.userService.findAll();
  }
}

Both libraries use decorators for defining controllers and routes, but routing-controllers allows for more granular control over HTTP method decorators and response types. NestJS, on the other hand, provides a more opinionated structure with built-in dependency injection and modular architecture.

While routing-controllers offers simplicity and flexibility, NestJS provides a more comprehensive framework with additional features like built-in testing utilities, WebSocket support, and microservices capabilities. The choice between the two depends on the project's complexity and specific requirements.

67,790

Fast, unopinionated, minimalist web framework for node.

Pros of Express

  • Lightweight and minimalist framework, offering flexibility and simplicity
  • Extensive ecosystem with a wide range of middleware and plugins
  • Mature and battle-tested, with a large community and extensive documentation

Cons of Express

  • Lacks built-in structure, requiring developers to make architectural decisions
  • No out-of-the-box TypeScript support, necessitating additional setup
  • Limited dependency injection capabilities, making testing more challenging

Code Comparison

Express:

const express = require('express');
const app = express();

app.get('/', (req, res) => {
  res.send('Hello World!');
});

NestJS:

import { Controller, Get } from '@nestjs/common';

@Controller()
export class AppController {
  @Get()
  getHello(): string {
    return 'Hello World!';
  }
}

The Express example demonstrates its simplicity and straightforward approach, while the NestJS example showcases its use of decorators and TypeScript for a more structured and type-safe development experience. NestJS provides a higher level of abstraction and built-in architectural patterns, which can lead to more maintainable and scalable applications, especially for larger projects. However, Express's simplicity and flexibility make it an excellent choice for smaller applications or when developers prefer more control over the project structure.

34,711

Fast and low overhead web framework, for Node.js

Pros of Fastify

  • Extremely fast performance, often outperforming NestJS in benchmarks
  • Lightweight and minimalist design, allowing for greater flexibility
  • Built-in support for JSON Schema validation

Cons of Fastify

  • Less opinionated structure compared to NestJS's modular architecture
  • Smaller ecosystem and fewer out-of-the-box integrations
  • Steeper learning curve for developers new to Node.js frameworks

Code Comparison

NestJS (golevelup/nestjs):

@Controller('cats')
export class CatsController {
  @Get()
  findAll(): string {
    return 'This action returns all cats';
  }
}

Fastify:

fastify.get('/cats', async (request, reply) => {
  return 'This action returns all cats';
});

The NestJS example showcases its decorators and class-based approach, while Fastify demonstrates its more straightforward, functional style. NestJS provides a more structured, Angular-like syntax, whereas Fastify offers a simpler, Express-like API.

Both frameworks have their strengths: NestJS excels in large, enterprise-grade applications with its robust architecture and dependency injection system, while Fastify shines in high-performance scenarios and microservices where speed and low overhead are crucial.

15,203

The API and real-time application framework

Pros of Feathers

  • Lightweight and flexible framework with a modular architecture
  • Strong real-time capabilities out of the box
  • Supports multiple databases and ORMs seamlessly

Cons of Feathers

  • Smaller ecosystem and community compared to NestJS
  • Less opinionated, which may lead to inconsistent code structure across projects
  • Limited built-in support for complex enterprise-level features

Code Comparison

Feathers service creation:

const createService = require('feathers-memory');

app.use('/messages', createService());

NestJS service creation (using golevelup/nestjs):

@Injectable()
export class MessagesService {
  @InjectRepository(Message)
  private readonly repository: Repository<Message>;
}

Both frameworks offer simple service creation, but NestJS (with golevelup/nestjs) provides more TypeScript-oriented and dependency injection-focused approach, while Feathers emphasizes simplicity and flexibility.

Feathers is ideal for rapid development of real-time applications, especially when working with multiple databases. NestJS, enhanced by golevelup/nestjs, offers a more structured and opinionated approach, making it suitable for larger, enterprise-level applications with complex requirements.

18,082

AdonisJS is a TypeScript-first web framework for building web apps and API servers. It comes with support for testing, modern tooling, an ecosystem of official packages, and more.

Pros of AdonisJS

  • More lightweight and faster performance compared to NestJS
  • Simpler learning curve with a Rails-like structure
  • Built-in ORM (Lucid) that's tightly integrated with the framework

Cons of AdonisJS

  • Smaller community and ecosystem than NestJS
  • Less flexibility for complex enterprise applications
  • Fewer built-in features for microservices architecture

Code Comparison

AdonisJS route definition:

Route.get('/users', 'UsersController.index')
Route.post('/users', 'UsersController.store')

NestJS route definition:

@Controller('users')
export class UsersController {
  @Get()
  index() {}
  @Post()
  store() {}
}

AdonisJS focuses on convention over configuration, resulting in more concise route definitions. NestJS uses decorators and classes, providing a more explicit and TypeScript-friendly approach.

Both frameworks offer powerful features for building web applications, but they cater to different preferences and project requirements. AdonisJS is ideal for developers who prefer a Rails-like experience and rapid development, while NestJS is better suited for large-scale enterprise applications with complex architectures.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

A collection of Badass modules and utilities to help you level up your NestJS application.

PackageDescriptionVersionChangelog
@golevelup/nestjs-commonCommon types, mixinsversionchangelog
@golevelup/nestjs-discoveryDiscoveryModule for finding providers, controllers and method handlers from your NestJS app that have certain metadataversionchangelog
@golevelup/nestjs-rabbitmqA NestJS native module for RabbitMQ that supports both RPC and Publish/Subscribe messaging patternsversionchangelog
@golevelup/nestjs-modulesA Dynamic Module helper. Useful for configuring once and importing anywhere elseversionchangelog
@golevelup/nestjs-hasuraSuper charged Hasura Event Handlers and other utilities for seamlessly integrating Hasura with NestJSversionchangelog
@golevelup/nestjs-graphql-requestDependency Injection for GraphQLClient. Make type safe requests to third party GQL APIsversionchangelog
@golevelup/nestjs-webhooksMiddlewares and helpers for processing webhooksversionchangelog
@golevelup/nestjs-stripeStripe client and webhook processingversionchangelog
@golevelup/ts-jestJest utilities for making testing NestJS applications easier.versionchangelog

Contribute

Contributions welcome! Read the contribution guidelines first.

License

MIT License

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Jesse Carter

💻 🤔 🐛 📖 👀

Amir Zuker

💻

Jay McDoniel

💻 📖 🤔

Rodrigo

💻 📖 🐛 🤔 👀

Arjen van der Have

💻

Jérémy Levilain

💻 🤔

Sebastian Alex

💻

Emilien Escalle

📖

Nonpawit Teerachetmongkol

💻

GlenCoco

💻

Andrii Abramov

📖

Abdallah Hemedah

📖

Ashish Vaid

💻

Ben Bangert

💻

ChrisBates

💻

Gavin Ray

💻

Joseph Lally

💻

Robert Pallas

💻

Priyash Patil

📖

Tom Dickson

📖

timoklingenhoefer

💻

Philipp

📖

Dmitry Zarva

💻

Harsh Pathak

📖

Jannis Schreiber

💻

Nelson Bwogora

📖

zerobig

💻

Orim Dominic Adah

📖

Stanislas

📖

Tom Lakesman

💻

Craig Otis

💻

This project follows the all-contributors specification. Contributions of any kind welcome!