Using the PocketBase docs¶
burrowDB runs PocketBase v0.40.6, so the PocketBase documentation is the reference for building your app: collections, rules, auth, files, the SDKs, the REST API and JS hooks. This page lists each PocketBase docs page and says whether it applies to burrowDB as written. Where it says as written, follow the PocketBase page. Where there is a note, the page applies and the note says what is different. The full list of differences, with the reasons, is in burrowDB and PocketBase.
Two things hold everywhere:
- Use the burrowDB URL. Where PocketBase says
http://127.0.0.1:8090, use your cluster's URL (onburrow up localit is the same address). - Anything you write in SQL is PostgreSQL. Filters and rules are translated for you; raw SQL in hooks, view queries and the SQL console is not. See Raw SQL is PostgreSQL.
Build your app¶
| PocketBase page | Applies | burrowDB note |
|---|---|---|
| Introduction | Partly | Ignore the download-and-run steps: start burrowDB with burrow up (Quick start). |
| How to use PocketBase | As written | |
| Collections | Note | View collection queries are PostgreSQL. Names are limited to 63 bytes. |
| API rules and filters | Note | Same results. PostgreSQL refuses comparisons between unrelated types that SQLite coerced. |
| Authentication | As written | OTP and verification mail need SMTP, as in PocketBase. |
| Files upload and handling | Note | With more than one replica, use S3-compatible storage so every replica sees the files (burrow up sets it up). |
| Working with relations | As written | |
| Client-side SDKs | As written | The JavaScript and Dart SDKs work unchanged. |
| Going to production | No | burrowDB deploys differently: see Kubernetes, Clouds and Operations. |
Web API reference¶
| PocketBase page | Applies | burrowDB note |
|---|---|---|
| Records | As written | Including batch requests. |
| Realtime | Note | Works across replicas, at most once: refetch what the page shows when the SDK reconnects (PB_CONNECT). |
| Files | As written | |
| Collections | As written | |
| Settings | Note | Settings also set through BURROW_* variables are written again on every deploy. |
| Logs | As written | Stored in a second PostgreSQL database shared by every replica. |
| Crons | Note | Jobs run on worker processes only, once per tick for the whole cluster. |
| Backups | Note | The zip holds pg_dump archives; a restore swaps databases for the whole cluster. PocketBase and burrowDB backups do not restore into each other. |
| Health | As written | burrowDB adds /livez and /readyz for load balancers. |
Extend with JavaScript¶
Every API replica loads the same hooks. Read Hooks at scale first.
| PocketBase page | Applies | burrowDB note |
|---|---|---|
| Overview | Note | Hooks load when a process starts; burrowDB does not watch the folder. Put them in the stack's pb_hooks folder and restart the replicas. |
| Event hooks | Note | Run on the replica that handled the request. Side effects (mail, webhooks) must be safe to repeat. |
| Routing | As written | Custom routes exist on every replica. |
| Database | Note | $app.db() runs PostgreSQL SQL. |
| Record operations | As written | |
| Collection operations | As written | |
| Migrations | Note | Applied once per deploy by the migrate step. Automatic migration files are off unless BURROW_AUTOMIGRATE=true. |
| Jobs scheduling | Note | cronAdd jobs run on worker processes, once per tick for the cluster. |
| Sending emails | Note | Send from a hook that runs once per event, not from code that every replica runs. |
| Rendering templates | As written | |
| Console commands | No | burrow hands only serve, migrate and superuser to the engine, so commands added from JS cannot be run. Use a custom route or a cron job. |
| Sending HTTP requests | As written | |
| Realtime messaging | Note | Clients connected to other replicas are listed in $app.subscriptionsBroker() too, so messages sent from a hook reach them. |
| Filesystem | As written | |
| Logging | As written |
Extend with Go¶
Extend with Go does not apply: burrowDB ships as the burrow
binary. Use JS hooks, or fork the repository and add Go code to internal/server.