$ show benallfree/pocketpages
PocketPages is a server-side page rendering framework for PocketBase, enabling developers to build multi-page applications (MPAs) using file-based routing, EJS templating, and a plugin system. The core framework handles route resolution, middleware execution, layout rendering, and asset fingerprinting. It includes a rich plugin ecosystem for authentication (password, OTP, OAuth2, anonymous), realtime SSE updates, Markdown processing, and Datastar integration. The monorepo also provides starter kits (minimal, auth, daisyui, htmx, datastar) and a documentation site built with the framework itself. In production, it runs as a PocketBase hook, intercepting HTTP requests and rendering pages from the `pb_hooks/pages/` directory with full access to the PocketBase JSVM API.
The LLM identified 4 files worth highlighting for reuse:
Resolves URL paths to route definitions by matching against a file-system derived route tree. Supports dynamic parameters (e.g., `[param]`), optional segments, and nested routes. The algorithm is self-contained and could be extracted for any file-based routing system.
Generates content-based fingerprints for static assets by hashing file contents. Used for cache invalidation in production. The function is a pure utility with no internal dependencies, making it directly reusable in any web project.
Loads and normalizes plugin factories from configuration. Handles both inline plugin definitions and external module references, providing a consistent interface for plugin initialization. Demonstrates a clean plugin architecture that can be adapted for other extensible systems.
Implements the PocketPages plugin interface to provide authentication strategies (password, OTP, OAuth2, anonymous, token). Extends the context API with auth-related methods and handles login flows. The plugin pattern is a reusable example of how to extend the framework with custom functionality.