The Backend Problem
A typical backend requires: PostgreSQL, Redis, Auth service, File storage (S3), WebSocket server. That's 5 services before you write a line of business logic.
PocketBase is one 15MB binary. SQLite database, auth, file storage, realtime subscriptions — all built in.
What PocketBase Gives You
REST API From Schema
Create a collection in the admin UI, get a full CRUD API:
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
// Create
const post = await pb.collection('posts').create({
title: 'Hello World',
content: 'My first post',
author: pb.authStore.model.id,
});
// List with filters
const posts = await pb.collection('posts').getList(1, 20, {
filter: 'created >= "2024-01-01"',
sort: '-created',
expand: 'author',
});
Built-In Auth
// Email/password
await pb.collection('users').authWithPassword('user@example.com', 'password');
// OAuth2 (Google, GitHub, Discord, etc.)
await pb.collection('users').authWithOAuth2({ provider: 'google' });
// Check auth state
if (pb.authStore.isValid) {
console.log(pb.authStore.model.name);
}
Realtime Subscriptions
pb.collection('messages').subscribe('*', (e) => {
console.log(e.action); // 'create', 'update', 'delete'
console.log(e.record); // the full record
});
Live updates via SSE. No WebSocket setup needed.
File Storage
const formData = new FormData();
formData.append('avatar', fileInput.files[0]);
const record = await pb.collection('users').update(userId, formData);
const avatarUrl = pb.files.getUrl(record, record.avatar);
Files stored locally or on S3. Thumbnails generated automatically.
API Rules (Authorization)
Set per-collection in the admin UI:
List rule: @request.auth.id != ""
View rule: @request.auth.id != ""
Create rule: @request.auth.id != ""
Update rule: @request.auth.id = author
Delete rule: @request.auth.id = author
Deploy
# Download single binary
wget https://github.com/pocketbase/pocketbase/releases/latest/...
# Run
./pocketbase serve
# That's it. Admin UI at localhost:8090/_/
Deploy anywhere: VPS, Railway, Fly.io, even a Raspberry Pi.
Why This Matters
Not every project needs a microservices architecture. PocketBase proves that a single binary can replace 5 services — and it's fast enough for production.
Need data for your PocketBase apps? Check out my web scraping actors on Apify Store — import structured data into your collections. For custom solutions, email spinov001@gmail.com.
Top comments (0)