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 🙏

© 2025 – Pkg Stats / Ryan Hefner

best-dynamo-js

v0.1.2

Published

A collection of middlewares and custom commands that make using DynamoDB with javascript easier

Downloads

49

Readme

best-dynamo-js

Why

DynamoDB is a great scalable DB, but it still has lots of frictions with regards to developer experience. This repo was created to be the best toolkit for addressing these frictions in js. It leverages the v3 @aws-sdk/client-dynamodb, as well as the @aws-sdk/lib-dynamodb enhancement library.

Goal

To create the best, most useful set of middlewares and utility commands to make your experience with dynamo in js better.

Usage

npm install best-dynamo-js

Middlewares

In order to use the middlewares, they simply need to be imported and added to the middlewareStack that is part of the dynamo client. For example:

import { DynamoDB } from '@aws-sdk/client-dynamodb'
import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb'
import { commands, middlewares } from 'best-dynamo-js'

const client = DynamoDBDocument.from(new DynamoDB({ ...config }))

// add a middleware to the stack (without options the default is for the initialisation step)
client.middlewareStack.add(middlewares.attributeEnhancer)

Below is the current list of available middlewares:

  • attributeEnhancer

The most annoying thing about using dynamo is having to create aliases for attributes and values throughout your requests. This middleware automatically generates these aliases for you behind the scenes, allowing you to make far simpler, and readable requests. For example:

const response = await client.query({
  TableName: 'my-table',
  IndexName: 'my-index',
  KeyCondition: 'some_variable > 5 and some_text = "hello",
  ProjectionExpression: 'keyA, keyB, keyC'
})

This will automatically parse the values, and generate appropriate aliases behind the scenes, transforming the input into valid dynamo input.

Commands

A lot of the time when using dynamo you find yourself rewriting common utility functions for doing things that should probably be built in. While built in commands within dynamo can be called via client.command, these utility functions require client to usually be passed in as the first param. This it to maintain extensibility with this repo, and not step on dynamos toes. Below are the available extra commands:

  • queryAll(client, input)

This automatically manages ExclusiveStartKey pagination, and returns the full item set for a given query:

const items = await queryAll(client, {
  TableName: 'my-table',
  KeyCondition: 'test = "something"
})
  • scanAll(client, input)

This is similar to the queryAll function, but for scanning. It handles pagination behind the scenes and returns the full scanned set:

const items = await scanAll(client, {
  TableName: 'my-table'
})

Credits

This library was built @Wethrift