# Build

> Build integrations, automate workflows, and extend Bkper — from CLI one-liners to full platform apps.

Bkper is designed to be extended. Whether you're piping CLI commands in a shell script or building a full platform app with a UI, events, and managed hosting — the same APIs and tools power everything.

## The building spectrum

**Scripts & CLI** — Pipe data through the CLI, write Node.js scripts, or call the REST API directly. No infrastructure needed.

**Google Workspace** — Build automations with Apps Script, extend Google Sheets with custom functions and triggers.

**Platform Apps** — Full applications with managed hosting, authentication, event handling, and deployment on the [Bkper Platform](https://bkper.com/docs/build/apps/overview.md).

- [App Listing](https://bkper.com/docs/build/apps/app-listing.md): Apps are listed on the Bkper Automations Portal, populated from bkper.yaml fields. Sync metadata with bkper app sync, and by default limit installation to declared users until you publish more broadly.
- [App Architecture](https://bkper.com/docs/build/apps/architecture.md): Bkper platform apps use a three-package monorepo: a Lit + Vite client for the UI, a Hono server on Cloudflare Workers for the API, and an events package for webhook-driven automation. Mix and match only what you need.
- [App Configuration](https://bkper.com/docs/build/apps/configuration.md): Reference for bkper.yaml — the single file that declares your app's identity, menu integration, event subscriptions, deployment targets, secrets, and KV storage. Sync metadata with bkper app sync, then deploy code with bkper app deploy.
- [Context Menu](https://bkper.com/docs/build/apps/context-menu.md): Add a custom item to the Transactions page More menu that opens a URL pre-populated with the current book context — query, account, date range, and more.
- [Building & Deploying](https://bkper.com/docs/build/apps/deploying.md): The three-step deployment workflow — build your code, sync app metadata from bkper.yaml, and deploy to the Bkper Platform. Covers preview environments, secrets management, and KV storage.
- [Development Experience](https://bkper.com/docs/build/apps/development.md): Local development uses two composable processes: bkper app dev for the worker runtime (Miniflare, file watching, tunnel) and vite dev for the client UI with HMR. The project template runs both concurrently via npm run dev.
- [Event Handlers](https://bkper.com/docs/build/apps/event-handlers.md): Write code that reacts to book events — checked transactions, new accounts, comments — to automate calculations, sync data between books, and call external services. Covers response format, loop prevention, and replay.
- [The Bkper Platform](https://bkper.com/docs/build/apps/overview.md): The Bkper Platform provides managed edge hosting, pre-configured OAuth, KV storage, secrets management, and automatic webhook tunnels for local development — so you write business logic and the platform handles all infrastructure.
- [Self-Hosted Alternative](https://bkper.com/docs/build/apps/self-hosted.md): Host Bkper event handlers outside the Bkper Platform — on Google Cloud Functions (with automatic authentication via service account) or any generic webhook infrastructure. Use when you have compliance constraints or an existing cloud setup.
- [The Agent Model](https://bkper.com/docs/build/concepts/agent-model.md): Every program that acts on Bkper books — scripts, automations, platform apps, bank connections — is an agent acting on behalf of a user. Agents are identified by logo and name in the activity stream, and are bound by the same permissions as the user who authorized them.
- [Authentication](https://bkper.com/docs/build/concepts/authentication.md): How OAuth2 authentication works across all Bkper build environments: CLI token via getOAuthToken(), bkper-js via CDN for any browser with an access token, browser-based OAuth via @bkper/web-auth for *.bkper.app apps, automatic handling in Apps Script, and Bearer token authentication for direct REST API calls.
- [Events](https://bkper.com/docs/build/concepts/events.md): Reference for the Bkper event system — how to subscribe to events in bkper.yaml, the full Event object structure with book/user/agent/data fields, the complete current event type list, and how to use previousAttributes for diffs.
- [Examples & Patterns](https://bkper.com/docs/build/examples.md): Open-source production apps demonstrating key integration patterns: property-driven tax bots, multi-book exchange rate sync, FIFO inventory and portfolio tracking, subledger hierarchies, and Google Sheets add-ons.
- [Agent Security](https://bkper.com/docs/build/getting-started/agent-security.md): Run AI coding agents safely with Bkper — sandbox isolation, credential protection, and permission scoping to limit what an agent can access and do.
- [Building with AI](https://bkper.com/docs/build/getting-started/building-with-ai.md): Use AI coding agents to build Bkper integrations faster — from the built-in Bkper Agent to Claude Code, Pi, OpenCode, Codex, and Cursor.
- [Your First App](https://bkper.com/docs/build/getting-started/first-app.md): Step-by-step walkthrough of building and deploying a full Bkper platform app from scratch — scaffold from template, run locally with HMR and automatic webhook tunnels, react to transaction events, and deploy to production.
- [Quick Wins](https://bkper.com/docs/build/getting-started/quick-wins.md): Start building with Bkper in minutes using three approaches of increasing complexity: a one-line CLI pipe, a 20-line Node.js script, and a direct REST API call with curl.
- [Development Setup](https://bkper.com/docs/build/getting-started/setup.md): Install the Bkper CLI, authenticate via Google OAuth, and verify access to your books. This single setup step unlocks CLI commands, bkper-js scripting, and the full app development toolchain.
- [Apps Script Development](https://bkper.com/docs/build/google-workspace/apps-script.md): Use the bkper-gs library to build Bkper automations that run inside Google's serverless Apps Script platform — scheduled jobs, spreadsheet triggers, custom add-ons, and workflows that combine Bkper with Sheets, Drive, and Gmail.
- [Building Sheets Integrations](https://bkper.com/docs/build/google-workspace/google-sheets.md): Go beyond the standard add-on with custom Google Sheets integrations using bkper-gs — build team-specific menus, automated import/export pipelines, scheduled balance reports, and two-way sync between spreadsheets and Bkper books.
- [CLI Scripting & Piping](https://bkper.com/docs/build/scripts/cli-pipelines.md): Use the Bkper CLI as a scripting tool — pipe JSON between commands for batch creates and updates, output CSV for data pipelines and AI agents, and chain operations to migrate, transform, or sync book data without writing code.
- [Node.js Scripts](https://bkper.com/docs/build/scripts/node-scripts.md): Write standalone Node.js scripts with bkper-js for complex logic, bulk data operations, scheduled jobs, and integrations that go beyond what the CLI alone can do.
- [Direct API Usage](https://bkper.com/docs/build/scripts/rest-api.md): Access the Bkper REST API directly from any language using Bearer token authentication. Covers the OpenAPI and Google Discovery specifications, getting a token via CLI or OAuth, optional API keys for dedicated quota, and the interactive API explorer.
- [CLI](https://bkper.com/docs/build/tools/cli.md): 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.
- [Libraries & SDKs](https://bkper.com/docs/build/tools/libraries.md): Choose the right library for your environment: bkper-js for Node.js and browsers, bkper-gs for Google Apps Script, @bkper/web-auth for OAuth on *.bkper.app subdomains, and @bkper/bkper-api-types for TypeScript definitions in any project.
