Documentation Index
Fetch the complete documentation index at: https://mintlify.com/magooney-loon/pb-ext/llms.txt
Use this file to discover all available pages before exploring further.
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
| Collection | Purpose |
|---|---|
_analytics | Daily aggregated page view counters (one row per path/date/device/browser). Retention: 90 days. |
_analytics_sessions | Ring buffer of the 50 most recent visits for the Recent Activity display. No PII stored. |
_job_logs | Cron job execution logs (start time, end time, duration, status, output). Retention: 72 hours. |
_analytics
Purpose: Stores daily aggregated visitor analytics data. Type: System collection (hidden from PocketBase Collections UI) Retention: Automatically purged after 90 daysSchema
| Field | Type | Description |
|---|---|---|
path | string | Page path (e.g., /api/v1/todos) |
date | date | Aggregation date (day-level) |
device | string | Device category: desktop, mobile, tablet, or unknown |
browser | string | Browser family: Chrome, Firefox, Safari, etc. |
views | integer | Total page views for this combination |
unique_visitors | integer | Estimated unique visitors (deduplicated by session) |
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
| Field | Type | Description |
|---|---|---|
timestamp | datetime | Visit timestamp |
path | string | Visited page path |
device | string | Device category |
browser | string | Browser family |
referrer | string | Referrer URL (sanitized, no query params) |
utm_source | string | UTM source parameter |
utm_medium | string | UTM medium parameter |
utm_campaign | string | UTM campaign parameter |
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
| Field | Type | Description |
|---|---|---|
job_id | string | Unique job identifier |
job_name | string | Human-readable job name |
start_time | datetime | Execution start timestamp |
end_time | datetime | Execution end timestamp |
duration_ms | integer | Execution duration in milliseconds |
status | string | success, failed, or running |
output | text | Structured JSON log output |
error | text | Error message if status is failed |
progress | integer | Progress percentage (0-100) |
statistics | json | Custom job statistics (optional) |
Example Query
System Jobs
pb-ext registers these system jobs automatically:| Job ID | Schedule | Description |
|---|---|---|
__pbExtLogClean__ | 0 0 * * * (daily midnight) | Purge _job_logs records older than 72 hours |
__pbExtAnalyticsClean__ | 0 3 * * * (daily 3 AM) | Purge _analytics rows older than 90 days |
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