Overview
PocketBase serves as the single source of truth for all platform data, including devices, users, actions, media events, and system configuration. It provides a REST API, real-time subscriptions, and built-in authentication.Configuration
Docker Compose
Environment variables
| Variable | Description | Default |
|---|---|---|
BAKER_URL | Baker service URL | Required |
MEDIAMTX_API | MediaMTX API endpoint | Required |
JOYSTICK_API_URL | Joystick service URL | Required |
JOYSTICK_API_KEY | API key for Joystick | Required |
Volumes
pb_data:/pb_data- Persistent database storage./pocketbase/pb_migrations:/pb_migrations- Database migration files
Collections
PocketBase manages several core collections:devices
Stores device information and configuration:actions
Defines available device actions:run
Maps actions to devices with commands:gallery
Stores media events:users
User accounts and authentication:schedules
Scheduled actions managed by Baker:Authentication
PocketBase provides built-in authentication:User authentication
Admin authentication
API token authentication
Services use API tokens for authentication:Real-time subscriptions
Subscribe to collection changes:Hooks and automation
PocketBase supports server-side hooks for automation:Device hooks
Automatically update MediaMTX when device changes:Schedule hooks
Sync schedules with Baker:REST API
PocketBase exposes a full REST API:List records
page- Page numberperPage- Records per pagefilter- Filter expressionsort- Sort field(s)expand- Relations to expand
Get record
Create record
Update record
Delete record
Filtering and sorting
Powerful filtering syntax:File storage
PocketBase handles file uploads:Migrations
Database schema managed via migrations:Admin UI
PocketBase provides an admin UI at:- Collection management
- Record browsing and editing
- User management
- API rules configuration
- Logs and monitoring
Health check
Backup and restore
Backup PocketBase data:Security
API rules
Collection-level access control:CORS
CORS configured for cross-origin requests:Performance optimization
Indexes
Add indexes for frequently queried fields:Caching
Enable query result caching:Integration with services
All services integrate with PocketBase:- Joystick - Reads devices, actions, and run configurations
- Studio - Stores media events in gallery collection
- Switcher - Updates device mode and activeSlot
- Baker - Reads schedules collection
- Whisper - Reads device phone numbers
- Panel - Full CRUD operations on all collections
Troubleshooting
Connection errors
- Verify
POCKETBASE_URLis correct in services - Check PocketBase is healthy
- Review network connectivity
Authentication failures
- Verify user credentials
- Check token expiration
- Review API rules
Performance issues
- Add indexes on queried fields
- Reduce page size in queries
- Use filtering to limit results
- Enable caching where appropriate