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 🙏

© 2026 – Pkg Stats / Ryan Hefner

micro-kit-aws-queue

v3.3.0

Published

A generic queuing module using Amazon SNS/SQS.

Readme

module-aws-queue

This module implements a generic queue using Amazon SNS/SQS to allow micro-services to communicate without having to use AWS directly.

Endpoints

Note that all endpoints are asynchronous, returning a promise that gets resolved once the endpoint has completed.

ensureTopicExists(topic)

Check to see if the given topic exists in SNS. If not, the topic is created.

The returned promise will be resolved with the ARN for the desired topic.

publishToTopic(message, topic)

Publish the given message to the given topic (which is automatically assured)

message must be either a string or a JSON-compatible data structure.

ensureQueueExists(queue)

Ensure the given queue exists in SQS. If not, the queue is created.

The returned promise will be resolved with the ARN for the queue.

subscribeQueueToTopic(queue, topic)

Given a queue and topic name, subscribe the given queue to the given topic.

The returned promise will be resolved with the ARN for the subscription.

listenToQueue(queue, frequency, callback)

Regularly poll the given queue to see if any new messages have arrived. The parameters are as follows:

  • queue: the name of the queue to listen to.
  • frequency: the desired polling frequency, in seconds.
  • callback: an asynchronous function which takes a single parameter, message, which is a string containing the message received from the queue.

Note that the callback function is asynchronous; when the returned promise is resolved, the message will be removed from the queue.

stopListeningToQueue(queue)

Stop polling for new messages on the given queue.

sendMessageToQueue(queue, message)

Sends message to the queue, queue must be name of the queue and message must be either a string or a JSON-compatible data structure.

The returned promise will be resolved with the MessageId.

Configuration

This module uses dotenv to store configuration details in an environment file. It looks for a file named .env in the current directory, and loads the following configuration settings from this file:

  • AWS_REGION: The desired AWS region string.
  • AWS_ACCESS_KEY_ID: The access key to use for authentication.
  • AWS_SECRET_ACCESS_KEY: The secret to use for authentication.
  • SNS_ENDPOINT: An optional URL to use for accessing the SNS server. Leave undefined to use the default AWS server.
  • SQS_ENDPOINT: An optional URL to use for accessing the SQS server. Leave undefined to use the default AWS server.

Compiling

The queuing module uses flow for type checking. To check that the code is all using the correct data types, type:

npm run flow

To strip the flow data type definitions from the source, type:

npm run build

This creates a plain-vanilla JS version of the module in the flow-typed directory.

Testing

Note that you must type npm run build before running any of these tests.

To run the unit tests:

npm run unit

To run the integration tests:

npm run integration

You must have the AWS credentials set in the .env file for this to work.

To run Istanbul coverage:

npm run coverage

To check that the source matches the Javascript Standard Style rules:

npm run standard

How to set up local AWS SQS/SNS for development

Use this project, docker version or go https://github.com/p4tin/goaws

You can find more about docker here: https://docs.docker.com/engine/installation/

Docker version: All you need to do is run this commands Command to download the image:

docker pull pafortin/goaws

Command to run it on port 4100:

docker run -d --name goaws -p 4100:4100 pafortin/goaws

You can also run it with docker-compose. Create a file docker-compose.yml and insert this code:

awsQueue:
  restart: always
  container_name: awsQueue
  image: pafortin/goaws
  ports:
  - "4100:4100"

Then run the file with command

docker-compose up

Now you have your own AWS SQS/SNS systems on http://localhost:4100

To-Do

Still to do:

  • A gitlab-ci file for automated testing.

  • Docker configuration to run the tests on Docker.

  • Documentation needs update