Octopool is a production-grade GitHub API relay and caching proxy, deployed as a Cloudflare Worker with a companion Go CLI. It pools multiple GitHub identities (PATs, GitHub App installations) to share API quota, caches responses in D1 and edge cache, and applies string-rewrite policies to protect sensitive data. The CLI acts as a drop-in `gh` shim, routing eligible read commands through the relay before falling back to native `gh`. The system also supports token-free transports (public web pages, raw content, Git smart HTTP) to minimize API consumption. Architecture includes Durable Objects for coordination (pool identity selection, cache-fill ownership, policy revisioning), D1 for persistent cache and audit, and edge cache for low-latency reads. The codebase is dual-language (TypeScript for Worker, Go for CLI) with extensive unit and e2e tests, CI/CD, and a dashboard for monitoring.
This repository is a JavaScript library providing a BroadcastChannel polyfill with leader election capabilities. It enables cross-tab/window/node-process communication through multiple fallback mechanisms (native BroadcastChannel, IndexedDB, localStorage, Node.js sockets, and a simulate method). The library implements leader election algorithms to coordinate multiple instances, ensuring only one acts as leader at a time. It supports diverse environments including old browsers, modern browsers, WebWorkers, Node.js, Deno, and iframes. The architecture centers around a core BroadcastChannel class with pluggable method implementations, a method chooser for fallback selection, and separate leader election utilities. Key entry points are the exported BroadcastChannel class and createLeaderElection function from src/index.js.