Go API

The Go packages under ext/contracts: each contract's interface, the types its operations take and return, and the helpers it ships, for a custom build or an extension that calls one. Generated from the source with go/doc, examples included. An extension's JavaScript side is in the JavaScript API.

Contracts

Package
api-tokens/v1 Package apitokensv1 is the api-tokens/v1 contract: an app's API tokens.
api-tokens/verify/v1 Package verifyv1 is the api-tokens.verify/v1 contract: another server checks an app's API token.
bulkmail/v1 Package bulkmailv1 is the bulkmail/v1 contract: campaigns to many recipients, sent at a safe pace.
cache/clear/v1 Package clearv1 is the cache.clear/v1 contract: empty an app's cache buckets from outside the app's code, so its admins (the dashboard, pocketone remote cache clear, an agent) can drop what cache/v1 keeps for it after a change that left stale entries behind.
cache/v1 Package cachev1 is the cache/v1 contract: named buckets of bytes an app keeps for a while, so extensions and apps can remember what was expensive to compute.
cli/commands/v1 Package clicmdv1 is the cli.commands/v1 contract: the pocketone command tree.
deploy/v1 Package deployv1 is the deploy/v1 contract: a project's code files on an app (check, upload, commit, list, read, write, delete, tree).
gate/v1 Package gatev1 is the gate/v1 contract: what admits requests on a multisite host, before an instance is served or forwarded (a firewall: peer allow lists, client IPs, rate limits).
http/wrap/v1 Package wrapv1 is the http.wrap/v1 contract: middleware around everything a multisite host serves (a Server-Timing header, request logging).
instance/fs/v1 Package fsv1 is the instance.fs/v1 contract: one instance's code files on local disk, for extensions that read and write them (ext/deploy today).
instance/lookup/v1 Package lookupv1 is the instance.lookup/v1 contract: a multisite host asks for a hostname it doesn't know.
instance/resolve/v1 Package resolvev1 is the instance.resolve/v1 contract: on a control plane (a mothership), what a hostname serves for a given edge, built from the control plane's own records, and which records each answer was built from.
instance/source/v1 Package sourcev1 is the instance.source/v1 contract: the instance record a multisite host serves (its id, hostnames, version, folder, secrets, limits, ...) and where the records come from.
instance/source/v1/sourcetest Package sourcetest is an instance.source/v1 provider for tests: a fixed list of instances that a test can change while it runs, the way an edit to a host's instances file or a control plane's update would.
instance/tokens/v1 Package tokensv1 is the instance.tokens/v1 contract: a multisite host checks an API token one of its instances issued, so it can accept the instance's own tokens on the routes it answers for that instance (deploy/v1, remote/v1).
instance/watch/v1 Package watchv1 is the instance.watch/v1 contract: an edge follows a control plane (a mothership) lazily.
kv/v1 Package kvv1 is the kv/v1 contract: an app's key-value store.
llm Package llm holds what the llm.* contracts share: a model reference, generated files, usage, model info, jobs and errors.
llm/align/v1 Package alignv1 is the llm.align/v1 contract: forced alignment.
llm/chat/v1 Package chatv1 is the llm.chat/v1 contract: stored conversations with the app's language model.
llm/embed/v1 Package embedv1 is the llm.embed/v1 contract: a model turns texts into vectors, for search by meaning.
llm/image/v1 Package imagev1 is the llm.image/v1 contract: a model makes pictures from a prompt, and from reference pictures.
llm/ledger/v1 Package ledgerv1 is the llm.ledger/v1 contract: what an app's model calls have used and cost, read from the ledger every llm.* call leaves (the provider's own record of each call), and how much of each limit is left.
llm/music/v1 Package musicv1 is the llm.music/v1 contract: a model makes music from a prompt (and lyrics).
llm/search/v1 Package searchv1 is the llm.search/v1 contract: named buckets of content an app searches.
llm/speech/v1 Package speechv1 is the llm.speech/v1 contract: a model reads text aloud.
llm/text/v1 Package textv1 is the llm.text/v1 contract: a language model answers a prompt or a conversation.
llm/transcribe/v1 Package transcribev1 is the llm.transcribe/v1 contract: a model writes down what's said in audio.
llm/video/v1 Package videov1 is the llm.video/v1 contract: a model makes a video from a prompt (and a first frame).
mail/fallback/v1 Package fallbackv1 is the mail.fallback/v1 contract: where an app's mail goes when its SMTP is off.
mail/feedback/v1 Package feedbackv1 is the mail.feedback/v1 contract: what mail providers report back about mail an app sent (bounces, complaints, unsubscribes), received at one place and turned into [Event]s that any extension can act on.
mail/suppression/v1 Package suppressionv1 is the mail.suppression/v1 contract: addresses an app must not send bulk mail to (unsubscribed, bounced, complained), and the unsubscribe link every bulk message carries.
mcp/v1 Package mcpv1 is the mcp/v1 contract: the app's Model Context Protocol endpoint, so agents (a Claude connector, Claude Code, any Streamable HTTP client) can work with it.
oauth/v1 Package oauthv1 is the oauth/v1 contract: an OAuth 2.1 authorization server for the app (authorization code with PKCE, device code, refresh, revocation, dynamic and metadata-document client registration), so the CLI and MCP clients like Claude can sign in.
remote/v1 Package remotev1 is the remote/v1 contract: remote control of an app.
remote/v1/remoteclient Package remoteclient is remote/v1's CLI client: the remotes a project links (.pocketone/remotes.yaml), saved logins, sign-in (an API token, a password, or OAuth in the browser or with a device code), and an authenticated HTTP client for a remote.
restore/v1 Package restorev1 is the restore/v1 contract: put an app's data back as it was at a moment.
runtime/v1 Package runtimev1 is the runtime/v1 contract: what runs a multisite host's instances (ext/pocker as isolates, ext/docker in containers).
settings/v1 Package settingsv1 is the settings/v1 contract: the settings an app's admins change for its extensions (pitr's S3 bucket, bulkmail's sending limits), one API for all of them.
templates/v1 Package templatesv1 is the templates/v1 contract: an extension's own pages as a set of Go html/template files that a project can override.
tls/v1 Package tlsv1 is the tls/v1 contract: the TLS of a multisite host's main listener (automatic certificates).
vacuum/v1 Package vacuumv1 is the vacuum/v1 contract: an app's databases are compacted (SQLite VACUUM) so space freed by deleted records goes back to the disk, and its admins can see when that last happened.

PocketBase

PocketOne's core: the app (core), its HTTP API (apis), the tools it's built from, and the test helpers (tests). A custom build or an extension imports these by the module path in each page's import line.

Package
pocketbase
apis
core Package core is the backbone of PocketBase.
core/validators Package validators implements some common custom PocketBase validators.
forms
mails Package mails implements various helper methods for sending common emails like forgotten password, verification, etc.
plugins/ghupdate Package ghupdate implements a new command to selfupdate the current PocketBase executable with the latest GitHub release.
plugins/migratecmd Package migratecmd adds a new "migrate" command support to a PocketBase instance.
plugins/update Package update implements a new command to replace the current PocketBase executable with the one from the latest BugStage releases.
tests Package tests provides common helpers and mocks used in PocketBase application tests.
tools/archive
tools/auth
tools/cron Package cron implements a crontab-like service to execute and schedule repeative tasks/jobs.
tools/dbutils
tools/filesystem
tools/filesystem/blob Package blob defines a lightweight abstration for interacting with various storage services (local filesystem, S3, etc.).
tools/hook
tools/inflector
tools/list
tools/logger
tools/mailer
tools/osutils
tools/picker
tools/router
tools/routine
tools/search
tools/security
tools/store
tools/subscriptions
tools/template Package template is a thin wrapper around the standard html/template and text/template packages that implements a convenient registry to load and cache templates on the fly concurrently.
tools/tokenizer Package tokenizer implements a rudimentary tokens parser of buffered io.Reader while respecting quotes and parenthesis boundaries.
tools/types Package types implements some commonly used db serializable types like datetime, json, etc.