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

lambdakit

v0.0.15

Published

A strategy for working with lambdas.

Downloads

22

Readme

Lambdakit

A strategy for working with lambdas.

Circle CI

  • Run lambdas locally
  • Deploy lambdas locally
  • Deploy lambdas via CI

This is an opinionated setup for your API, where lambdas reside together. Obviously you can use this setup by bringing in lambdas as submodules or packages if you’d like to maintain seperate reops.

Usage

npm install lambdakit

This project has a detailed example in ./example. To run the example, cd into that directory, npm_install, and run commands from there.

Run

To run a lambda, make a file called event.js that consists of module.exports of whatever request you’d give the lambda, which is often just JSON, then use the run command below with the name of the folder/lambda.

node node_modules/lambdakit --run=weather

Deploy

To deploy, simply have the config in place (see below), then run the following command. It will npm install inside each lambda, wrap it all up in a ZIP, then inject it into your AWS stack, BAM!

# roll thru all lambdas
node node_modules/lambdakit --deploy
# deploy a specific lambda (ie. weather)
node node_modules/lambdakit --deploy=weather

Note: node modules can easily be added to each lambda. Packages that require more advanced processing may need to be compiled against lambda infrastucture, but this is rare. Keep in mind, there are a few built-in node modules that are available.

Config

  1. Add this to package.json (You can omit if your values are the same as these are defaults)
"lambdakit": {
  "region": "us-east-1",
  "path-to-lambdas": "/lib/lambdas",
  "path-to-lambdas": "/lib/shared",
  "prefix_with_branch_name": true
}
  • region: the AWS region where your lambdas reside
  • path-to-lambdas: is the path to the folder that holds the lambdas. Currently each folder that holds lambda contents needs to match the lambda name in AWS.
  • path-to-shared: (optional) is the path to a shared resources folder that will get copied to the root of each applicable lambda on deploy and run.
  • prefix_with_branch_name: (bool) If you are on the branch beta, then the lambda weather will deploy to beta-weather. This supports a branch-based stage strategy. You will need to create lambdas named for each branch/stage that deploys on AWS. This only affects deployment, not local development.
  1. Add config.aws.lambdakit.js for local deploy (You can omit if using local cli config
process.env.AWS_ACCESS_KEY_ID = 'XXX';
process.env.AWS_SECRET_ACCESS_KEY = 'XXX';

2b) To deploy on commit from your CI, install creds on your project in the CI settings. In the case of CircleCI, it’s done at the URI pattern https://circleci.com/gh/myOrg/myProject/edit#aws. See the /example/circle.yml for the CI command.

  1. You’ll want to update your .gitignore to include the following, as your nested lambdas will be projects in and of themselves
**/node_modules/**
/exports/*
/config.aws.lambda.js

Roadmap

  • Test coverage
  • Deploy a single lambda
  • Compare diff to only push changed lambdas