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-cdk

v0.0.1-rc.0

Published

<p align="center"> <a href="https://npmjs.com/nest-apig"> <img src="https://img.shields.io/npm/v/nest-apig.svg" alt="NPM Version" /> </a> <img src="https://img.shields.io/npm/l/nest-apig.svg" alt="Package License" />

Readme

Nest-ApiG - Integration of NestJS with AWS Lambda and AWS CDK

Nest-ApiG is a library that simplifies the integration of NestJS with AWS Lambda and makes your NestJS application compatible with the AWS CDK. With this library, you can easily transform your NestJS application into a Lambda function and make it executable using AWS CDK. Nest-ApiG offers several features to streamline serverless application development, including:

  • Automatic creation of handlers for the API Gateway.
  • Input payload validation using class-transformer and class-validator.
  • Use of the @OnAtlasEvent decorator to associate service methods with specific events in MongoDB Atlas.
  • Integrated authentication with Amazon Cognito using the @CognitoAuth decorator.

Here are some details on how to use and configure Nest-ApiG in your project:

Installation

To get started with Nest-ApiG, you need to install it in your project:

npm install nest-apig
# or
yarn add nest-apig

Configuration

Here are some examples of how you can configure Nest-ApiG in your project:

Creating the Handler for the API Gateway

You can create a handler for the API Gateway in the main.ts file as follows:

import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import { getHandler } from "nest-apig";
import type { Handler } from "aws-lambda";

export const handler: Handler = getHandler(NestFactory.create(AppModule));
global["handler"] = handler;

This allows your NestJS application to run as a Lambda function.

Payload Validation

Nest-ApiG simplifies input payload validation. Just use NestJS decorators like @Body() to define the structure of your payload. Validation will be automatically handled outside the Lambda function, reducing execution costs.

@OnMongoAtlas Decorator

The @OnMongoAtlas decorator allows you to associate service methods with specific events in MongoDB Atlas. You can use it as follows:

@OnMongoAtlas(['user.created'])
sendWelcomeMail(user: UserModel){...}

@OnMongoAtlas(['user.deleted'])
sendByeMail(user: UserModel) {}

@OnMongoAtlas(['user.updated'], {status: {prefix: "SUSPENSED"}})
onUserSuspensed(user: UserModel) {}

This ensures that the methods are automatically called when the specified events occur in the database.

@CognitoAuth Decorator

The @CognitoAuth decorator is used to authenticate methods of a controller with Amazon Cognito. You can configure it like this:

class AppController {
  @Get("hello-1")
  hello1() {
    return "Hello 1";
  }

  @CognitoAuth("AdminAuth")
  @Get("hello-2")
  hello2() {
    return "Hello 2";
  }
}

It will ensure that only authenticated users with the 'AdminAuth' profile have access to the hello2 method.

Integration with AWS CDK

You can easily integrate your NestJS application with AWS CDK for simplified deployment to AWS. Refer to the AWS CDK documentation for details on programmatically configuring your infrastructure.

Contributing

We welcome contributions! If you'd like to improve Nest-ApiG, feel free to open an issue or submit a pull request on our GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Authors

Patrick Hadson - [email protected]

Acknowledgments

We would like to thank NestJS and all open-source software developers who make this project possible.

Work

@nest-cdk/core

  • [ ] getHandler
  • [ ] register

@nest-cdk/cognito

  • [ ] @CognitoAuth
  • [ ] register

@nest-cdk/atlas

  • [ ] register
  • [ ] @OnAtlasEvents
  • [ ] @FindAll
  • [ ] @FindOne
  • [ ] @Insert
  • [ ] @Update
  • [ ] @Delete