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

@unkey/cli-demo

v1.2.4

Published

Template for building CLI applications with Unkey

Downloads

1

Readme

unkey-cli

CLI login example built with Unkey

Running this locally

This template involves a deployed Next.js web app in examples/nextjs and a command-line script in /src/index.ts.. To run through the auth flow locally:

  1. Install dependencies
  2. Run the script in dev mode from the monorepo root: pnpm dev login
  3. This will open the web app in your browser, where you can confirm or cancel the auth flow

About

How this works

  1. CLI spins up server on localhost
  2. CLI opens a page in the user's browser (/auth/devices) which is protected by an auth solution (Clerk, in this case)
  3. The user verifies that the code there matches the one shown in their terminal
  4. Upon verification, the Next.js app mints a new Unkey API key and sends it back to the local server
  5. The script writes the API key to a file and kills the server

See the diagram below:

[diagram]

Login

unkey-cli login does the following:

  1. Opens a new browser window for your user to log in with your service
  2. If this is sucessful, queries Unkey for a new API key
  3. Stores the key locally in .unkey

Example use case

Vercel has a CLI for deploying web applications (as well as a their more frequently used web app)

If you want to deploy your frontend with their CLI, you:

  1. Run vercel login to log in to the web app and set a local credential in .vercel
  2. Run vercel deploy which takes local files and uploads them to the Vercel CI/CD to be deployed.

This is a simplified example the kind of tool that you could build with this template.