Reserved Collections
pb-ext creates the following PocketBase system collections automatically on startup. Do not create collections with these names in your own code.Collections Table
_analytics
Purpose: Stores daily aggregated visitor analytics data. Type: System collection (hidden from PocketBase Collections UI) Retention: Automatically purged after 90 daysSchema
GDPR Compliance
No PII stored:- No IP addresses
- No user agents
- No visitor IDs
- No session tokens
Example Query
_analytics_sessions
Purpose: Ring buffer of the 50 most recent visitor sessions for the “Recent Activity” dashboard widget. Type: System collection (hidden from PocketBase Collections UI) Retention: Only the 50 most recent records are kept (ring buffer)Schema
GDPR Compliance
No PII stored:- No IP addresses
- No user agents
- No cookies
- No fingerprinting
Ring Buffer Behavior
When the 51st record is inserted:- Oldest record is deleted
- New record is inserted
- Collection always contains ≤ 50 records
_job_logs
Purpose: Stores cron job execution logs. Type: System collection (hidden from PocketBase Collections UI) Retention: Automatically purged after 72 hoursSchema
Example Query
System Jobs
pb-ext registers these system jobs automatically:
They appear in the dashboard with the “System” badge.
Auto-Migration on Upgrade
Schema notes:- All three collections are system collections (hidden from the PocketBase Collections UI)
- On upgrade from an old pb-ext version, incompatible schemas are automatically migrated at startup
- No manual steps required
Migration Process
- pb-ext checks if collection exists
- If exists, validates schema matches expected
- If schema mismatch, runs migration
- If doesn’t exist, creates with correct schema
Logs
Migration logs appear in server output:Accessing Collections Programmatically
Read Analytics Data
Read Job Logs
Dashboard Integration
pb-ext’s dashboard at/_/_ visualizes data from these collections:
Analytics Tab:
- Page view charts (from
_analytics) - Device breakdown
- Browser distribution
- Recent activity feed (from
_analytics_sessions)
- Registered cron jobs
- Execution history (from
_job_logs) - Job status monitoring
- Manual job triggers
Customizing Retention
Retention is controlled by the system cleanup jobs. To customize:Analytics Retention (default: 90 days)
Job Logs Retention (default: 72 hours)
Best Practices
Don't Create These Collections
Never manually create collections with reserved names. Let pb-ext handle initialization.
Read-Only Access
Treat these as read-only from your application code. Write operations should go through pb-ext APIs.
Monitor Disk Usage
If analytics volume is high, consider shorter retention periods or archival strategies.
Backup Carefully
These collections change frequently. Exclude from backups or use incremental strategies.
Further Reading
- Reserved Routes - Protected pb-ext routes
- Middleware - Analytics middleware integration