Skip to main content
PocketBase is a Go framework that you can use as a standalone library in your Go application. You can leverage all of PocketBase’s features while maintaining full control over your application’s architecture.

Installation

Install PocketBase as a Go module:

Quick start

Create a basic PocketBase application:
main.go
Run your application:

Core concepts

App instance

The core.App interface is the backbone of PocketBase. It provides access to all core functionality including database operations, file storage, event hooks, and more.

Event hooks

PocketBase uses an event-driven architecture. You can register hooks to execute custom logic at specific points:

Collections and records

Collections define the schema for your data. Records are instances of collection data:

Configuration

Customize your PocketBase instance with configuration options:

Configuration options

bool
Hide the default console server info on app startup.
bool
Enable development mode (logs SQL statements to stderr).
string
The data directory path (defaults to ./pb_data).
string
Environment variable name for encryption key.
time.Duration
Default timeout for database queries.

Running the application

Start method

The Start() method registers default system commands and executes the root command:

Bootstrap

Manually initialize the application before starting:

Custom commands

Add custom CLI commands to your application:

Next steps

App interface

Learn about the core App interface and its methods

Collections

Work with collections and schema definitions

Records

Create, read, update, and delete records

Events

Register event hooks for custom logic