generator-vercel-shortener

1.0.2 • Public • Published

generator-vercel-shortener

Generator to create your own personal url shortener to deploy to Vercel (formerly Zeit Now).

version downloads GitHub Workflow Status MIT License PRs Welcome Semantic Release Commitizen friendly

Getting Started

These aren't prerequisites but before you're able to actually deploy your url shortener you should:

  1. Create a Vercel account.
  2. Set up Vercel GitHub Integration. This way Vercel deploys automatically for you.
  3. Buy, migrate or simply point a domain you already own to Vercel's dns.

You don't technically need to have a domain. By default your new project in Vercel will be deployed with a domain like https://my-url-shortener.now.sh, and your redirects will work just fine. However part of the glory of url shorteners is that they create short urls that are easy to type and remember!

Installation

npm install -g yo generator-vercel-shortener

Usage

yo vercel-shortener

By default it will look to generate in your current working directory. If that's not what you want, then specify the directory in the call or create a new directory to run the generator in.

yo vercel-shortener [<project-directory>]

or...

mkdir <project-directory>
cd <project-directory>
yo vercel-shortener

After you generate

Next steps after generating:

  1. Create a repository for your url shortener, https://github.com/new.
  2. Run git remote add origin <repo_url>.
  3. Run git push origin master.
  4. Run git branch -u origin/master.
  5. Run vercel to setup & deploy your project to Vercel.
  6. Add redirects:
    • Run shorten <destination> [<source>]. The generator will expose a globally available script for you. Run this from anywhere in your terminal. See vercel-redirects for the full cli documentation.
    • Run npm run shorten <destination> [<source>] from the root of the project.
    • Add them in vercel.json manually. You'll need to commit and push them yourself.

For example:

shorten https://gist.github.com/codfish/91ef26f3a56a5c5ca0912aa8c0c5c020 /linting

And in about ~5 seconds I can hit codfi.sh/linting and it will redirect for me.

Related Projects

  • codfi.sh - My own personal url shortener, using the same configuration as a project built with this generator.
  • vercel-redirects - Command-line utility to manage your Vercel project redirects.
  • netlify-shortener - Your own free URL shortener with Netlify (different serverless platform).

Package Sidebar

Install

npm i generator-vercel-shortener

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

12.5 kB

Total Files

11

Last publish

Collaborators

  • codfish