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

v1.0.1

Published

A simple utility to interact with AWS DynamoDB using the AWS SDK. This package simplifies common DynamoDB operations such as inserting, retrieving, updating, deleting, and querying items. It also supports batch operations and transactional operations.

Readme

DynamoDBHelper

A simple utility to interact with AWS DynamoDB using the AWS SDK. This package simplifies common DynamoDB operations such as inserting, retrieving, updating, deleting, and querying items. It also supports batch operations and transactional operations.

Installation

To install the package, run: "npm install dynamodb-helper"

Usage

1. Initialize DynamoDBHelper To initialize DynamoDBHelper, you need to provide AWS credentials and the region. Here’s how you can do it:

const DynamoDBHelper = require('dynamodb-helper');

"const dynamoHelper = new DynamoDBHelper({ accessKeyId: 'YOUR_ACCESS_KEY_ID', secretAccessKey: 'YOUR_SECRET_ACCESS_KEY', region: 'YOUR_REGION', });"

2. Available Methods

putItem(tableName, item) Adds an item to a DynamoDB table.

tableName: Name of the DynamoDB table. item: The item to add. await dynamoHelper.putItem('YourTableName', { id: '1', itemName: 'TestItem' });

getItem(tableName, key)

Fetches an item from a DynamoDB table using the specified key. tableName: Name of the DynamoDB table. key: The key of the item to retrieve. const result = await dynamoHelper.getItem('YourTableName', { id: '1' }); console.log(result);

query(tableName, queryParams)

Queries items in a DynamoDB table based on the specified query parameters.

tableName: Name of the DynamoDB table. queryParams: Query parameters (e.g., KeyConditionExpression, ExpressionAttributeValues). const result = await dynamoHelper.query('YourTableName', { KeyConditionExpression: 'id = :id', ExpressionAttributeValues: { ':id': '1', }, }); console.log(result);

updateItem(tableName, key, updateExpression, expressionAttributeValues) Updates an item in DynamoDB.

tableName: Name of the DynamoDB table. key: The key of the item to update. updateExpression: The update expression. expressionAttributeValues: Values for the update expression. await dynamoHelper.updateItem('YourTableName', { id: '1' }, 'SET itemName = :newName', { ':newName': 'UpdatedTestItem', });

deleteItem(tableName, key) Deletes an item from DynamoDB.

tableName: Name of the DynamoDB table. key: The key of the item to delete. await dynamoHelper.deleteItem('YourTableName', { id: '1' });

batchWrite(requestItems) Performs a batch write to DynamoDB.

requestItems: A map of request items with PutRequest or DeleteRequest. const batchWriteParams = { 'YourTableName': [ { PutRequest: { Item: { id: '2', name: 'BatchItem1' } } }, { PutRequest: { Item: { id: '3', name: 'BatchItem2' } } }, ], }; await dynamoHelper.batchWrite(batchWriteParams);

batchGet(requestItems) Performs a batch get from DynamoDB.

requestItems: A map of keys for the items you want to retrieve. const batchGetParams = { 'YourTableName': { Keys: [{ id: '2' }, { id: '3' }], }, }; const batchGetResult = await dynamoHelper.batchGet(batchGetParams); console.log(batchGetResult);

transactWrite(transactItems) Performs transactional write operations to DynamoDB.

transactItems: A list of transaction items (Put, Delete, etc.). const transactWriteParams = [ { Put: { TableName: 'YourTableName', Item: { id: '4', name: 'TransactItem1' }, }, }, { Put: { TableName: 'YourTableName', Item: { id: '5', name: 'TransactItem2' }, }, }, ]; await dynamoHelper.transactWrite(transactWriteParams);

transactGet(transactItems) Performs transactional get operations from DynamoDB.

transactItems: A list of transaction items (Get). const transactGetParams = [ { Get: { TableName: 'YourTableName', Key: { id: '4' }, }, }, { Get: { TableName: 'YourTableName', Key: { id: '5' }, }, }, ]; const transactGetResult = await dynamoHelper.transactGet(transactGetParams); console.log(transactGetResult);

scan(tableName, filterParams) Scans a DynamoDB table.

tableName: Name of the DynamoDB table. filterParams: Optional filter parameters for the scan operation. const scanResult = await dynamoHelper.scan('YourTableName'); console.log(scanResult);

3. Error Handling If there is an error while interacting with DynamoDB, the methods will throw an error. Make sure to use try-catch blocks to handle errors.

try { await dynamoHelper.putItem('YourTableName', { id: '1', itemName: 'TestItem' }); } catch (error) { console.error('Error occurred:', error.message); }



This content provides a full overview of how to use your DynamoDBHelper package, including the installation, code examples, and error handling practices.