Recipe

PocketBase Primer

Single-file backend. SQLite, file storage, admin UI, realtime subscriptions, and OAuth — all in one Go binary.

Why PocketBase

PocketBase ships as a single executable. It bundles an embedded SQLite database, a file storage layer, a built-in admin dashboard, and a realtime subscriptions engine. No external dependencies, no Docker required. Deploy it behind a reverse proxy and you have a production-ready backend in minutes.

Core Concepts

  • Collections — Database tables defined through the admin UI or JSON schema. Each collection gets auto-generated CRUD API routes.
  • Auth — Built-in email/password and OAuth2 flows. PocketBase manages JWT tokens, refresh cycles, and user records out of the box.
  • Realtime — Subscribe to record changes over SSE. Any create, update, or delete fires an event to connected clients.
  • Extend — Write Go or JavaScript hooks that run on record events. Validate, transform, or trigger side effects without leaving the binary.

Quick Start

# Download and run
./pocketbase serve

# Open admin UI
# http://127.0.0.1:8090/_/

# Create a collection "posts"
# Fields: title (text), body (editor)

# Your API is live:
# GET /api/collections/posts/records

When to Use It

PocketBase shines for MVPs, internal tools, and projects where a full Postgres + ORM stack is overkill. It is not a drop-in replacement for horizontally-scaled databases — SQLite is single-writer. For read-heavy workloads behind a CDN, it handles thousands of concurrent connections comfortably.