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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ez-dynamo

v0.2.0

Published

A library for easily interacting with DynamoDB, built ontop of the DynamoDB DocumentClient.

Downloads

2

Readme

Ez (Easy) DynamoDB

Thanks for having a look at my library for simplifying your Node DynamoDB usage!

This module is designed to reduce the effort required to get up and running with DynamoDB and make it a bit more friendly to use than the standard DynamoDB DocumentClient.

While this is a lot easier to use than basic DynamoDB it is generally still quite complex as it uses a lot of somewhat confusing language of the DynamoDB API still, documentation of the Document Client can be found here.

Why?

First question you might ask is why I might make another library for this as there are some pretty good libraries out there already. That's a very good question, one that I've asked myself a few times since starting this! The main reasons are as follows:

  1. Simple and easy to use out of the box - some of the libraries out there right now take some time to get setup properly.
  2. Convention over configuration - some of the libraries out there give you the ability to configure every single option of Dynamo, while in my experience the vast majority of options for standard projects should be left as standard until a specific use case is found.
  3. Pure JS - Typescript is great, but not the perfect tool for every project. Sometimes you might want to put together a quick script or Lambda that performs some basic Dynamo calls, your database library shouldn't impose a language choice on you.
  4. Parameter builder, not a Modeling tool - Modeling tools are nice, like Mongoose or Sequelize, but often you as the developer end up learning the intricacies of the library rather than the database itself. This knowledge is non-transferable between languages and sometimes even frameworks - I'm not trying to lock you in like that. Ideally this library should only simplify creating Dynamo parameters; ideally when building queries you will still be looking at the Dynamo docs to understand how certain parameters work (rather than docs for this library).

Examples

Some some quick examples! To get the full ins and outs of this look into the examples directory where I have fleshed out some full examples of how this stuff works.

So, lets see how easy it is to create a table, write something and then get it back:

let userTable = new Table("usersTable")
  .primary("username")
  .sort("lastLogin")
  .schema({
    username: schema.string(),
    lastLogin: schema.number(),
    email: schema.string().email(),
    admin: schema.boolean(),
    preferences: schema.object(),
  })
  .addGlobalIndex("email-index", "email")
  .writeCapacity(2)
  .readCapacity(2);
await userTable
  .put({ 
    username: "mdrury", 
    lastLogin: date, 
    email: "[email protected]", 
    admin: true 
  }).run();
return await userTable
  .get()
  .primary("mdrury")
  .sort(date)
  .properties(["email", "admin", "username", "preferences"])
  .run();

Inspirations

  1. dynamodb - loved the use of JOI as a validation library.
  2. dynamo-easy - a fantastic library for Typescript which has inspired me in terms of syntax cascading for query/update building. If you're reading this I'm sorry about the close choice of name, I actually picked my name before even seeing this library!