Skip to content
Browse docs

Installing the CLI

Everything on PocketBase Cloud can be done in the portal or from your terminal with the pbc CLI.

Install

curl -fsSL https://raw.githubusercontent.com/pocketbasecloud/cli/main/scripts/install.sh | sh

On Windows, unzip the win32 build from the latest release onto your PATH. pbc self upgrade keeps it current.

Log in

pbc login    # opens your browser
pbc whoami   # [email protected] — plan: Pro

No browser on the machine? Copy a CLI access token from the portal’s Account page and run pbc login --token <token>.

No account yet? See Projects — signup and choosing a plan happen in the portal.

Your first deployment

Your account already has a project, so there is nothing to create first:

pbc login
cd db && pbc pocketbase deploy --name my-app-db

The first deploy asks which project to use (or pbc project use <name> sets a default ahead of time), prints the URL and the generated superuser login, and records the resource in a pbc.json so later deploys in that directory need no flags.

If you only want the database and have nothing to ship yet, pbc pocketbase create my-app-db provisions an empty instance and stops there.

One deploy command for all three

You don’t have to tell the CLI which kind of thing you’re deploying. pbc deploy looks at the directory and runs the matching deploy:

cd db && pbc deploy --name my-app-db
Detected a PocketBase instance (pb_hooks/) — running `pbc pocketbase deploy`.

It detects a PocketBase instance from pb_hooks/, pb_migrations/, or pb_public/, and a frontend or backend from framework configs and package.json. A kind already in pbc.json wins, so a deployed directory is never re-guessed.

Name the kind to override the detection:

pbc deploy backend        # deploy as a backend, whatever is in here
pbc deploy frontend web   # …and call the new resource "web"

Multiple environments

One directory can deploy to several environments — staging and production, say. Each is a separate cloud resource in the same project. Pick one with --env; without it, commands use defaultEnvironment:

pbc frontend deploy --env staging
pbc frontend deploy --env staging --name web-staging   # creates it
PBC_ENV=staging pbc frontend deploy                    # for a whole shell

pbc environments lists what the directory targets.

Working with any PocketBase instance

Beyond the cloud commands, pbc administers any PocketBase — cloud-hosted, self-hosted, or the one on your laptop:

pbc admin use https://my-instance.pocketbasecloud.com   # select an instance
pbc admin login
pbc admin collections ls

See Managing Your Instance for the full set, and the CI/CD reference for PBC_TOKEN and scripting.

Next steps