Skip to main content

Reserved Collections

pb-ext creates the following PocketBase system collections automatically on startup. Do not create collections with these names in your own code.
Creating collections with these reserved names will cause conflicts and may break pb-ext functionality.

Collections Table

_analytics

Purpose: Stores daily aggregated visitor analytics data. Type: System collection (hidden from PocketBase Collections UI) Retention: Automatically purged after 90 days

Schema

GDPR Compliance

No PII stored:
  • No IP addresses
  • No user agents
  • No visitor IDs
  • No session tokens
Only aggregated counts by device/browser category.

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:
  1. Oldest record is deleted
  2. New record is inserted
  3. 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 hours

Schema

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

  1. pb-ext checks if collection exists
  2. If exists, validates schema matches expected
  3. If schema mismatch, runs migration
  4. If doesn’t exist, creates with correct schema

Logs

Migration logs appear in server output:

Accessing Collections Programmatically

Read Analytics Data

Read Job Logs

Do not manually create, update, or delete records in these collections. Use pb-ext’s provided APIs instead.

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)
Jobs Tab:
  • 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