CLI tool for managing PocketBase collections, schema, and access rules. Keep your PocketBase configuration in version control and sync changes across environments.
- Version control - Track schema and rules changes in git
- Environment sync - Push same config to dev, staging, prod
- Team collaboration - Review PocketBase changes in PRs
- CI/CD ready - Automate deployments with diff checks
# npm
npm install -g @pb-admin/cli
# or run directly
npx @pb-admin/cli init# 1. Initialize in your project
pb-admin init
# 2. Pull current schema and rules from PocketBase
pb-admin pull
# 3. Edit files locally
# pb-admin/schema.json - collection fields
# pb-admin/rules.json - access permissions
# 4. Preview changes
pb-admin diff
# 5. Apply to PocketBase
pb-admin push| Command | Description |
|---|---|
pb-admin init |
Setup project, login, and pull initial config |
pb-admin login |
Login to PocketBase instance |
pb-admin logout |
Clear saved credentials |
pb-admin pull |
Download schema & rules from PocketBase |
pb-admin push |
Upload local schema & rules to PocketBase |
pb-admin diff |
Compare local files vs live PocketBase |
pb-admin col |
List and inspect collections |
pb-admin status |
Check login status |
| Flag | Description |
|---|---|
--schema, -s |
Only operate on schema |
--rules, -r |
Only operate on rules |
--dry-run, -n |
Preview changes without applying |
--debug |
Show detailed error information |
After pb-admin init:
your-project/
pb-admin.json # Config (PocketBase URL)
pb-admin/
schema.json # Collection fields definition
rules.json # Access rules (list/view/create/update/delete)
pb-admin diff # see what changed
pb-admin push # apply to PocketBase# GitHub Actions example
- name: Check PocketBase config
env:
PB_URL: ${{ secrets.PB_URL }}
PB_EMAIL: ${{ secrets.PB_EMAIL }}
PB_PASSWORD: ${{ secrets.PB_PASSWORD }}
run: |
npx @pb-admin/cli diff# Shell script
export PB_URL=https://your-pocketbase.com
export PB_EMAIL=admin@example.com
export PB_PASSWORD=your-password
pb-admin diff || exit 1 # fail if config differs
pb-admin push # or apply changesCredentials are stored per-project in ~/.config/pb-admin/projects/. Each project directory gets its own credentials file based on the project path.
MIT