PocketBase gives you a complete backend — database, auth, file storage, and real-time subscriptions — in a single 20MB binary. No Docker, no dependencies.
Setup
# Download and run
./pocketbase serve
# Admin UI at http://localhost:8090/_/
# API at http://localhost:8090/api/
CRUD API
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://localhost:8090');
// Auth
await pb.collection('users').authWithPassword('user@example.com', 'password');
// Create
const post = await pb.collection('posts').create({
title: 'My Post',
content: 'Hello world',
author: pb.authStore.model.id
});
// Read
const posts = await pb.collection('posts').getList(1, 20, {
filter: 'created > "2026-01-01"',
sort: '-created',
expand: 'author'
});
// Update
await pb.collection('posts').update(post.id, { title: 'Updated Title' });
// Delete
await pb.collection('posts').delete(post.id);
Real-Time Subscriptions
pb.collection('messages').subscribe('*', (e) => {
console.log(e.action); // 'create', 'update', 'delete'
console.log(e.record);
});
// Subscribe to specific record
pb.collection('posts').subscribe(postId, (e) => {
console.log('Post updated:', e.record);
});
File Storage
const formData = new FormData();
formData.append('title', 'Photo');
formData.append('image', fileInput.files[0]);
const record = await pb.collection('gallery').create(formData);
// Get file URL
const imageUrl = pb.files.getUrl(record, record.image);
REST API Direct
# List records
curl "http://localhost:8090/api/collections/posts/records?filter=(title~'hello')"
# Auth
curl -X POST http://localhost:8090/api/collections/users/auth-with-password \
-d '{"identity":"user@example.com","password":"pass"}'
Why This Matters
- Single binary: No Docker, no Node, no Python — just one file
- Full backend: DB + Auth + Files + Realtime
- SQLite: Battle-tested storage, easy backups
- Embeddable: Use as Go framework for custom logic
Need custom backend tools or rapid prototyping? I build developer tools. Check out my web scraping actors on Apify or reach out at spinov001@gmail.com for custom solutions.
Top comments (0)