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

gatefold

v1.0.10

Published

The compact URL shortener. Developed at Cimpress.

Downloads

7

Readme

Gatefold

npm version

Gatefold is a quick to set up, simple to use URL shortener built with Amazon API Gateway and Amazon DynamoDB and codified with Amazon CloudFormation.

Features:

  • deploy a URL shortener to your AWS account in less than a minute
  • shorten URLs and store a token to change it later
  • create vanity URLs by passing custom strings
  • specify a TTL for all shortened URLs on the domain.

The entire setup is bootstrapped with a CLI tool written in Node.js, which allows you to deploy or delete Gatefold stacks for several domains in multiple AWS accounts and regions. It is also possible to print the pre-populated API definition or the CloudFormation template to standard output for external processing.

No computing engines apart from API Gateway's VTL mapping templates are used, where all logic is stored.

Getting Started

Install the Gatefold package using npm or yarn:

npm install -g gatefold

To check your installation, run gatefold --version.

Now that you've installed Gatefold, you can deploy your custom URL shortener service:

gatefold deploy example.org

This will create a new Gatefold stack in your default AWS account and region. To change the target, use --profile <profile> and --region <region>:

gatefold deploy \
  --profile my-other-profile \
  --region eu-west-1 \
  example.org

Afterwards, set up a custom domain name and add an ALIAS record for the Amazon CloudFront distribution to hook it up to your domain. Both operations are easily achievable in the web console.

Wait for it to become available:

    until host example.org | grep address; do sleep 5; done \
      && echo "It's up!"

Consuming the API

Create your first shortened URL:

POST  HTTP/1.1
Host: example.org
Content-Type: application/json

{
  "longUrl": "https://cimpress.com"
}

The server responds with the shortened URL and a token:

HTTP/1.1 201 Created
Content-Type: application/json
Location: https://example.org/f530e741
{
    "longUrl": "https://cimpress.com",
    "shortUrl": "https://example.org/f530e741",
    "token": "a2354cd3-463e-11e8-ad00-8a820fb8b897"
}

You can also create a vanity URL passing a custom string:

PUT /gatefold HTTP/1.1
Host: example.org
Content-Type: application/json

{
  "longUrl": "https://cimpress.com",
  "token": "vas12tmsuo"
}

Update it by repeating the request with the same token.

Commands

You can see more information about a command by passing --help to the command, e.g. gatefold deploy --help.

gatefold deploy domain

Creates a new Gatefold stack in your AWS account or updates an existing one.

Specify TTL in days with --ttl <ttl>. The default is 3650, i.e. ten years.

gatefold delete domain

Deletes a Gatefold stack from your AWS account.

For gatefold deploy and gatefold delete possible to switch your default AWS account or region by passing --profile <profile> and --region <region> respectively.

gatefold get-swagger domain

Builds the Swagger API definition for Gatefold and prints it to standard output.

Specify TTL in days with --ttl <ttl>. The default is 3650, i.e. ten years.

gatefold get-cloudformation domain

Builds the CloudFormation template for Gatefold and prints it to standard output.

Specify TTL in days with --ttl <ttl>. The default is 3650, i.e. ten years.

Built With

Contributing

Have you benefited from the tool? Have you found or fixed a bug? Would you like to see a new feature implemented? We are eager to collaborate with you on GitHub.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.