pb-plugin-collection-groups
An xpb plugin that groups PocketBase collections in the Superuser UI by configurable collection-name prefixes.

Collections appear in collapsible sidebar groups, and the collection editor provides separate Group and Name controls. Manage groups through the Plugins tab provided by pb-plugin-base.
Compatibility
| Dependency |
Compatible versions |
| PocketBase |
v0.42.x |
| xpb |
v0.1.0 |
| Go |
1.27.1+ |
| pb-plugin-base |
v0.3.0 (browser API v1) |
PocketBase's Superuser UI extension API is experimental. Compatibility follows PocketBase's minor release line and should be rechecked before moving to a newer minor version.
PocketBase now lives at ganigeorgiev.com/pocketbase/pocketbase. Custom Go applications must use the ganigeorgiev.com/pocketbase/* imports alongside xpb v0.1.0.
Install
Build PocketBase with both this plugin and pb-plugin-base. For a reproducible build, pin the plugin versions:
xpb build v0.42.3 \
--with github.com/pocketbuilds/xpb@v0.1.0 \
--with github.com/mjadobson/pb-plugin-base@v0.3.0 \
--with github.com/mjadobson/pb-plugin-collection-groups@v0.1.0
For a custom Go application, blank-import both plugins:
import (
_ "github.com/mjadobson/pb-plugin-base"
_ "github.com/mjadobson/pb-plugin-collection-groups"
)
Then initialize xpb as normal in your PocketBase application. Browser registration is independent of extension load order.
Group settings
Open Plugins → Collection groups to create, edit, delete, and reorder groups. Each group has a display name and a literal collection-name prefix. For example, a Blog group with prefix blog_ produces:
blog_posts → Blog / posts
blog_comments → Blog / comments
blog_categories → Blog / categories
unrelated → Other / unrelated
New collections with a matching prefix join the group automatically. Prefixes include their separator: use blog_ if collection names begin with blog_. Prefixes use PocketBase-compatible word characters, such as blog_, blog__, or internal_.
Matching is case-insensitive, and the longest matching prefix wins. With prefixes admin_ and admin_internal_, admin_internal_jobs belongs to the latter group. A prefix must leave a non-empty collection name after it is removed.
Prefix edits preview which collections enter, leave, or move between groups. Editing or deleting a group never renames a collection. Changing blog_ to content_ changes how existing collections are grouped; their stored names remain the same.
Group names and prefixes must be unique, with Unicode normalization and case folding applied. Pinned, Other, and System are reserved group names.
Collection editor
The collection editor presents the collection name as separate Group and Name controls. Selecting Blog and entering posts produces the PocketBase name blog_posts.
Changing these controls on an existing collection changes its real name. Moving Blog / posts to a Forum group with prefix forum_, for example, renames blog_posts to forum_posts. The editor previews the full name, warns before renaming, and rejects choices that would resolve to a different group because of overlapping prefixes.
PocketBase's REST API and SDK continue to use the full collection name:
pb.collection("blog_posts")
The grouped sidebar preserves search, pinning, collection type icons, OAuth2 warnings, active-collection scrolling, and the Collections overview and New collection actions.
Pinned collections appear once in Pinned and are excluded from their group's count. System collections remain in System, and unmatched collections appear in Other. Expanded and collapsed group state is saved locally in the browser.
Storage and synchronization
Group settings are stored in the plugin-owned PocketBase system collection _plugins_collection_groups. Records contain the display name, prefix, sort order, and revision, with hidden fields for uniqueness and schema ownership.
Changes synchronize through PocketBase realtime events. Superuser-only mutation routes check revisions to prevent stale sessions from overwriting newer settings; group creation and reordering are handled transactionally.
POST /api/xpb/collection-groups
PATCH /api/xpb/collection-groups/{id}
DELETE /api/xpb/collection-groups/{id}
PUT /api/xpb/collection-groups/order
Reordering requires every current group exactly once and returns the updated order and revisions.
Uninstall
Removing the plugin leaves ordinary collections and their names unchanged. The _plugins_collection_groups system collection is retained so settings survive reinstalling the plugin. Delete it manually if you also want to remove the saved configuration.
Development
Build a PocketBase binary with the local plugin:
make build-pocketbase-binary
The Makefile runs xpb v0.1.0 to build PocketBase v0.42.3 with pb-plugin-base v0.3.0, using xpb's local module replacement support.
Run the Go and browser regression suites before publishing:
gofmt -w *.go
go mod tidy
go vet ./...
go test ./...
node --check ui/main.js
node --check webtest/browser_smoke.mjs
node --test webtest/main.test.mjs
The Go tests cover schema ownership, validation, concurrent creation, ordering, revision checks, and authenticated mutation routes. The browser tests use a VM harness to cover grouping, collection editing, settings changes, and realtime synchronization.
For a Chromium smoke test, start a disposable PocketBase instance built with both plugins, then run:
PB_SMOKE_URL=http://127.0.0.1:8090/_/ \
PB_SUPERUSER_EMAIL=admin@example.com \
PB_SUPERUSER_PASSWORD=secret \
node webtest/browser_smoke.mjs
The smoke test creates and removes a temporary group and collection, checks the grouped sidebar, and opens the collection editor. It requires Chromium/Chrome and Node.js 22+, with no npm packages. Set CHROMIUM_BIN if the browser is not found automatically.
License
MIT