Overview
Run npx caniname <name> directly in your terminal before starting a new project to check if your chosen name is available on Netlify and NPM. Select a preset below or toggle --json to preview the CLI command and output:
npx caniname rich-input
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 we used the tool itself to find an available name: caniname.
Features
Zero-Install CLI
Run directly via npx caniname <name> with zero external dependencies (uses Node.js built-in fetch and util.parseArgs).
Batch Name Checking
Pass multiple candidate project names in a single invocation (e.g. npx caniname formula-input calc-input) to compare options side by side.
Parallel Service Execution
All registered service checks run concurrently via Promise.all() for fast results with a 10-second request timeout per check.
Human & JSON Output
Prints colorized status icons (✔, ✖, ⚠) by default, or structured JSON via -j / --json for scripting and CI pipelines.
Semantic Exit Codes
Exits with code 0 when all checked names are available across every service, or 1 when any name is taken or encounters an error.
Pluggable Check Modules
Every check lives in its own file under src/checks/ and is automatically discovered and executed in parallel.
CLI Usage & Options
Run caniname directly with npx (requires Node.js >=20.12.0), or install it globally with npm install -g caniname.
npx caniname formula-input
npx caniname formula-input calc-input
Or run locally from a cloned repository:
./bin/caniname.js formula-input calc-input
-j / --json)
Pass --json (or -j) to output machine-readable JSON. When checking a single name, a single result object is printed; when checking multiple names, an array of objects is returned:
npx caniname formula-input --json
{
"name": "formula-input",
"results": [
{
"id": "netlify",
"name": "Netlify",
"target": "formula-input.netlify.app",
"url": "https://formula-input.netlify.app",
"available": false
},
{
"id": "npm",
"name": "NPM",
"target": "formula-input",
"url": "https://www.npmjs.com/package/formula-input",
"available": false
}
]
}
| Option | Short | Description |
|---|---|---|
--json |
-j |
Output availability results as formatted JSON instead of human-readable text. |
--help |
-h |
Show the CLI help message and usage examples. |
Included Checks
Out of the box, caniname validates project name formats and checks availability across the following services:
| Service | ID | Target Checked | How Availability Is Determined |
|---|---|---|---|
| Netlify | netlify |
<name>.netlify.app |
Validates subdomain syntax and sends a HEAD request to https://<name>.netlify.app. Unclaimed Netlify subdomains return 404 without an ETag header. |
| NPM | npm |
<name> |
Validates npm package naming rules (including scoped packages) and sends a HEAD request to https://registry.npmjs.org/<name>. Available when the registry responds with 404. |
JavaScript API
In addition to the CLI, you can import checkName, checkNames, and loadChecks directly from caniname in Node.js:
import { checkName, checkNames, loadChecks } from 'caniname';
// Check a single project name across all built-in services
const singleResults = await checkName('my-cool-project');
console.log(singleResults);
// [
// { id: 'netlify', name: 'Netlify', target: 'my-cool-project.netlify.app', url: 'https://my-cool-project.netlify.app', available: true },
// { id: 'npm', name: 'NPM', target: 'my-cool-project', url: 'https://www.npmjs.com/package/my-cool-project', available: true }
// ]
// Check multiple project names in parallel
const batchResults = await checkNames(['formula-input', 'my-cool-project']);
// Or preload check modules manually
const checks = await loadChecks();
Adding New Checks
Each check lives in its own file inside src/checks/. Any .js file placed in src/checks/ is automatically discovered and executed in parallel.
src/checks/<service>.js)
export async function check(name) {
const normalized = name.trim().toLowerCase();
const target = `${normalized}.example.com`;
const url = `https://${target}`;
// Perform availability check...
const available = true;
return {
id: 'example',
name: 'Example',
target,
url,
available,
};
}
export default {
id: 'example',
name: 'Example',
check,
};