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

@lafken/auth

v0.6.4

Published

Simplify creation and management of Amazon Cognito User Pools and Client

Readme

@lafken/auth

@lafken/auth simplifies the creation and management of Amazon Cognito User Pools and User Pool Clients. It allows you to configure authentication flows, password policies, and standard attributes, as well as extend functionality using Lambda triggers through extensions.

Installation

npm install @lafken/auth

Configuration

Add the AuthResolver from the @lafken/auth/resolver library to your application configuration.

import { AuthResolver } from '@lafken/auth/resolver';

createApp({
  name: 'awesome-app',
  resolvers: [
    new AuthResolver({
      name: 'my-auth',
      userPool: {
        // ... user pool configuration
      },
      userClient: {
        // ... user client configuration
      }
    }),
  ],
  ...
});

Features

Configuring User Pool and Client

You can fully customize the User Pool and Client behaviors using userPool and userClient options.

new AuthResolver({
  name: 'customer-auth',
  userPool: {
    selfSignUpEnabled: true,
    signInAliases: { email: true },
    passwordPolicy: {
      minimumLength: 8,
      requireUppercase: true,
    },
  },
  userClient: {
    generateSecret: false,
    authFlow: ['ALLOW_USER_PASSWORD_AUTH', 'ALLOW_REFRESH_TOKEN_AUTH'],
  }
})

Extensions (Triggers)

@lafken/auth supports extending Cognito functionality using Lambda triggers. You can define "Extensions" which are classes decorated with @AuthExtension, containing methods decorated with @Trigger.

  1. Define an Extension:
import { AuthExtension, Trigger } from '@lafken/auth';

@AuthExtension()
export class AuthTriggers {
  @Trigger({ type: 'preSignUp' })
  async preSignUp(event: any) {
    console.log('User is signing up:', event.userName);
    return event;
  }

  @Trigger({ type: 'postConfirmation' })
  async postConfirmation(event: any) {
    console.log('User confirmed:', event.userName);
    return event;
  }
}
  1. Register the Extension:

Pass the extension class to the extensions property in AuthResolver.

new AuthResolver({
  name: 'app-auth',
  // ... other config
  extensions: [AuthTriggers],
})

Extending with Custom Logic

You can also use the extend callback to directly access the underlying CDK/Terraform resources (depending on the provider) or add custom resources related to the auth stack.

new AuthResolver({
  name: 'extended-auth',
  extend: ({ userPool, userPoolClient, scope }) => {
    // Access underlying constructs to add advanced configurations
    // or add related resources to the scope
  }
})