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

api-umbrella-gatekeeper

v0.8.18

Published

A custom reverse proxy to control access to your APIs. Performs API key validation, request rate limiting, and gathers analytics.

Downloads

64

Readme

API Umbrella Gatekeeper

API Umbrella Gatekeeper is a custom reverse proxy that sits in front of your APIs and efficiently validates incoming requests. It is part of the API Umbrella project. API Umbrella Gatekeeper is written in Node.js.

Issues for this project are maintained here.

Overview

The basic aim of the Gatekeeper is to handle API keys, throttle requests, gather analytics, and optionally rewrite requests before passing incoming requests to your actual APIs.

In the API Umbrella stack, the Gatekeeper is represented below:

[request] ==> [load balancer] ==> [GATEKEEPER] ==> [cache] ==> [load balancer] => [api backend]

Usage

See Running API Umbrella for setup instructions.

Features

API Key Validation

Once a request hits API Umbrella Gatekeeper, it validates that a valid API key has been passed with the request. If a valid API key is present, the request is allowed to hit the API backend (assuming the user has not exceeded their rate limits). If the API key is missing or invalid, then Gatekeeper immediately responds to the request and the request is not permitted to access the API backend.

API keys can be passed in three differnet, configurable ways:

  • HTTP header
  • GET parameter
  • HTTP basic username

Currently, only simple API keys are supported, but it would be possible to extend API Umbrella Gatekeeper to support OAuth2 or other authentication mechanisms.

API keys are stored in MongoDB.

Rate Limiting / Throttling

In addition to validating API keys, API Umbrella Gatekeeper also performs rate lmiting to ensure users don't overload your API backends. Rate limiting can be performed based on the users API key, IP address, or both. Rate limits can be configured in a number of ways:

  • Rate limit by API key, IP address, or both.
  • Rate limit by any arbitrary rolling time window (per 1 second, per 15 minutes, per hour, per day, etc).
  • Rate limits can be configured on a per API or per user basis.
  • Rate limits can be distributed and shared across hosting environemnts. This allowing for rate limits to still be efficiently applied if API Umbrella is distributed locally or geographically.

Rate limiting uses both Redis and MongoDB.

Logging & Analytics

Details on each incoming API request is asyncronously logged in a database to allow for near real time analytics of all your API usage. Various details are captured for each request:

  • Basic details like request URL.
  • Additional header information like,
  • Geographic information on where the request originated from.
  • Response codes from the API backend, so you can look for requests that resulted in errors.
  • Performance metrics: How long each request took to respond is captured, so you can see how your API performs and look for problem areas.
  • Size metrics: Keep track of how many bytes are trasnferred for the request and the response.

The API Umbrella Web application provides an administrative interface for browsing and querying the analtyics gathered.

Logs and analytics are gathered in ElasticSearch.

API Facade / Request Rewriting

API Umbrella Gatekeeper can optionally modify the incoming request in a variety of ways. This allows your public facing API to differ from the backend.

  • URL rewriting: The incoming URL can be transformed before hitting the backend. This can be as simple as presenting the API under a different URL prefix, or as complex as providing a completely different URL structure.
  • Manipulate HTTP headers: Add or remove HTTP headers from the request before it hits the API backend. You can also used Handlebars templates to dynamic set a header value based on the request coming in: x-original-proto: {{headers.x-forwarded-proto}}

The API Umbrella Web application provides an administrative interface configuring the API backends and performing common types of rewriting.

License

API Umbrella is open sourced under the MIT license.

Acknowledgements

Geographic data comes from GeoLite data created by MaxMind.

githalytics.com alpha