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

simdown

v0.1.7

Published

Cloud stack simulator using node.js and leveldb

Downloads

8

Readme

SimDown

Faithful simulation of AWS Cloud Services using node.js and leveldb, useful for testing interactions with AWS

Build Status

Highlights

  • State Management - capture, save, and restore state for all APIs
  • API Call Hooks - callbacks before and after any API call
  • 100% node.js - no need for external dependencies
  • Performance - all services can be run in-process for better performance, debugging, and flexibility
  • Multi-API flows - test interaction across multiple APIs using multiple components

Services

  • APIGateway (still under construction)
  • CognitoIdentity
  • CognitoIdentityServiceProvider
  • Kinesis
  • DynamoDB
  • Lambda (coming soon)
  • S3 (coming soon)
  • IAM (roles only)

Why SimDown?

Testing applciations that work with AWS API's can be difficult because there's no way to simulate them locally. Existing solutions like localstack, s3rver, and many others are awesome (!) but they have a few important shortcomings:

  • No ability to save/restore API state
  • No hooks before/after method calls
  • Missing important services
  • Services missing important features
  • Inconsistent implementation and testing
  • Multiple languages and binary dependencies

SimDown launches a series of http servers that simulate AWS services. The services can interact with each other to properly simulate Amazon's real system. In the background SimDown keeps track of AWS state using leveldb, which allows a lot of flexible storage options.

Usage

Command Line

SimDown has a simple CLI that runs simulations and manages API states. To learn more, run simdown help

Start simulaiton services

simdown start

This will startup all AWS simulators locally and print out their addresses eg:

Save current state

simdown save [yourStateName]

SimDown will stash all API states into a compressed binary file for efficient storage. If no name is provided a timestamp will be used.

Load a saved state

simdown load [yourStateName]

The current API state will be cleared and a previously saved state will be loaded.

List saved states

simdown list

Displays a list of all archived states.

Remove a saved state

simdown remove [yourStateName]

Deletes an archived state. Does not affect the current API state.

Programmatic Usage

Server

Setup a SimDown server

  const SimDown = require('simdown')

  const simdown = new SimDown()
  simdown.setup((err, endpoints) => {
    console.log(endpoints['CognitoIdentity'])   // http://localhost:14353
  })

Close down a running server

  simdown.stop(() => {
    console.log("Finished cleaning up")
  })

Client

To use SimDown, simply use the endpoint option of the AWS SDK (works from browser, node, python, Java, or any AWS SDK)

  const AWS = require('aws-sdk')

  const cognito = new AWS.CognitoIdentity({
    region: 'us-east-1',
    endpoint: 'http://localhost:14353'
  })

Hooks

Hooks allow you to specify functions to be called before/after a given API call. They'll be passed a copy of the incoming request for inspection/modification.

  function beforeTableCreate(callPath, data, done) {
    console.log("Before", callPath.join(':')) // outputs "Before DynamoDB:CreateTable"
    done()
  }

  const simdown = new SimDown({
    hooks: {
      'DynamoDB:CreateTable:before': beforeTableCreate
    }
  })

Thanks

Coverage for DynamoDB and Kinesis come from mhart's excellent simulators:

  • Kinesis: https://github.com/mhart/kinesalite
  • DynamoDB: https://github.com/mhart/dynalite