caniname: CLI tool to check project name availability across Netlify and NPM (and other sources)

Screenshot of the caniname website and CLI preview
caniname CLI output preview

Whenever I build a new tool or custom element (like <show-keystrokes> or <rich-input>), I always end up doing the same manual dance: checking if the package name is still free on NPM and if the matching <name>.netlify.app subdomain is still unclaimed on Netlify. To automate that check, I built caniname.

~

# The need

As the classic saying goes, there are only two hard things in Computer Science — and one of them is naming things. And once you have finally found a good name for your new project (like I recently had to do for <show-keystrokes> and <rich-input>), it can be pretty disappointing when that name ends up being taken already on NPM or as a domain on Netlify — something that you typically only find out upon publishing 😭

To save myself from manually checking both services over and over again, I built caniname.

~

# The CLI tool

There’s no need to install anything globally — you can run it straight via npx:

npx caniname my-fancy-new-project

For each name — yes, you can pass in multiple ones — caniname reports whether the Netlify subdomain and NPM package are available (✔) or already taken (✖, along with a link to the existing site or package). If you want to use it in scripts or CI, pass the --json (or -j) flag for structured JSON output, or import checkName and checkNames directly in Node.js.

Checking availability for my-fancy-new-project…

  ✔ Netlify  my-fancy-new-project.netlify.app is available (https://my-fancy-new-project.netlify.app)
  ✖ NPM      rich-input is taken (https://www.npmjs.com/package/my-fancy-new-project)

Right now the project only checks Netlify and NPM, but adding new service checks is pretty straightforward: every check lives in its own file inside src/checks/ and gets picked up automatically. PRs with extra checks are very welcome 🙂

💁‍♂️ Fun fact: I originally built this tool under the name namecheck. Upon running ./bin/namecheck.js namecheck to dogfood it before publishing, it turned out that namecheck was already taken on both Netlify and NPM 😅 — so I used the tool itself to find an available name: caniname.

~

# Go check it out

Check out caniname at the following locations

~

🔥 Like what you see? Want to stay in the loop? Here's how:

I can also be found on 𝕏 Twitter and 🐘 Mastodon but only post there sporadically.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.