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

awsm-npm-registry

v0.0.4

Published

Simple serverless NPM registry

Downloads

2

Readme

awsm-npm-registry

This awsm provides super simple serverless private NPM registry, with fallback to official npmjs.org registry. It uses S3 for storing packages and metadata. Releases can be uploaded directly to configured S3 bucket and publish action will automatically pick them up and update the metadata for given package, given that S3 event notifications for lambda are set up.

Please be aware that support for NPM features is currently limited. Current version supports fetching packages only with exact version number, latest or versions with caret.

Setup

  1. Install JAWS npm install -g jaws-framework and create a new project jaws project create

  2. Install this module npm install inbot/awsm-npm-registry --save

  3. Set required ENV variables.

    # Set your registry bucket name. Value should be <stage>.registry.<domain>, domain being the value that you entered when you created a new JAWS project or stage.
    jaws env set <stage> all REGISTRY_BUCKET_NAME <bucket_name>
       
    # Set registry bucket region. Region is the same region that you selected when creating the project or new stage. 
    jaws env set <stage> all REGISTRY_BUCKET_REGION <region>
       
    # Optional: Disable fallback to npmjs.org registry when package is not found from your registry. Defaults to false.
    jaws env set <stage> all REGISTRY_FALLBACK_DISABLED true
  4. Tell JAWS to update and deploy CloudFormation stack with additional resources added from awsm-npm-registry module. Run jaws deploy resources <stage> <region>

  5. Deploy your project with jaws dash. Remember to select all awsm-npm-registry related actions and endpoints.

  6. Notice the API Gateway endpoint URL that is printed out. This will be the base URL of your registry.

  7. Set up S3 event notifications for your publish lambda

Now you should have a private NPM registry to be used with NPM.

Set up S3 event notifications

S3 event notifications are not currently automatically created due some limitations on awsm CloudFormation templates. You need to configure S3 notifications manually for every stage, but only once.

Check out Enabling Event Notifications on how to enable event notifications for a lambda.

Lambda function that you are looking for is <stage>-<project_name>-l-lAwsmNpmRegistryPublish-*. Open tab Event Sources and click Add event source. Fill in the following values and submit.

Event source: S3
Bucket: <stage>.registry.<domain>
Event type: Object created (All)
Suffix: .tgz

Now lAwsmNpmRegistryPublish lambda should receive an event whenever new tarballs are pushed to the S3 bucket.

Publish packages

New packages can be published to registry simply by uploading them to the S3 bucket. Just use npm pack to create a tarball and then upload it to S3 bucket under path <package_name>/

$ cd npm-package
$ npm pack
npm-package-0.0.1.tgz

$ aws s3 cp ./npm-package-<version>.tgz s3://<stage>-<domain>/<package_name>/ --acl public-read

TODO

  • set up S3 notifications automatically for lambda via CloudFormation stack
  • support for npm publish
  • better support for semver version queries.
  • better error handling for main action.
  • authentication
  • figure out ENV variables automatically