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

scandium

v1.0.0-alpha.73

Published

> Easily deploy any Node.js web server to AWS Lambda.

Downloads

60

Readme

Scandium

Easily deploy any Node.js web server to AWS Lambda.

Scandium can deploy your Express, Koa or similar app to lambda, without any modifications to your code. Combined with AWS API Gateway you can have your current API running serverless in no time 😎

Prerequisites

Scandium requires Node.js, Docker, and a working AWS config w/ credentials. If you are unfamiliar with the AWS config an easy way to get started is to install the AWS CLI and run aws configure.

macOS w/ Brew:

brew install node
brew cask install docker
brew install awscli
aws configure

Linux w/ Snap:

sudo snap install node --classic
sudo snap install docker
sudo snap install aws-cli --classic
aws configure

Windows w/ winget:

winget install OpenJS.NodeJS
winget install Docker.DockerDesktop
winget install Amazon.AWSCLI
aws configure

Installation

npm install --global scandium

Usage

To create a new Lambda function, use the scandium create command. This will package your application and upload it to AWS Lambda, as well as configure an API Gateway in front of your function.

scandium create --name=my-awesome-api

You should now be presented with a url where you can access your api.

Now serving live requests at: https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/default

Whenever you make changes to your app, you can upload a new version of it by using the scandium update command. This will package your application again, and upload it as a new version to the specified Lambda function. It will also update the configuration of the API Gateway to point at the new function.

scandium update --name=my-awesome-api

Tutorials

API Gateway

By default, Scandium will set up an API Gateway that simply forwards all requests to the Lambda function. If you want to utilise the benefits of API Gateway fully, you can provide a Swagger file describing your API endpoints. Pass the --swagger=my-api-definition.yml to either the create or update command and Scandium will configure the API Gateway for you.

Application Load Balancer

The deployed entrypoint has support for being called from an application load balancer, as well as API Gateway. Note that "Multi value headers" must be turned on in the load balancer target group for this to work.

There is currently no support in the Scandium CLI to automatically setup an ALB for you.

prepare/build-scripts

Scandium has support for prepare/build scripts, if the script is present in the package.json it will make sure that the script is being run with full devDependencies installed. The final package being uploaded to Lambda will still only contain the production dependencies.

If both a prepare and a build script is present, Scandium will pick the prepare script.

Ignore files

If there is a .dockerignore file present, that one will be used when building the app. Otherwise, if a .gitignore file is present, that one will be used. If none of these files exists, a built in list that just contains .git and node_modules will be used.

Deploy Hooks

If you want to run any specific script inside the Lambda once during each deploy (e.g. for running database migrations), you can use the --hooks flag. Pass it the name of a file exporting functions for each hook you want to run.

Currently there is only one hook, named deploy, that will run after your Lambda is created, and before the API Gateway is updated to the new Lambda.

Example file:

const runDatabaseMigrations = require('...')

exports.deploy = async function () {
  await runDatabaseMigrations()
}