PocketBase Architecture
Single File = Complete Backend
pocketbase (single binary, ~40MB)
├── SQLite Database (embedded)
├── REST API (auto-generated)
├── Real-time Subscriptions (SSE)
├── Authentication (email, OAuth2)
├── File Storage (local or S3)
└── Admin Dashboard (built-in web UI)Auto-Generated REST API
Create a collection in the admin UI → API endpoints are instantly available:
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/collections/{name}/records |
List records |
| POST | /api/collections/{name}/records |
Create record |
| GET | /api/collections/{name}/records/{id} |
Get record |
| PATCH | /api/collections/{name}/records/{id} |
Update record |
| DELETE | /api/collections/{name}/records/{id} |
Delete record |
Authentication
Built-in auth with zero configuration:
# Register a user
curl -X POST http://localhost:8090/api/collections/users/records \
-d '{"email": "user@example.com", "password": "12345678", "passwordConfirm": "12345678"}'
# Login
curl -X POST http://localhost:8090/api/collections/users/auth-with-password \
-d '{"identity": "user@example.com", "password": "12345678"}'
# Returns JWT tokenOAuth2 providers: Google, GitHub, Facebook, Apple, Discord, Microsoft, and more.
Real-Time Subscriptions
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://localhost:8090');
// Subscribe to changes
pb.collection('messages').subscribe('*', (e) => {
console.log('New message:', e.record);
});Use Cases for AI Apps
| Use Case | How PocketBase Helps |
|---|---|
| AI Chat App | Store conversations, user accounts, file attachments |
| RAG Dashboard | Store documents, embeddings metadata, query logs |
| Agent Platform | Store agent configs, execution logs, user sessions |
| LLM Playground | Store prompts, responses, model configs |
| API Backend | REST API for any AI frontend in seconds |
Extend with Go
package main
import (
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/core"
)
func main() {
app := pocketbase.New()
app.OnServe().BindFunc(func(se *core.ServeEvent) error {
se.Router.GET("/api/custom/ai-status", func(e *core.RequestEvent) error {
return e.JSON(200, map[string]string{"status": "running"})
})
return se.Next()
})
app.Start()
}FAQ
Q: What is PocketBase? A: PocketBase is an open-source backend with 57,300+ GitHub stars that packages database, auth, file storage, and admin UI into a single executable. Zero dependencies, instant REST APIs.
Q: Why use PocketBase for AI projects? A: AI apps need user auth, data storage, file handling, and real-time updates. PocketBase provides all of these in a single binary you can deploy anywhere — no Docker, no database setup, no infrastructure.
Q: Is PocketBase free? A: Yes, fully open-source under MIT license.