npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@interchained/portal-source-wordpress

v0.1.1

Published

WordPress Portal Bridge source adapter — WordPress as your backend, Portal as your frontend, HMAC-secured tunnel between them

Readme

@interchained/portal-source-wordpress

WordPress as your backend. Portal as your frontend. HMAC-secured bridge between them.

The Portal side of WP Portal Bridge: clients keep the WordPress admin they already know — pages, posts, media, menus, Yoast/Rank Math/AIOSEO — while Portal renders the site their visitors actually see. Lean, fast, cacheable, SEO-safe, authority-preserving.

WordPress Admin → wp-portal-bridge plugin → signed contract API
              → this adapter → Portal renderer → fast public website

Setup — two env vars

Install wp-portal-bridge on the WordPress site, click Connect Portal Frontend, copy the env block:

PORTAL_BRIDGE_BASE_URL=https://cms.example.com
PORTAL_TMK=portal_tmk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

portal serve detects the env and activates the bridge automatically: WordPress-backed routes render server-side ahead of the SPA fallback, /sitemap.xml is generated from the source, and every URL path WordPress earned is preserved exactly.

API

import { wordpressPortalBridgeFromEnv } from "@interchained/portal-source-wordpress";

const source = wordpressPortalBridgeFromEnv();
await source.ready();                      // store-first, tunnel when empty

const route = await source.resolve("/about/");  // deterministic slash-toggle lookup
source.site(); source.menus(); source.routes(); source.sitemapEntries();

Explicit config, all nine capabilities:

import { wordpressPortalBridge, BridgeClient } from "@interchained/portal-source-wordpress";

const source = wordpressPortalBridge({ baseUrl, tmk, mode: "snapshot-first" });
const client = new BridgeClient({ baseUrl, tmk });
// getHealth · getSite · getRoutes · getRoute · getMenus
// getAssets · getTaxonomies · getSitemap · getSnapshot (auto-merges 413 chunks)

The tunnel

Every request is signed (PORTAL-BRIDGE-V1): raw request target exactly as sent, timestamped, nonce-unique, body-hashed, HMAC-SHA256 with PORTAL_TMK. Response signatures (PORTAL-BRIDGE-RESPONSE-V1) are verified when present. The key id is derived from the TMK (wpb_ + sha256 prefix), so two env vars are the entire configuration. Redirects are never followed — they change the signed target by design.

Both implementations (this package and the PHP plugin) are asserted against the same golden vectors. Drift on either side fails that side's tests.

PORTAL_TMK is server-side only. Never import this package in browser code.

Snapshot-first (the production mode)

  • Boot from the last-good snapshot; fetch through the tunnel when the store is empty
  • Requests resolve from memory — zero WordPress round-trips on the hot path
  • Past the TTL (PORTAL_BRIDGE_CACHE_TTL, default 300s): background refresh, requests never block
  • WordPress down → the last-good snapshot keeps serving indefinitely

Live mode (PORTAL_BRIDGE_MODE=live) resolves per-request through the tunnel and still falls back to the snapshot on failure.

Snapshot persistence — NEDB first

PORTAL_BRIDGE_NEDB_URL=http://127.0.0.1:7070   # or NEDB_URL; NEDBD_TOKEN if gated

With a nedbd reachable, snapshots persist to NEDB: every save is an append to a BLAKE2b hash-chained log, cites the chain head it extends (caused_by), passes verify-after-write, and the engine's verify proves the history untouched — versioned, tamper-evident, AS OF-replayable. This is the on-ramp to the NEDB snapshot ledger.

Without NEDB, a plain file (.portal/bridge-snapshot.json) holds the last-good snapshot. Custom backends implement the two-method SnapshotStore interface.

(Client WordPress sites keep whatever database WordPress runs on — MySQL, MariaDB, anything. That side is reached only through WordPress APIs and never changes.)

Rendering

renderRouteHtml(route, site, menus, options) produces a complete, zero-JS-required document: earned SEO applied exactly (title, description, canonical, OG, Twitter, robots, honest modified times), nav from WordPress menus, content sanitized (scripts/handlers/scriptable-URLs stripped, Gutenberg markup preserved) inside a scoped .wp-bridge-content with a minimal block-compatibility stylesheet. PORTAL_BRIDGE_PUBLIC_ORIGIN re-roots canonicals/sitemap onto the public domain, paths untouched.

Failure behavior

Missing/malformed env → BridgeConfigError, serve refuses to boot. Tunnel rejection → BridgeAuthError. Tampered response → BridgeIntegrityError. Oversized snapshot → chunked automatically. WordPress unreachable → last-good snapshot.

Test

pnpm test   # golden vectors + mock-tunnel behavior + sanitizer policy

GPL-3.0-or-later · © Interchained