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';
await init();
await init({
region: 'us-east-1',
accessKeyId: 'AKIAEXAMPLE',
secretAccessKey: 'secret'
});
await init({
region: 'us-east-1',
identityPoolId: 'us-east-1:exampleId'
});
await table().at().put();
await table('tableName').at({'yourPKkeyName': 'PKvalue', 'yourSKname': 2711900504}).put({'comment': 'simple'});
await table('tableName').at({'yourPKkeyName': 'PKvalue', 'yourSKname': 2711900504}).put({'comments': ['comment1', 'comment2']});
await table().at().get();
const item = await table('yourtablename').at({'yourPKkeyName': 'PKvalue', 'yourSKname': 1711900504}).get();
console.log(item);
table().at().query(count, descending)
const items = await table('yourtablename').at({ PK: 'CategoryA' }).query(10, true);
console.log(items);
await table('yourtablename').at({ PK: 'User#123', SK: 123 }).query(2, false);
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. |