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

jovo-db-dynamodb

v3.6.1

Published

> To view this page on the Jovo website, visit https://v3.jovo.tech/marketplace/jovo-db-dynamodb

Readme

Amazon DynamoDB Database Integration

To view this page on the Jovo website, visit https://v3.jovo.tech/marketplace/jovo-db-dynamodb

Learn how to store user specific data of your Alexa Skills and Google Actions to AWS DynamoDB.

Tutorial: Add DynamoDB to Store User Data

Introduction

The DynamoDB integration allows you to store user session data in the NoSQL service running on AWS. This integration is especially convenient if you're running your voice app on AWS Lambda. You can find the official documentation about DynamoDB here: aws.amazon.com/dynamodb.

Learn more about hosting your application on AWS Lambda.

Configuration

Download the package like this:

$ npm install --save jovo-db-dynamodb

DynamoDB can be enabled in the src/app.js file like this:

// @language=javascript

// src/app.js

const { DynamoDb } = require('jovo-db-dynamodb');

// Enable DB after app initialization
app.use(new DynamoDb());

// @language=typescript

// src/app.ts

import { DynamoDb } from 'jovo-db-dynamodb';

// Enable DB after app initialization
app.use(new DynamoDb());

If you're running your code on Lambda, you can simply integrate a DynamoDB table like this in your config.js file:

// @language=javascript

// src/config.js

module.exports = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
        },
    },

    // ...

};

// @language=typescript

// src/config.ts

const config = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
        },
    },

    // ...

};

In case you're hosting your voice app somewhere else, you need to additionally add AWS config:

// @language=javascript

// src/config.js

module.exports = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
            awsConfig: {
                accessKeyId: 'yourAccessKeyId',
                secretAccessKey: 'yourSecretAccessKey', 
                region:  'yourRegion',
            },
        },
    },

    // ...

};

// @language=typescript

// src/config.ts

const config = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
            awsConfig: {
                accessKeyId: 'yourAccessKeyId',
                secretAccessKey: 'yourSecretAccessKey', 
                region:  'yourRegion',
            },
        },
    },

    // ...

};

You can find a detailed guide by Amazon about setting up your DynamoDB for programmatic access here (In case you're hosting your voice app somewhere else): Setting Up DynamoDB (Web Service).

Once the configuration is done, the DynamoDB database integration will create a DynamoDB table on the first read/write attempt (might take some seconds). No need for you to create the table.

Global secondary indexes

You have the option to add global secondary indexes(GSI) to your DynamoDB table based on the user data. This gives you more flexibility on data access requirements for your user table.

Without GSI, Jovo will create records with two keys in DynamoDB, userId and userData. Example:

// example of data saved in DynamoDB

"Items": [
    {
        "userId": "user-id-1",
        "userData": {
            "data": {
                "yourKey": 1
            }
            ...
        }
    },
    {
        "userId": "user-id-2",
        "userData": {
            "data": {
                "yourKey": 0
            }
            ...
        }
    },
    {
        "userId": "user-id-3",
        "userData": {
            "data": {
                "yourKey": 1
            }
            ...
        }
    }
]

If you want to query your user data based on other properties, you can't without GSIs.

When you configure DynamoDB to use GSI, Jovo behind the scenes will project keys you've specified to the root level. This will allow you to perform DynamoDB queries based on properties inside user data.

GSIs configuration example:

// @language=javascript

// src/config.js

module.exports = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
            awsConfig: {
                accessKeyId: 'yourAccessKeyId',
                secretAccessKey: 'yourSecretAccessKey', 
                region:  'yourRegion',
            },
            globalSecondaryIndexes: [{
                IndexName: "yourKeyIndex",
                KeySchema: [
                    {
                    AttributeName: "yourKey",
                    // The type you want to store it as. 
                    // LIMITATION: According to DynamoDB docs, HASH and SORT keys can only be "N","S","B".
                    AttributeType: "N", 
                    KeyType: "HASH",
                    // The path from Jovo's userData you want to query on. In this case we want to perform queries based on "yourKey".
                    Path: "data.yourKey",
                    },
                ],
                ProvisionedThroughput: {
                    ReadCapacityUnits: 2,
                    WriteCapacityUnits: 2,
                },
                Projection: {
                    ProjectionType: "ALL",
                },
            }],
        },
    },
};

// @language=typescript

// src/config.ts

const config = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
            awsConfig: {
                accessKeyId: 'yourAccessKeyId',
                secretAccessKey: 'yourSecretAccessKey', 
                region:  'yourRegion',
            },
            globalSecondaryIndexes: [{
                IndexName: "yourKeyIndex",
                KeySchema: [
                    {
                    AttributeName: "yourKey",
                    // The type you want to store it as. 
                    // LIMITATION: According to DynamoDB docs, HASH and SORT keys can only be "N","S","B".
                    AttributeType: "N",
                    KeyType: "HASH",
                    // The path from Jovo's userData you want to query on. In this case we want to perform queries based on "yourKey".
                    Path: "data.yourKey",
                    },
                ],
                ProvisionedThroughput: {
                    ReadCapacityUnits: 2,
                    WriteCapacityUnits: 2,
                },
                Projection: {
                    ProjectionType: "ALL",
                },
            }],
        },
    },
};

The above configuration will project userData.data.yourKey to the root level of the record. Using the example data above, it will transform the data to look something like this:

// example of data saved in DynamoDB

"Items": [
    {
        "userId": "user-id-1",
        "yourKey": 1, // <---- New field added
        "userData": {
            "data": {
                "yourKey": 1
            }
            ...
        }
    },
    {
        "userId": "user-id-2",
        "yourKey": 0, // <---- New field added
        "userData": {
            "data": {
                "yourKey": 0
            }
            ...
        }
    },
    {
        "userId": "user-id-3",
        "yourKey": 1, // <---- New field added
        "userData": {
            "data": {
                "yourKey": 1
            }
            ...
        }
    }
]

You can now peform DynamoDB queries based on 'yourKey'.

Provisioned throughput

You can specify the provisioned throughput of your DynamoDB table.

// @language=javascript

// src/config.js

module.exports = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
            awsConfig: {
                accessKeyId: 'yourAccessKeyId',
                secretAccessKey: 'yourSecretAccessKey', 
                region:  'yourRegion',
            },
            provisionedThroughput: {
                ReadCapacityUnits: 1,
                WriteCapacityUnits: 1,
            },
        },
    },
};

// @language=typescript

// src/config.ts

const config = {
    
    db: {
        DynamoDb: {
            tableName: 'yourTableName',
            awsConfig: {
                accessKeyId: 'yourAccessKeyId',
                secretAccessKey: 'yourSecretAccessKey', 
                region:  'yourRegion',
            },
            provisionedThroughput: {
                ReadCapacityUnits: 1,
                WriteCapacityUnits: 1,
            },
        },
    },
};

By default if you don't provide a provisioned throughput configuration, Jovo will apply the following to the DynamoDB table and to each global secondary index:

    provisionedThroughput: {
        ReadCapacityUnits: 5,
        WriteCapacityUnits: 5,
    },

Troubleshooting

Here are a few things you need to consider when switching from a different database to DynamoDB:

  • DynamoDB does not allow empty strings ("") as values: If you use them, please switch to null or a different value