Skip to content
application · database · self-hosted

A whole backend in one file,PocketBase.

An open-source backend packaged as a single executable — embedded SQLite, a realtime REST API, authentication, file storage, and an admin dashboard with nothing else to install. This guide installs it with Docker Compose, the CLI, and Coolify, then walks the first run and the realtime API.

Firebase, without the lock-in

Define collections in the admin UI and PocketBase instantly exposes CRUD endpoints and realtime subscriptions for them — a lightweight self-hosted alternative to Firebase or Supabase.

  • SQLite — the whole database lives in /pb_data.
  • Auth — email/password and OAuth2 built in.
  • Realtime — live record updates over SSE.
SQLiteDatabase
8090Default port
/_/Admin UI
Go · JS hooksExtend with

Start here

Overview

PocketBase is an open-source backend that ships as a single executable file. Inside that one binary you get an embedded SQLite database, a realtime REST API, user authentication (email/password and OAuth2), file storage, and a full admin dashboard. There is nothing else to install — no separate database server, no message broker, no dependency stack.

That makes PocketBase a lightweight, self-hosted alternative to Firebase or Supabase for small and medium projects. You define collections (the equivalent of tables) in the admin UI, and PocketBase instantly exposes CRUD endpoints and realtime subscriptions for them. This guide installs PocketBase three ways — Docker Compose, the Docker CLI, and Coolify — then points you at the admin panel to build.

Three ways up

Install

Do you want to get Pocketbase up and running?

There are two ways you can go about setting up Pocketbase via Docker! We recommand using a docker compose, like this one below from their github.

Compose

version: '3.7'
services:
pocketbase:
image: ghcr.io/muchobien/pocketbase:latest
container_name: pocketbase
restart: unless-stopped
command:
- --encryptionEnv #optional
- ENCRYPTION #optional
environment:
ENCRYPTION: example #optional
ports:
- '8090:8090'
volumes:
- /path/to/data:/pb_data
- /path/to/public:/pb_public #optional
healthcheck: #optional (recommended) since v0.10.0
test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
interval: 5s
timeout: 5s
retries: 5

CLI

Terminal window
docker run -d \
--name=pocketbase \
-p 8090:8090 \
-e ENCRYPTION=example `#optional` \
-v /path/to/data:/pb_data \
-v /path/to/public:/pb_public `#optional` \
--restart unless-stopped \
ghcr.io/muchobien/pocketbase:latest \
--encryptionEnv ENCRYPTION `#optional`

Installing Pocketbase through Coolify is extremely easy!

  1. Click + Create New Resource
  2. Click Service
  3. Select Pocketbase
  4. Done! Fill in the URL and then head over the admin panel, domain.com/_/.

Admin and collections

First Run

Once the container is up, open the admin dashboard and create your first admin account:

  1. Open the admin UI — Navigate to http://your-host:8090/_/. On first launch PocketBase prompts you to create the initial admin (superuser) account.

  2. Create a collection — Collections are PocketBase’s tables. Click New collection, name it (for example posts), and add fields (text, number, relation, file, etc.).

  3. Set API rules — Each collection has list/view/create/update/delete rules written as filter expressions. Leave them empty for public access, or use @request.auth.id != "" to require a logged-in user.

  4. Use the API — PocketBase instantly exposes REST endpoints for the collection.

Live data

REST and Realtime API

Every collection is served under /api/collections/{name}/records. Fetching records is a plain HTTP call:

Terminal window
# List records
curl http://localhost:8090/api/collections/posts/records
# Create a record (authenticated)
curl -X POST http://localhost:8090/api/collections/posts/records \
-H "Authorization: TOKEN" \
-H "Content-Type: application/json" \
-d '{"title":"Hello","body":"First post"}'

The official JavaScript SDK wraps auth and adds realtime subscriptions over server-sent events, so clients receive live updates when records change:

import PocketBase from 'pocketbase';
const pb = new PocketBase('http://localhost:8090');
await pb.collection('users').authWithPassword('[email protected]', 'password');
pb.collection('posts').subscribe('*', (e) => {
console.log(e.action, e.record);
});

Questions

Frequently asked

What is PocketBase?

PocketBase is an open-source backend packaged as a single executable. It bundles an embedded SQLite database, a realtime REST API, user authentication, file storage, and an admin dashboard, making it a lightweight self-hosted alternative to Firebase or Supabase.

How do I run PocketBase with Docker?

Use a docker-compose.yml with a PocketBase image such as ghcr.io/muchobien/pocketbase, expose port 8090, and mount volumes for /pb_data (database) and optionally /pb_public (static files). Then run docker compose up -d and open the admin UI at /_/.

Where is the PocketBase admin dashboard?

The admin dashboard is served at /_/ on the PocketBase host, for example http://localhost:8090/_/. On first launch you create the initial admin account there, then manage collections, records, users, and settings.

Is PocketBase a good alternative to Firebase?

For small to medium self-hosted projects, yes. PocketBase offers realtime subscriptions, auth, and file storage with no vendor lock-in and a single-file deployment. It runs on SQLite, so it suits single-node workloads rather than horizontally sharded, massive-scale apps.