Skip to main content
PocketBase offers two installation methods depending on your use case. You can use it as a standalone executable for quick deployment, or integrate it as a Go library for custom applications.

Standalone executable

The fastest way to get started is downloading a prebuilt executable. This is perfect if you want to use PocketBase without writing any code.
1

Download PocketBase

Visit the GitHub releases page and download the archive for your platform:
  • macOS (Intel/Apple Silicon)
  • Linux (x86_64, ARM, ARM64, and more)
  • Windows (x86_64, ARM64)
  • FreeBSD (x86_64, ARM64)
The prebuilt executables include the JavaScript VM plugin by default, allowing you to extend PocketBase with JavaScript hooks.
2

Extract the archive

Extract the downloaded archive to your desired location:
unzip pocketbase_VERSION_linux_amd64.zip -d pocketbase
cd pocketbase
3

Run PocketBase

Start the server with a single command:
./pocketbase serve
You should see output indicating the server is running:
Server started at: http://127.0.0.1:8090
  - REST API: http://127.0.0.1:8090/api/
  - Admin UI: http://127.0.0.1:8090/_/
4

Access the admin UI

Open your browser and navigate to http://127.0.0.1:8090/_/ to set up your admin account and start configuring your database.

Supported platforms

The pure Go SQLite driver supports these build targets:
darwin amd64
darwin arm64

Go library installation

Use PocketBase as a Go library to build custom applications with your own business logic. You’ll end up with a single executable that includes both PocketBase and your code.
1

Install Go

Make sure you have Go 1.23 or later installed. Check your version:
go version
If you need to install Go, visit the official Go installation guide.
2

Create a new project

Create a directory for your project and initialize a Go module:
mkdir myapp
cd myapp
go mod init myapp
3

Create your main.go file

Create a main.go file with the basic PocketBase setup:
main.go
package main

import (
    "log"

    "github.com/pocketbase/pocketbase"
    "github.com/pocketbase/pocketbase/core"
)

func main() {
    app := pocketbase.New()

    app.OnServe().BindFunc(func(se *core.ServeEvent) error {
        // registers new "GET /hello" route
        se.Router.GET("/hello", func(re *core.RequestEvent) error {
            return re.String(200, "Hello world!")
        })

        return se.Next()
    })

    if err := app.Start(); err != nil {
        log.Fatal(err)
    }
}
This example creates a PocketBase instance and adds a custom /hello route.
4

Install dependencies

Download the PocketBase library and its dependencies:
go mod tidy
5

Run your application

Start your application in development mode:
go run main.go serve
The serve command starts the HTTP server. Other available commands include superuser for creating admin accounts.
6

Build a production executable

Compile a statically linked binary for deployment:
CGO_ENABLED=0 go build
Then run your application:
./myapp serve
Set CGO_ENABLED=0 to create a fully static binary that doesn’t depend on system libraries.

Cross-compilation

Build executables for different platforms:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build

Configuration options

Both installation methods support the same command-line flags:
FlagDefaultDescription
--dir./pb_dataThe data directory for database and files
--devAuto-detectedEnable development mode with verbose logging
--encryptionEnvNoneEnvironment variable for encryption key (32 chars)
--queryTimeout30Default SELECT query timeout in seconds

Example usage

# Use a custom data directory
./pocketbase serve --dir=/var/pocketbase/data

# Enable development mode
./pocketbase serve --dev

# Set query timeout
./pocketbase serve --queryTimeout=60

Data directory structure

PocketBase stores all data in a single directory (pb_data by default):
pb_data/
├── data.db           # Main SQLite database
├── data.db-shm       # Shared memory file (SQLite)
├── data.db-wal       # Write-ahead log (SQLite)
├── logs.db           # Request logs database
└── storage/          # Uploaded files
Back up the entire pb_data directory regularly. It contains your database, uploaded files, and application settings.

Next steps

Quickstart guide

Create your first collection and API

Extend with Go

Learn how to add custom routes and hooks