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 🙏

© 2025 – Pkg Stats / Ryan Hefner

awsm-users

v0.0.3

Published

AWSM module for user authentication

Downloads

15

Readme

Awsm Users

AWSM Users is an example awsm module around the lifecycle of authentication.

What does this project demonstatrate?

  • Custom API endpoint request templates.
  • Additional Cloudformation Resources (DynamoDB) and IAM roles
  • Shared library code in lib
  • JWT
  • Other HTTP Api endpoint methods

Usage

Asciicast

asciicast

In your JAWS project root directory, run:

jaws module install https://github.com/jaws-framework/jaws-core-js
jaws module install https://github.com/dekz/awsm-users
jaws deploy resources
jaws dash

# Create a User with a POST to <endpoint>/users/create
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
    "email": "jacob@jaws.com",
    "password": "password"
}' '<endpoint>/users/create'
# Authenticate a User with a POST to <endpoint>/users/authenticate. This returns a JWT token
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
    "email": "jacob@jaws.com",
    "password": "password"
}' '<endpoint>/users/authenticate'
# Hit the List endpoint which is behind an authentication wall
curl -H "Authorization: <jwt token>" "<your endpoint>/users/list" 

This will install the awsm modules into your project and save the resource creations into your cloudformation.

Environment Variables

You will need to populate the environment variables provided by the jaws env list command, here is an example:

~/t/j/myproject ❯❯❯ jaws env list dev us-east-1
JAWS: Getting ENV file from S3 bucket: jaws-project in us-east-1
JAWS: ENV vars for stage dev:
JAWS: ------------------------------
JAWS: us-east-1
JAWS: ------------------------------
JAWS_STAGE=dev
JAWS_DATA_MODEL_STAGE=dev
USERS_TABLE=jaws-users
JWT_SECRET=abcd
JWT_ISSUER=jacob


JAWS: awsm.json:lambda.envVars and regions where they are used (red means NOT defined in region):
JAWS: ------------------------------
JAWS: USERS_TABLE
JAWS: ------------------------------
JAWS: aws mods using: users/create/awsm.json,users/authenticate/awsm.json,users/list/awsm.json
JAWS: regions: us-east-1

JAWS: ------------------------------
JAWS: JWT_SECRET
JAWS: ------------------------------
JAWS: aws mods using: users/authenticate/awsm.json
JAWS: regions: us-east-1

JAWS: ------------------------------
JAWS: JWT_ISSUER
JAWS: ------------------------------
JAWS: aws mods using: users/authenticate/awsm.json
JAWS: regions: us-east-1

USERS_TABLE must be set to: jaws-users (for now)

Can I use this project in Production

No

TODO

  • [x] Create Users
  • [x] List Users
  • [x] Authenticate Users
  • [ ] Delete Users

Putting a lambda behind an authentication wall

Your API endpoint must pull out the Autheorization parameter and pass that through. Here is an example of a Request Template which pulls out the Auth token and sets it onto the event. See list awsm.json

      "RequestTemplates": {
        "application/json": "{\"Authorization\":\"$input.params('Authorization')\"}"
      }

Verify before doing any work in your Lambda, See list lambda as an example.

module.exports.run = function(event, context, cb) {
  return verify(event.Authorization)
    .then(action)
    .then(function(result) {
      cb(null, result);
    })
    .error(function(error) {
      debug('List Users Failed: %s', JSON.stringify(error));
      cb(error, null);
    });
};