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/standalone

v0.12.12

Published

Define Lambdas using TypeScript decorators - serverless event-driven infrastructure

Readme

@lafken/standalone

Define standalone AWS Lambda functions using TypeScript decorators. @lafken/standalone lets you declare independent Lambda handlers that can be invoked by other services, and automatically wires them up with optional IAM invoke roles and global references.

Installation

npm install @lafken/standalone

Getting Started

Define a standalone class with @Standalone, add @Handler methods, and register everything through StandaloneResolver:

import { createApp, createModule } from '@lafken/main';
import { StandaloneResolver } from '@lafken/standalone/resolver';
import { Standalone, Handler } from '@lafken/standalone/main';

// 1. Define standalone handlers
@Standalone()
export class OrderFunctions {
  @Handler()
  processOrder() {
    console.log('Processing order...');
  }
}

// 2. Register in a module
const orderModule = createModule({
  name: 'order',
  resources: [OrderFunctions],
});

// 3. Add the resolver to the app
createApp({
  name: 'my-app',
  resolvers: [new StandaloneResolver()],
  modules: [orderModule],
});

Each @Handler method becomes an independent Lambda function ready to be invoked by other services.

Features

Standalone Class

Use the @Standalone decorator to group related Lambda handlers in a single class:

import { Standalone, Handler } from '@lafken/standalone/main';

@Standalone()
export class NotificationFunctions {
  @Handler()
  sendEmail() { }

  @Handler()
  sendSms() { }
}

Custom Handler Name

By default the method name is used as the Lambda handler identifier. Override it with the name option:

@Handler({ name: 'process-payment' })
handlePayment() { }

Invoke Role

Configure an IAM role that grants another principal permission to invoke the Lambda. When invocator is provided, a dedicated invoke role is created and attached to the function:

@Handler({
  invocator: {
    principalRole: 'apigateway.amazonaws.com',
    services: [
      {
        type: 'execute-api',
        permissions: ['Invoke'],
        resources: ['*'],
      },
    ],
    roleRef: 'processOrderInvokeRole',
  },
})
processOrder() { }

Invocator Options

| Option | Type | Description | | -------------------- | ---------------- | --------------------------------------------------------------------------- | | principalRole | string | AWS service or account ARN allowed to assume the role | | principalPermission| string | Permission level for the principal | | services | ServicesValues | Additional IAM policy statements to include in the role | | roleRef | string | Name to register the created role as a global reference |

Global References

Use ref to register the Lambda function as a named global reference so other resources can access its attributes (e.g. ARN, function name):

@Handler({
  ref: 'processOrderLambda',
})
processOrder() { }

Lambda Configuration

Pass any Lambda-specific settings through the lambda option:

@Handler({
  lambda: {
    timeout: 30,
    memorySize: 512,
    environment: {
      QUEUE_URL: 'https://sqs.us-east-1.amazonaws.com/...',
    },
  },
})
processOrder() { }

Full Example

import { createApp, createModule } from '@lafken/main';
import { StandaloneResolver } from '@lafken/standalone/resolver';
import { Standalone, Handler } from '@lafken/standalone/main';

@Standalone()
export class PaymentFunctions {
  @Handler({
    name: 'process-payment',
    ref: 'processPaymentLambda',
    invocator: {
      principalRole: 'apigateway.amazonaws.com',
      services: [
        {
          type: 'execute-api',
          permissions: ['Invoke'],
          resources: ['*'],
        },
      ],
      roleRef: 'processPaymentInvokeRole',
    },
    lambda: {
      timeout: 30,
      memorySize: 256,
    },
  })
  processPayment() { }

  @Handler({
    ref: 'refundPaymentLambda',
  })
  refundPayment() { }
}

const paymentModule = createModule({
  name: 'payment',
  resources: [PaymentFunctions],
});

createApp({
  name: 'my-app',
  resolvers: [new StandaloneResolver()],
  modules: [paymentModule],
});