All marketplaces

How to Publish a CLI for Your API on npm

Who’s there

Developers who’d rather use a CLI than call an API.

You build

A small CLI that wraps your API.

Ask your coding agent

Read https://indiehustles.com/marketplaces/npm and look at our product and codebase. Is npm a good opportunity for us? If it is, tell me what we'd build for it, the smallest version worth listing, and how much work it would take. Wait for my go-ahead before building.

Steps

  1. 1

    Build a CLI with a login command for the API key and one command per main action.

  2. 2

    In package.json, fill in name, description, keywords, homepage and repository, and add a bin entry.

  3. 3

    Run npm login. Your account needs 2FA.

  4. 4

    Run npm publish. Add --access public only for scoped names like @you/cli.

Good to know

  • Links from npm and the package sites are nofollow. You get pages and discovery, not link value.
  • Some users prefer a CLI to an API, so it helps your customers too.

More marketplaces

Want the regular directories too?

We submit you to 65+ directories like G2 and Product Hunt.

See Done For You