Prerequisites
No dependencies required! PocketBase is a single executable that runs on macOS, Linux, Windows, and FreeBSD.Start your first instance
Download and extract
Download the latest release for your platform from GitHub:
Start the server
Run PocketBase with the You’ll see output like this:
serve command:PocketBase creates a
pb_data directory to store your database and uploaded files. You can customize this with the --dir flag.Create your admin account
Open your browser and navigate to:You’ll be prompted to create an admin account. Fill in your email and password—this account lets you manage your database through the Admin UI.
Create your first collection
In the Admin UI:
- Click New Collection in the sidebar
- Choose Base collection (for regular database records)
- Name it
posts - Click Create
- Click New field and select Plain text
- Name:
title, Check Required - Add another Editor field named
content - Click Save
PocketBase automatically adds
id, created, and updated fields to every collection.Build with the Go library
If you want to extend PocketBase with custom logic, you can use it as a Go library. Here’s a minimal example based on the official source:Create main.go
Create a This example:
main.go file with this code from the PocketBase examples:main.go
- Creates a new PocketBase instance with
pocketbase.New() - Hooks into the
OnServe()event to add a custom route - Registers a
GET /helloendpoint that returns “Hello world!” - Starts the application with
app.Start()
Install dependencies and run
/hello route.Advanced example with plugins
The official PocketBase executable (from releases) is built with additional plugins. Here’s what the fullexamples/base/main.go includes:
The prebuilt executables include all these plugins, allowing you to extend PocketBase with JavaScript without writing Go code.
Common commands
PocketBase includes several built-in commands:| Command | Description |
|---|---|
serve | Start the HTTP server (default port: 8090) |
superuser | Create or update a superuser account |
migrate | Run database migrations (when using Go library) |
--help | Show available commands and flags |
Create a superuser via CLI
Use a custom port
Enable development mode
- Verbose logging to console
- SQL query logging
- Detailed error messages
SDK integration
Connect to your PocketBase API from the frontend using the official SDKs:Next steps
Database collections
Learn about collection types, fields, and relations
Authentication
Set up user authentication and OAuth2 providers
File uploads
Handle file uploads and image transformations
Extend with Go
Add custom business logic and API routes
Troubleshooting
Port already in use
If port 8090 is busy, specify a different port:Permission denied on Linux/macOS
Make the executable runnable:Database locked error
This happens if multiple PocketBase instances try to access the samepb_data directory. Only run one instance per data directory, or use different --dir paths:
For production deployments, consider using process managers like systemd, Docker, or PM2 to keep PocketBase running reliably.