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

cute-dynamo

v0.7.1

Published

DynamoDB with minimalism.

Downloads

203

Readme

cute-dynamo

Make DynamoDB cute with minimalism; worry about network costs later.

Features

  • Fast development.
  • Simple syntax.
  • No pain.

Why

cute-dynamo solves a very fundamental problem with DynamoDB: and that is, development is slow...
With this design, we define rules that allow you to use DynamoDB across different projects without having custom code for each project.

Cute puts are minimalistic and are serialized JSON objects. This means you can define your data and everything in plain js code. No more writing DynamoDB relevant syntax and worrying about data types.
By design of DynamoDB, each item is limited to 400kb in size no matter how many attributes anyway.

There can't be cute without development speed.

Getting Started

Installation

npm install cute-dynamo

Usage

import { init, table } from 'cute-dynamo';

// Initialization 
//
// Depending on your application context (server-side or client-side), two ways for init:
// (FIRST WE SHOW THE PREFFERED WAY)
// .env variables: DYNAMODB_TABLE, AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
 await init();
// ALTERNATIVE WAYS TO INIT
// Server-Side Initialization (using AWS Access Key ID and AWS Secret Access Key):
// IF YOU DONT WANT TO USE ENV VARS
 await init({
     region: 'us-east-1',
     accessKeyId: 'AKIAEXAMPLE',
     secretAccessKey: 'secret'
 });
 
// Initialize with Cognito Identity Pool ID for client-side usage
// IF YOU DONT WANT TO USE ENV VARS
 await init({
     region: 'us-east-1',
     identityPoolId: 'us-east-1:exampleId'
 });

// Putting Items into DynamoDB
// To store an item you can use put. This implemenation should transform the way you use put.
// You can deep nest anything and no setup. 
// This is the basic structure
await table().at().put();
// You can use plain js objects for your data because it gets serialized to a JSON
await table('tableName').at({'yourPKkeyName': 'PKvalue', 'yourSKname': 2711900504}).put({'comment': 'simple'});
await table('tableName').at({'yourPKkeyName': 'PKvalue', 'yourSKname': 2711900504}).put({'comments': ['comment1', 'comment2']});
 // YES YOU CAN NEST ANY LIST OR MAP AS COMPLICATED AS YOU LIKE
 // You can log the response as well.

// Getting Items from DynamoDB
// This is the basic structure
await table().at().get();
// Retrieving an item using both a primary key and a sort key:
 const item = await table('yourtablename').at({'yourPKkeyName': 'PKvalue', 'yourSKname': 1711900504}).get();
 console.log(item);
 
// Query 
table().at().query(count, descending)

const items = await table('yourtablename').at({ PK: 'CategoryA' }).query(10, true);
console.log(items);
// provide a start key for pagination
await table('yourtablename').at({ PK: 'User#123', SK: 123 }).query(2, false); // SK start key

// These examples cover the basic operations to get you started with cute-dynamo. 
// By following the minimalistic design principles of cute-dynamo, you 
// can ensure a consistent and simplified approach to working with DynamoDB across your projects.

FYI

| DynamoDB Call | Estimated Time (ms) | Explanation | |-------------------------------------------------|---------------------|----------------------------------------------------------------------------------------------------| | PK lookup in PK-only table | 5 - 50 | Direct GetItem access with only a PK. Fast and efficient. | | PK lookup in PK-SK table | N/A | Direct lookup not possible without SK. Use Query instead. | | PK and SK lookup in PK-SK table | 5 - 50 | Direct GetItem access with both PK and SK. Very fast and efficient for accessing a single item. | | PK Query in PK-SK table (single item) | 10 - 100 | Query based on PK, fast if there's only one item for the PK. | | PK Query in PK-SK table (multiple items) | 20 - 200 | Query based on PK, might take longer depending on the number of items returned. | | Full Scan on any table (small table <1k items) | 100 - 1000 | Scans are slower and more resource-intensive, time increases with item size and count. | | Full Scan on any table (large table >10k items) | 1000 - 5000+ | Significantly slower, highly dependent on table size, item size, and scan configuration. | | Conditional Query on PK-SK table (filters) | 20 - 200 | Using Query with additional filters can increase time, depending on complexity and results size. |