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

hyperform-cli

v0.6.13

Published

![Hyperform Banner](https://github.com/qngapparat/hyperform/blob/master/hyperform-banner.png)

Downloads

12

Readme

Hyperform Banner

⚡ Lightweight serverless framework for NodeJS

  • Unopinionated (Any JS code works)
  • Lightweight (no wrapping)
  • 1-click deploy (1 command)
  • Multi-Cloud (for AWS & Google Cloud)
  • Maintains (provider's conventions)

Install

$ npm install -g hyperform-cli

Usage

  • Everything works like a normal NodeJS app. You can use NPM packages, external files, assets, since the entire folder containing hyperform.json is included with each function.

AWS Lambda

// somefile.js

// AWS Lambda uses 'event', 'context', and 'callback'  convention
// Learn more: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html

exports.foo = (event, context, callback) => {
  context.succeed({
    message: "I'm Foo on AWS Lambda!"
  })
}

exports.bar = (event, context, callback) => {
  context.succeed({
    message: "I'm Bar on AWS Lambda!"
  })
}

// ... 

Create a hyperform.json in the current folder, with your AWS credentials:

{
  "amazon": {
    "aws_access_key_id": "...",
    "aws_secret_access_key": "...",
    "aws_region": "..."
  }
}

In the terminal, type:

$ hyperform deploy somefile.js --amazon --url
  > 🟢 foo https://w3g434h.execute-api.us-east-2.amazonaws.com/foo
  > 🟢 bar https://w3g434h.execute-api.us-east-2.amazonaws.com/bar

... and your functions are deployed & invocable via GET and POST.

Google Cloud Functions

// somefile.js

// Google Cloud uses Express's 'Request' and 'Response' convention
// Learn more: https://expressjs.com/en/api.html#req 
//             https://expressjs.com/en/api.html#res

exports.foo = (req, res) => {
  let message = req.query.message || req.body.message || "I'm a Google Cloud Function, Foo";
  res.status(200).send(message);
};

exports.bar = (req, res) => {
  let message = req.query.message || req.body.message || "I'm a Google Cloud Function, Bar";
  res.status(200).send(message);
};

Create a hyperform.json in the current folder with your Google Cloud credentials:

{
  "google": {
    "gc_project": "...",
    "gc_region": "...",
  }
}

In the terminal, type:

$ hyperform deploy somefile.js --google --url    
  > 🟢 foo https://us-central1-someproject-153dg2.cloudfunctions.net/foo 
  > 🟢 bar https://us-central1-someproject-153dg2.cloudfunctions.net/bar 

... and your functions are deployed & invocable via GET and POST.

Hints & Caveats

  • New functions are deployed with 256MB RAM, 60s timeouts
  • The flag --url creates unprotected URLs to the functions. Anyone with these URLs can invoke your functions
  • The entire folder containing hyperform.json will be deployed with each function, so you can use NPM packages, external files (...) just like normal.

FAQ

Where are functions deployed to?

  • On AWS: To AWS Lambda
  • On Google Cloud: To Google Cloud Functions

Where does deployment happen?

It's a client-side tool, so on your computer. It uses the credentials it finds in hyperform.json

Can I use NPM packages, external files, (...) ?

Yes. The entire folder where hyperform.json is is uploaded, excluding .git, .gitignore, hyperform.json, and for Google Cloud node_modules (Google Cloud installs NPM dependencies freshly from package.json). So everything works like a normal NodeJS app.

How does --url create URLs?

On AWS, it creates an API Gateway API (called hf), and a GET and POST route to your function.

On Google Cloud, it removes IAM checking from the function by adding allUsers to the group "Cloud Functions Invoker" of that function.

Note that in both cases, anyone with the URL can invoke your function. Make sure to add Authentication logic inside your function, if needed.

Opening Issues

Feel free to open issues if you find bugs.

Contributing

Always welcome ❤️ Please see CONTRIBUTING.md

License

Apache 2.0