Files
WRNexusJS/examples/inter-app-api-showcase/README.md
T
ClintchizandClaude Opus 5 5112cc1a62
Quality / quality (ubuntu-latest) (push) Failing after 13m21s
Quality / quality (windows-latest) (push) Canceled after 0s
docs: measure the runtime and the generated client modules
Adds a per-subsystem measurement of reactive.js, made by minifying it
repeatedly with one subsystem removed rather than counting source bytes.

This corrects the earlier audit on both figures and on the conclusion drawn
from them. Component controllers are 23,722 bytes minified / 6,660 gzipped --
30.6% of transfer, not the "about 18%" previously claimed -- and splitting them
out saves 6.6 kB gzipped on a typical page, not "3-4 kB". Measured against the
example app, / and /login use none of the ten controllers and /layout uses one,
so most pages download and parse the lot for nothing.

The larger finding is that the runtime is not where the weight is. One page
parses 490,212 decoded bytes across 11 generated client modules while
transferring 21,026, and the largest module is 89.8% duplicated lines: the
state-restore prologue appears 162 times because client-codegen.ts inlines the
sync into every peer alias of every client function. Gzip hides it on the wire,
but parse cost follows decoded bytes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 10:02:36 +05:30

1.1 KiB

Inter-app + external API showcase

GET /api/product-summary?sku=starter demonstrates one request handler making:

  1. an RPC request to the catalog app (getProduct);
  2. an external HTTPS request to GitHub's public REST API; and
  3. an RPC request to the audit app (recordLookup).

The handler deliberately forwards as: ctx only to WRNexus peer apps. The RPC package turns that into a short-lived subject/tenant token; it is never forwarded to GitHub. Each peer app must implement the same contract from app/lib/contracts.ts (normally a shared workspace package) under app/services/, and must authorize its own procedures.

Before running this app, configure all three apps with the same private internal-origin map and a distinct, 32+ character RPC secret:

WRNEXUS_RPC_SECRET=replace-with-a-private-32-character-minimum-secret
WRNEXUS_APP_NAME=product-summary
WRNEXUS_INTERNAL_ORIGINS={"catalog":"http://127.0.0.1:4101","audit":"http://127.0.0.1:4102"}

The peer app processes must remain private; the public gateway blocks the RPC route by design. Run with bun run --cwd examples/inter-app-api-showcase dev.