← All Posts
· Nearbase Team

Your Databases, One Terminal Away: Introducing the Nearbase CLI

A tiny CLI that lists every Postgres instance across every org you belong to, in one command. Inspired by nvidia-smi, built for developers who live in the terminal.

We just shipped the Nearbase CLI — a small, fast tool for inspecting your Postgres fleet without leaving the terminal.

npm install -g @nearbase/cli
nearbase login
nearbase

That’s it. One command shows every database across every organization you belong to.

Why a CLI?

The console is great for creating instances, scrubbing through metrics, or wiring up billing. It’s less great when you’re three SSH hops deep, your build is failing because staging is asleep, and you need to know — right now — whether prod-main is even up.

Most of us already live in the terminal. We kubectl get pods, we gh pr list, we aws ec2 describe-instances. There’s a reason nvidia-smi is the first thing every ML engineer runs on a new box: a single command that gives you the truth about your hardware in two seconds is genuinely valuable.

We wanted that for your databases. So we built it.

What you get today

$ nearbase
┌───────────┬─────────────┬─────────┬──────────────────────┬─────────┐
│ Org       │ Name        │ Status  │ Region               │ Storage │
├───────────┼─────────────┼─────────┼──────────────────────┼─────────┤
│ acme      │ prod-main   │ running │ Tokyo (Japan)        │ 100 GB  │
│ acme      │ staging     │ running │ Tokyo (Japan)        │ 20 GB   │
│ side-proj │ playground  │ stopped │ Singapore (Singapore)│ 20 GB   │
└───────────┴─────────────┴─────────┴──────────────────────┴─────────┘
  3 instance(s)

A few things to call out:

  • Cross-org by default. If you belong to three teams, you see all three teams’ databases in one table. No flag-juggling, no flipping context.
  • Status at a glance. running, stopped, creating, failed — color-coded so the eye lands where it matters.
  • Pipeable. nearbase ls --json gives you machine-readable output ready for jq, scripts, or any dashboard you care to build.

That’s the whole CLI in v0. We’ll grow it carefully.

Auth that respects your terminal

The CLI uses an OAuth-style device flow — the same pattern gh auth login and aws sso login use.

$ nearbase login
✔ Open this URL in your browser to authorize:
  https://console.nearbase.dev/cli/authorize?code=ABCD-EFGH

  Code: ABCD-EFGH

⠋ Waiting for browser approval...
✔ Logged in.

You sign in with the same Clerk account you use for the console. No copy-pasted API keys, no ~/.netrc files, no service accounts to rotate. The token lands at ~/.config/nearbase/auth.json with mode 0600. nearbase logout removes it.

Tokens are scoped to your user and inherit your current org memberships dynamically — so when someone leaves a team, their CLI loses access on the next command. No tokens to revoke, no secrets to chase.

Built small, on purpose

The published bundle is under 10 KB of JavaScript. It’s a single ESM file built with tsup, with three runtime dependencies you’ve probably already installed (commander, chalk, cli-table3). It runs on any Node ≥ 20, anywhere.

Everything else — the device-flow server, the approval page, the token-signing logic — lives in our existing API and console. Adding the CLI didn’t require new infrastructure, a new auth system, or a new database. It’s a thin client over endpoints we already had.

That matters because it means the CLI will keep working without us — no scheduled maintenance window, no “the CLI is down” Slack pings, no incident postmortem about an auth daemon nobody remembers deploying.

What we’re not shipping yet

We deliberately kept v0 small. A few things that aren’t in the box and the reasons why:

  • nearbase create / delete. Creating a database is a billing event. We want one canonical surface for that — the console — until we’re confident the CLI flow is at least as safe.
  • Connection strings on the wire. nearbase ls does not print or return passwords. Listing your fleet shouldn’t require trusting your terminal scrollback. Grab credentials in the console when you actually need them.
  • nearbase psql. Coming. Once nearbase can vend short-lived credentials, jumping straight into a psql session will be the next obvious step.

Try it

npm install -g @nearbase/cli
nearbase login
nearbase

Full reference: docs.nearbase.dev/cli. Source lives in our monorepo — issues and PRs welcome.

If there’s a command you wish existed, tell us in Discord. The CLI is going to grow in the direction you push it.