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

dynamo-localdb

v0.1.1

Published

Module to launch local dynamodb instance and provide commands to create, load, reload, and delete tables with or without data.

Downloads

5

Readme

dynamo-localdb

Simple node module that is used to launch and setup local running DynanoDB in a development environment. Unlike other NPM dynamodb modules, this project is more a developer's tool than a simple DynamoDB launcher as it provides a client too. The purpose is to allow developers working DynamoDB projects to quickly setup and reset the database to a given configration (data and schemas alike).

Instructions

Commands

let config = { /* ... */ }
let LocalDB = require("dynamo-localdb");
let db = new LocalDB.LocalStore(config);
  • db.start(): Starts the local DynamoDB server.
  • db.kill(): Kills the local running DynamoDB server.
  • db.load(): Configures DynamoDB with the given configuration.
  • db.reload(): Drops all tables, then calls db.load().
  • db.test(): Tests where the module's client can interact with the server.

Installation

npm install dynamo-localdb --save

Requirements

  • Java is required for DynamoDB server.
  • Has only been tested NodeJS v6.9.2.

Examples

Starting up the local DynamoDB server.

let LocalDB = require("dynamo-localdb");
let db = new LocalDB.LocalStore();
db.start().then(() => {
  console.log("DynamoDB server has started. Listening on default port of 8000.")
});

Quick test of the server and client.

let LocalDB = require("dynamo-localdb");
let db = new LocalDB.LocalStore();
db.start().then(() => {
  console.log("DynamoDB server has started.");
  return db.test();
}).then(result => {
  console.log(`Results of Test: ${ result }`);
  return db.kill(); 
}).then(() => {
  console.log("Database sever has been killed");
});

Starting up the local DynamoDB with configuration data for the server.

let LocalDB = require("dynamo-localdb");
let config = {
  server: { port: 3000 }
  client: { region: "us-east-1", endpoint: "http://localhost:3000" }
}
let db = new LocalDB.LocalStore();
db.start().then((config) => {
  console.log("DynamoDB server has started. Listening on port 3000.")
});

Starting up the local DynamoDB with configuration for the schemas, and data.

let LocalDB = require("dynamo-localdb");
let config = {
  schemas: [ 
    /* scheme data as defined by AWS.DynamoDB.createTable() documentation... */
    /* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property */
  ],
  data: {
    "name-of-table": [{
       /* json representation of data for the given table... */
    }]
  }
}
let db = new LocalDB.LocalStore();
db.start().then((config) => {
  console.log("DynamoDB server has started.");
  return db.load();
}).then(() => {
  console.log("DynamoDB server has started")
  console.log("All defined tables and data have been created and inserted.");
  return db.client.list();
}).then(tables => {
  console.log(`List of available tables: ${ tables }`);
});

Configuration

let config = {
  server: { 
    port: 8000
    /* see full list of available options defined at... */
    /* https://github.com/Medium/local-dynamo */
  },
  client: {     
    region: "us-east-1",
    endpoint: "http://localhost:8000",
    accessKeyId: "AKID",
    serectAccessKey: "SECRET"
    /* see full list available options defined at... */
    /* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property */
  },
  schema: [ /* array of schemas */
    {
      /* see AWS.DynamoDB.createTable() documentation */
      /* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property */
    }
  ],
  data: {
    "TABLE-NAME-HERE" : [ /* array of documents for given table */
      {
       /* json representation a documnent's data for the given table... */ 
      }
    ]
  }
}
Note
  • If server.port is changed, the port value must match at client.endpoint.

Troubleshooting

  • Change server process stdio setting to inherit so that stderr pipes to the console.
    • By default server process stdio, is set to ignore.
  • Error: `missing 'server' JVM...' error
    • Follow these steps to resolve.

Licensing and Notices