← Back to archive

Repo of the Day

pocketbase/pocketbase

Published: Nov 16, 2024

Open repository ↗

Open Source realtime backend in 1 file

Summary

PocketBase is an open source Go backend that ships as a single binary, bundling an embedded SQLite database with realtime subscriptions, user and file management, an admin dashboard UI, and a REST-ish API. It can run as a standalone executable or be embedded as a Go library to add custom routes and business logic. The project is MIT-licensed and still pre-1.0, so the maintainer notes that full backward compatibility is not guaranteed before v1.0.0.

What it is useful for

PocketBase is useful when engineers need a self-contained backend without standing up separate database, auth, and admin services. Typical fits include prototypes and small-to-medium apps where SQLite is acceptable, side projects that need realtime features out of the box, and internal tools that benefit from the built-in admin UI for managing users and files. The realtime subscriptions over SQLite make it practical to push updates to clients without wiring a separate pub/sub system. Official SDKs are available for JavaScript (Browser, Node.js, React Native) and Dart (Web, Mobile, Desktop, CLI), so client integration is documented across common targets.

How engineers can use it

There are two documented paths. One is to download the prebuilt executable from the Releases page, extract it, and run ./pocketbase serve; the prebuilt binary is based on examples/base/main.go and includes the JavaScript VM plugin enabled by default for extending the server with JS.

The other is embedding PocketBase as a Go library. The README shows a minimal main.go that calls pocketbase.New(), binds a GET /hello route inside app.OnServe().BindFunc, and starts the app with app.Start(). Setup is: install Go 1.27+, create a project, run go mod init myapp && go mod tidy, then go run main.go serve. A statically linked binary can be produced with CGO_ENABLED=0 go build.

To build the example from source, clone the repo, cd examples/base, and run CGO_ENABLED=0 go build (or set GOOS/GOARCH for cross-compilation). Note that the pure Go SQLite driver only supports the OS/architecture combinations listed in the README table, which excludes some less common targets. Tests can be run with go test ./.... For deeper configuration, the README points to https://pocketbase.io/docs.