What if your entire backend was one 15MB file? No Docker, no database setup, no configuration. Just download and run.
What is PocketBase?
PocketBase is an open-source backend consisting of a single executable. It includes a SQLite database, real-time subscriptions, built-in auth, file storage, and an admin dashboard — all in one binary written in Go.
Why PocketBase Is Perfect for Prototypes and MVPs
1. One Binary, Full Backend
# Download
wget https://github.com/pocketbase/pocketbase/releases/latest/download/pocketbase_linux_amd64.zip
unzip pocketbase_linux_amd64.zip
# Run
./pocketbase serve
# Admin dashboard: http://127.0.0.1:8090/_/
# API: http://127.0.0.1:8090/api/
2. Real-Time Subscriptions
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
// Subscribe to real-time changes
pb.collection('messages').subscribe('*', function (e) {
console.log(e.action); // 'create', 'update', 'delete'
console.log(e.record);
});
// Create a record (triggers subscription)
await pb.collection('messages').create({
text: 'Hello!',
user: pb.authStore.model.id,
});
3. Built-in Authentication
// Email/Password auth
await pb.collection('users').authWithPassword('user@example.com', 'password');
// OAuth2 (Google, GitHub, etc.)
await pb.collection('users').authWithOAuth2({ provider: 'google' });
// Check auth state
if (pb.authStore.isValid) {
console.log(pb.authStore.model.email);
}
4. File Storage
const record = await pb.collection('posts').create({
title: 'My Post',
image: new File(['...'], 'photo.jpg'),
});
// Get file URL
const url = pb.files.getURL(record, record.image);
5. API Rules (No Code)
In the admin dashboard, set collection rules with filter syntax:
// List rule: only see own records
@request.auth.id = user.id
// Create rule: must be authenticated
@request.auth.id != ""
// Update rule: only admin or owner
@request.auth.role = "admin" || @request.auth.id = user.id
6. Extend with Go
package main
import (
"log"
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/core"
)
func main() {
app := pocketbase.New()
app.OnRecordCreate("orders").BindFunc(func(e *core.RecordEvent) error {
// Custom logic before creating an order
e.Record.Set("status", "pending")
return e.Next()
})
if err := app.Start(); err != nil {
log.Fatal(err)
}
}
PocketBase vs Supabase vs Firebase
| PocketBase | Supabase | Firebase | |
|---|---|---|---|
| Deployment | Single binary | Docker/Cloud | Cloud only |
| Database | SQLite | PostgreSQL | NoSQL |
| Self-hosted | Trivially easy | Moderate | Impossible |
| Real-time | Built-in | Built-in | Built-in |
| Auth | Built-in | Built-in | Built-in |
| File storage | Built-in | Built-in | Built-in |
| Scaling | Single server | Horizontal | Automatic |
| Cost | $0 (self-host) | Free tier | Free tier |
Getting Started
# Download and run
./pocketbase serve
# Open admin: http://127.0.0.1:8090/_/
# Create collections, set rules, done.
The Bottom Line
PocketBase is the fastest way to get a working backend. One file, zero configuration, full features. Perfect for prototypes, side projects, and MVPs that don't need horizontal scaling.
Need data tools? I build web scraping solutions. Check my Apify actors or email spinov001@gmail.com.
Top comments (0)