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

dynamodb-toolkit-lambda

v0.3.0

Published

AWS Lambda adapter for dynamodb-toolkit — serves the standard REST route pack as a Lambda handler for API Gateway (REST / HTTP), Lambda Function URLs, and ALB. Delegates parsing, envelope building, and policy to dynamodb-toolkit/rest-core.

Readme

dynamodb-toolkit-lambda NPM version

AWS Lambda adapter for dynamodb-toolkit v3. Serves the toolkit's standard REST route pack as a Lambda handler — same wire contract as dynamodb-toolkit/handler (the bundled node:http adapter), dynamodb-toolkit-fetch, dynamodb-toolkit-koa, and dynamodb-toolkit-express, translated for Lambda's event / result shape.

Supported event sources:

  • API Gateway REST API (payload format 1.0).
  • API Gateway HTTP API (payload format 2.0).
  • Lambda Function URLs (payload format 2.0).
  • Application Load Balancer (multi-value headers mode and single-value).

Shares the wire contract with the bundled dynamodb-toolkit/handler and the -koa / -express / -fetch siblings — same routes, same envelope, same status codes, same option surface. Auto-detects the incoming event shape at call time and returns the matching result envelope.

Install

npm install dynamodb-toolkit-lambda dynamodb-toolkit @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb

dynamodb-toolkit is declared as a peer dependency. No framework peer dep — AWS Lambda's Node runtime is the target.

Quick start

API Gateway HTTP API (payload 2.0) or Lambda Function URL

import {DynamoDBClient} from '@aws-sdk/client-dynamodb';
import {DynamoDBDocumentClient} from '@aws-sdk/lib-dynamodb';
import {Adapter} from 'dynamodb-toolkit';
import {createLambdaAdapter} from 'dynamodb-toolkit-lambda';

const client = DynamoDBDocumentClient.from(new DynamoDBClient({region: process.env.AWS_REGION}));
const planets = new Adapter({client, table: 'planets', keyFields: ['name']});

export const handler = createLambdaAdapter(planets, {mountPath: '/planets'});

API Gateway REST API (payload 1.0)

Same factory — the adapter auto-detects the payload format from the event shape. The result is the event's corresponding APIGatewayProxyResult or APIGatewayProxyStructuredResultV2.

ALB

Same factory — if the target group has Multi value headers enabled, the adapter mirrors the multiValueHeaders response shape automatically by detecting it on the incoming event.

export const handler = createLambdaAdapter(planets, {mountPath: '/planets'});

Local development

AWS's debugging tools for Lambda-behind-HTTP are cumbersome. This package ships a zero-dep bridge so you can drive the exact Lambda code path against real HTTP requests on localhost — no framework dep, no deploy cycle.

node:http — standalone dev server

import http from 'node:http';
import {createLambdaAdapter} from 'dynamodb-toolkit-lambda';
import {createNodeListener} from 'dynamodb-toolkit-lambda/local.js';

const handler = createLambdaAdapter(planets, {mountPath: '/planets'});
http.createServer(createNodeListener(handler)).listen(3000);
// curl http://localhost:3000/planets

createNodeListener synthesizes a full API Gateway event from each incoming HTTP request (v2 by default; pass {eventShape: 'v1'} to test v1-specific paths), invokes the handler, and writes the Lambda result envelope back through the HTTP response. Binary request bodies are base64-encoded before reaching the handler, matching AWS's binary-media-types behavior.

Fetch runtimes (Bun, Deno, Cloudflare Workers)

import {createLambdaAdapter} from 'dynamodb-toolkit-lambda';
import {createFetchBridge} from 'dynamodb-toolkit-lambda/local.js';

const handler = createLambdaAdapter(planets);
Bun.serve({port: 3000, fetch: createFetchBridge(handler)});

Plug into an existing Koa / Express app

This package doesn't depend on Koa or Express. Copy ~10 lines to bridge manually:

// Koa
import Koa from 'koa';
import {createLambdaAdapter} from 'dynamodb-toolkit-lambda';
import {createNodeListener} from 'dynamodb-toolkit-lambda/local.js';

const listener = createNodeListener(createLambdaAdapter(planets));
const app = new Koa();
app.use(ctx => listener(ctx.req, ctx.res).then(() => (ctx.respond = false)));
app.listen(3000);
// Express
import express from 'express';
import {createLambdaAdapter} from 'dynamodb-toolkit-lambda';
import {createNodeListener} from 'dynamodb-toolkit-lambda/local.js';

const listener = createNodeListener(createLambdaAdapter(planets));
const app = express();
app.use((req, res) => listener(req, res));
app.listen(3000);

For a framework-native story without the bridge — share the same Adapter instance between a Lambda deployment and a Koa / Express / Fetch dev entry, using dynamodb-toolkit-koa / -express / -fetch directly.

Compatibility

  • AWS Lambda, Node 20+ runtime.
  • Payload formats: API Gateway v1 (APIGatewayProxyEvent), v2 (APIGatewayProxyEventV2), Function URLs (payload 2.0), ALB (ALBEvent).
  • peerDependencies: dynamodb-toolkit ^3.1.1 only.

License

BSD-3-Clause.