Skip to content

CLI

The Bkper CLI covers two roles: data management (books, accounts, transactions, balances from the terminal) and app development (init, dev, build, sync, deploy). Supports table, JSON, and CSV output formats for scripting and piping.

The Bkper CLI is the command-line interface for everything you build on Bkper. It serves two roles:

  • Data management — Work with books, accounts, transactions, and balances from the terminal
  • App development — Initialize, develop, build, and deploy Bkper apps

Installation

Terminal window
bun add -g bkper

Authentication

Terminal window
bkper auth login # authenticate via Google OAuth
bkper auth logout # revoke stored credentials
bkper auth token # print the current access token

bkper auth login authenticates via Google OAuth and stores credentials locally. The same credentials are used by:

  • All CLI commands
  • The getOAuthToken() function in scripts
  • The bkper app dev local development server

bkper auth token is useful for direct API calls — pipe the output into a variable:

Terminal window
TOKEN=$(bkper auth token)

Developer workflows

App lifecycle

Terminal window
# Create a new app from the template
bkper app init my-app
# Start local development (Vite + Workers + tunnel)
bkper app dev
# Build for production
bkper app build
# Sync app metadata to Bkper
bkper app sync
# Deploy to the Bkper Platform
bkper app deploy
# Remove app from the Bkper Platform
bkper app undeploy
# Check deployment status
bkper app status

Secrets management

Terminal window
# Set a secret for production
bkper app secrets put BKPER_API_KEY
# Set a secret for preview environment
bkper app secrets put BKPER_API_KEY --preview
# List secrets
bkper app secrets list
# Delete a secret
bkper app secrets delete BKPER_API_KEY

App installation

Terminal window
# Install app on a book
bkper app install <appId> -b <bookId>
# Uninstall app from a book
bkper app uninstall <appId> -b <bookId>

Auth provider for scripts

The CLI package exports getOAuthToken() for use in Node.js scripts:

import { Bkper } from 'bkper-js';
import { getOAuthToken } from 'bkper';
Bkper.setConfig({
oauthTokenProvider: async () => getOAuthToken(),
});

Data management commands

The CLI provides full data management capabilities:

Terminal window
# Books
bkper book list
bkper book get <bookId>
bkper book create --name "My Company"
# Accounts
bkper account list -b <bookId>
bkper account create -b <bookId> --name "Sales" --type INCOMING
# Transactions
bkper transaction list -b <bookId> -q "account:Sales after:2025-01-01"
bkper transaction create -b <bookId> --description "Office supplies 123.78"
# Balances
bkper balance list -b <bookId>

All data commands use -b, --book <bookId> to specify the book context.

Output formats

The CLI supports multiple output formats for scripting and piping:

Terminal window
# Table (default, human-readable)
bkper book list
# JSON (for programmatic use)
bkper book list --format json
# CSV (for spreadsheets and data tools)
bkper transaction list -b <bookId> --format csv

See CLI Scripting & Piping for scripting patterns.

Full reference

Run bkper --help or bkper <command> --help for built-in documentation on any command.

The complete CLI documentation, including all commands and options, is available on the bkper-cli app page.