Dynamoose

A modelling tool for Amazon's DynamoDB.
Inspired by Mongoose.

$

npm install dynamoose --save

Get started

Let's Get Up To Speed

Here's how it works, set your AWS configurations in either:

Your Environment

export AWS_ACCESS_KEY_ID = "Your AWS Access Key ID"
export AWS_SECRET_ACCESS_KEY = "Your AWS Secret Access Key"
export AWS_REGION = "us-east-1"

Programatically

dynamoose.AWS.config.update({
  accessKeyId: 'AKID',
  secretAccessKey: 'SECRET',
  region: 'us-east-1'
});

Let's See It In Action

This simple example creates a Cat model and gets it's name after saving and re-fetching it.

const dynamoose = require('dynamoose'); const dynalite = require('dynalite'); const startUpAndReturnDynamo = async () => { const dynaliteServer = dynalite(); await dynaliteServer.listen(8000); return dynaliteServer; }; const createDynamooseInstance = () => { dynamoose.AWS.config.update({ accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-east-1' }); dynamoose.local(); // This defaults to "http://localhost:8000" } const createAndGetCat = async () => { const Cat = dynamoose.model('Cat', {id: Number, name: String}); const garfield = new Cat({id: 666, name: 'Garfield'}); await garfield.save(); const badCat = await Cat.get(666); return badCat; } const bootStrap = async () => { await startUpAndReturnDynamo(); createDynamooseInstance(); const badCat = await createAndGetCat(); console.log('Never trust a smiling cat. - ' + badCat.name); } bootStrap();