Page not found
The address may be outdated or misspelled. No private or duplicate route is exposed here.
diff --git a/app/docs.test.ts b/app/docs.test.ts index a32dcf48..82d3a306 100644 --- a/app/docs.test.ts +++ b/app/docs.test.ts @@ -60,6 +60,15 @@ test("every package page contains installation, guide, and complete API sections } }); +test("every package page shows multiple named usage examples", () => { + for (const name of expected) { + const source = readFileSync(join(packagePages, `${name}.wrn`), "utf8"); + expect(source.match(/class="example-card"/g)?.length ?? 0).toBeGreaterThanOrEqual(2); + expect(source).not.toContain("
The address may be outdated or misspelled. No private or duplicate route is exposed here.
WRNexusJS 0.2.23 packages are not available from the public npm registry. Installation requires approval and private registry credentials supplied by WorkRoot. Never paste registry tokens into source control, issue reports, or support messages.
bunx @wrnexus/cli@0.2.23 create my-appAccess approval, response time, licensing terms, and support level remain owner-controlled. This site does not collect access requests directly.
WRNexusJS 0.2.24 packages are not available from the public npm registry. Installation requires approval and private registry credentials supplied by WorkRoot. Never paste registry tokens into source control, issue reports, or support messages.
bunx @wrnexus/cli@0.2.24 create my-appAccess approval, response time, licensing terms, and support level remain owner-controlled. This site does not collect access requests directly.
WRNexusJS is Bun-native and SSR-first. File discovery maps pages and API handlers; middleware enriches or short-circuits a request; the compiler turns .wrn declarations into server render functions and small feature runtimes.
core owns contexts, middleware, sessions and rooms; router discovers routes; compiler parses .wrn; ssr renders documents; csr supplies browser runtimes; dev-server and cli orchestrate development and builds.
Validation happens at trust boundaries. Session authentication establishes identity; authorization makes resource decisions. CSP, Trusted Types, CSRF, upload checks, WebSocket origins, request limits, and output escaping are layered controls—not substitutes for application policy.
Rooms are process-local unless connected through pub/sub. Redis-backed pub/sub distributes events. Queue durability depends on the selected driver and must be evaluated explicitly.
The gateway can dispatch multiple applications while preserving route, component, asset, config, and session boundaries. Validate host routing and isolation before production.
wrnexus build . produces dist/server.js and hashed/static assets. Run the server with Bun, apply migrations before traffic, terminate TLS at a trusted edge, and forward only expected proxy headers.
Mobile compatibility bridges SSR-safe Capacitor capabilities; native route generation is experimental and is not general web portability. Test each target platform.
app/routes.gen.ts, .wrnexus/, and dist/ are generated. The runtime is Bun-only. Preview packages are private. Historical compatibility and long-term support policy are not yet published.
WRNexusJS is Bun-native and SSR-first. File discovery maps pages and API handlers; middleware enriches or short-circuits a request; the compiler turns .wrn declarations into server render functions and small feature runtimes.
core owns contexts, middleware, sessions and rooms; router discovers routes; compiler parses .wrn; ssr renders documents; csr supplies browser runtimes; dev-server and cli orchestrate development and builds.
Validation happens at trust boundaries. Session authentication establishes identity; authorization makes resource decisions. CSP, Trusted Types, CSRF, upload checks, WebSocket origins, request limits, and output escaping are layered controls—not substitutes for application policy.
Rooms are process-local unless connected through pub/sub. Redis-backed pub/sub distributes events. Queue durability depends on the selected driver and must be evaluated explicitly.
The gateway can dispatch multiple applications while preserving route, component, asset, config, and session boundaries. Validate host routing and isolation before production.
wrnexus build . produces dist/server.js and hashed/static assets. Run the server with Bun, apply migrations before traffic, terminate TLS at a trusted edge, and forward only expected proxy headers.
Mobile compatibility bridges SSR-safe Capacitor capabilities; native route generation is experimental and is not general web portability. Test each target platform.
app/routes.gen.ts, .wrnexus/, and dist/ are generated. The runtime is Bun-only. Preview packages are private. Historical compatibility and long-term support policy are not yet published.
No comparative speed claims are published. A valid baseline must record scripts, commit, Bun/framework versions, hardware, OS, warmup, samples, workload, raw results, median, percentiles, memory, HTML size, browser JavaScript size, and run date.
The roadmap starts with WRNexusJS-only measurements before any maintained equivalent-workload comparison.
Documentation is aligned to all 26 installed packages. This release adds @wrnexus/helpers, original-request URL helpers, safe login redirects, working wrnexus workspace add, and forward-auth redirect propagation.
Run wrnexus update --latest and keep every @wrnexus/* package on 0.2.23. Existing applications must explicitly add @wrnexus/helpers before importing it; newly scaffolded applications include it automatically.
The packages use semantic-looking versions, but a formal compatibility and old-release support policy has not been approved. Preview consumers should treat minor releases as potentially requiring migration review.
Documentation is aligned to all 26 installed packages. This release adds @wrnexus/helpers, original-request URL helpers, safe login redirects, working wrnexus workspace add, and forward-auth redirect propagation.
Run wrnexus update --latest and keep every @wrnexus/* package on 0.2.24. Existing applications must explicitly add @wrnexus/helpers before importing it; newly scaffolded applications include it automatically.
The packages use semantic-looking versions, but a formal compatibility and old-release support policy has not been approved. Preview consumers should treat minor releases as potentially requiring migration review.
Examples are tied to installed 0.2.23 package documentation. The focused snippets in guides are source-verified; standalone runnable projects and CI compilation are tracked as remaining work.
Examples are tied to installed 0.2.24 package documentation. The focused snippets in guides are source-verified; standalone runnable projects and CI compilation are tracked as remaining work.
This path creates a server-rendered page, validated API route, middleware, and realtime next step. It requires approved registry access and Bun 1.3.x; this site was verified with Bun 1.3.14.
bunx @wrnexus/cli@0.2.23 create my-app
+ Preview guide · v0.2.24Build a contact inbox
This path creates a server-rendered page, validated API route, middleware, and realtime next step. It requires approved registry access and Bun 1.3.x; this site was verified with Bun 1.3.14.
1. Create the project
bunx @wrnexus/cli@0.2.24 create my-app
cd my-app
bun install
bun run dev
2. Know the structure
app/pages/ # file-based .wrn routes
@@ -39,7 +39,7 @@ export const POST = async (ctx) => {
}
7. Test and ship
bun run test
bun run build
bun dist/server.js
Next: deployment, database, authentication, and workspaces.
-
+
Export GET, POST, PUT, PATCH, or DELETE from app/api files. Validate request bodies, enforce authentication and authorization, cap request sizes, and return Web Responses.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Export GET, POST, PUT, PATCH, or DELETE from app/api files. Validate request bodies, enforce authentication and authorization, cap request sizes, and return Web Responses.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Configure session authentication, log users in through supported auth helpers, and read identity from context. Cookie flags, rotation, expiry, and secret storage remain deployment responsibilities.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Configure session authentication, log users in through supported auth helpers, and read identity from context. Cookie flags, rotation, expiry, and secret storage remain deployment responsibilities.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Authentication identifies; authorization decides. Enforce permissions in server routes and policies, including object ownership. UI hiding is never an authorization boundary.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Authentication identifies; authorization decides. Enforce permissions in server routes and policies, including object ownership. UI hiding is never an authorization boundary.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
wrnexus.config.ts owns styles, SEO, security, data, mobile, fonts, and profiles. Keep secrets in validated environment variables and review merged production configuration.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
wrnexus.config.ts owns styles, SEO, security, data, mobile, fonts, and profiles. Keep secrets in validated environment variables and review merged production configuration.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Configure SQLite or the installed supported driver, keep queries in named SQL blocks, generate typed functions, and apply migrations before traffic. Back up data and test rollback independently.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Configure SQLite or the installed supported driver, keep queries in named SQL blocks, generate typed functions, and apply migrations before traffic. Back up data and test rollback independently.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Run bun run build, apply migrations, and start dist/server.js with Bun. Configure TLS, proxy trust, environment validation, health checks, graceful restarts, logs, backups, and restrictive security headers.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Run bun run build, apply migrations, and start dist/server.js with Bun. Configure TLS, proxy trust, environment validation, health checks, graceful restarts, logs, backups, and restrictive security headers.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Define a v.object schema, use data-schema on the form, show field errors with data-error, and always call parseBody on the server. refine is server-only.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Define a v.object schema, use data-schema on the form, show field errors with data-error, and always call parseBody on the server. refine is server-only.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Store locale JSON under app/locales and use translation directives. Themes resolve CSS tokens; ensure contrast, system preference behavior, persistence, and non-color cues.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Store locale JSON under app/locales and use translation directives. Themes resolve CSS tokens; ensure contrast, system preference behavior, persistence, and non-color cues.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Middleware receives context and next. Return next() to continue or return a Response to stop. Put request limits and trust-boundary controls before business logic.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Middleware receives context and next. Return next() to continue or return a Response to stop. Put request limits and trust-boundary controls before business logic.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Mobile capabilities are experimental in this preview. Test Capacitor permissions and lifecycle on each platform; do not assume every .wrn or browser API converts to native.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Mobile capabilities are experimental in this preview. Test Capacitor permissions and lifecycle on each platform; do not assume every .wrn or browser API converts to native.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use tracking middleware and sinks with redaction, sampling, stable request identifiers, alert ownership, and retention limits. Never capture registry tokens or session secrets.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use tracking middleware and sinks with redaction, sampling, stable request identifiers, alert ownership, and retention limits. Never capture registry tokens or session secrets.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Pages are routable, components are reusable, and layouts provide shared slots. Mount a component with data-component and keep browser state scoped and minimal.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Pages are routable, components are reusable, and layouts provide shared slots. Mount a component with data-component and keep browser state scoped and minimal.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Pages, components, layouts, APIs, middleware, schemas, database files, locales, realtime rooms, and styles live under app. Never edit app/routes.gen.ts, .wrnexus, or dist by hand.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Pages, components, layouts, APIs, middleware, schemas, database files, locales, realtime rooms, and styles live under app. Never edit app/routes.gen.ts, .wrnexus, or dist by hand.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
The in-process driver cannot cross processes. Use Redis where instances must share events, define channel ownership, and design for reconnects and duplicate delivery.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
The in-process driver cannot cross processes. Use Redis where instances must share events, define channel ownership, and design for reconnects and duplicate delivery.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Queue behavior is preview-level. Treat in-process work as non-durable, make handlers idempotent, cap retries, record failures, and choose a production persistence strategy.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Queue behavior is preview-level. Treat in-process work as non-durable, make handlers idempotent, cap retries, record failures, and choose a production persistence strategy.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
defineRoom handles connection and messages. Validate message shapes, authorize subscriptions, restrict origins, bound payloads, and use pub/sub to scale across processes.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
defineRoom handles connection and messages. Validate message shapes, authorize subscriptions, restrict origins, bound payloads, and use pub/sub to scale across processes.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
A page filename defines its URL; index maps to the directory root and bracket segments are dynamic parameters. API files under app/api expose HTTP method functions and receive a Context.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
A page filename defines its URL; index maps to the directory root and bracket segments are dynamic parameters. API files under app/api expose HTTP method functions and receive a Context.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use CSP, CSRF, Trusted Types, session hardening, validation, origin checks, upload restrictions, encryption, request limits, and explicit CORS. See the security policy for reporting.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use CSP, CSRF, Trusted Types, session hardening, validation, origin checks, upload restrictions, encryption, request limits, and explicit CORS. See the security policy for reporting.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use an ssr API binding, return the desired response field, and render it with a server #each block. Values are escaped. Avoid fetching private data through a route that lacks authorization.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use an ssr API binding, return the desired response field, and render it with a server #each block. Values are escaped. Avoid fetching private data through a route that lacks authorization.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use Bun tests and @wrnexus/test helpers. Cover server HTML, API status and validation, authorization failures, reactive behavior, and a production startup smoke test.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Use Bun tests and @wrnexus/test helpers. Cover server HTML, API status and validation, authorization failures, reactive behavior, and a production startup smoke test.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Confirm Bun and package versions, regenerate docs/routes through supported commands, read the first compiler diagnostic, check file naming, validate config, and reproduce under a production build.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Confirm Bun and package versions, regenerate docs/routes through supported commands, read the first compiler diagnostic, check file naming, validate config, and reproduce under a production build.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Back up and commit first, then use wrnexus update --latest as documented by the installed CLI. Review migrations and keep every @wrnexus package aligned. Current release: 0.2.23.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Back up and commit first, then use wrnexus update --latest as documented by the installed CLI. Review migrations and keep every @wrnexus package aligned. Current release: 0.2.24.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Configure named stores, accepted MIME/extensions, and maxBytes. Random keys avoid path traversal. Private files require an authenticated serving route; v1 buffers each file in memory.
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
Configure named stores, accepted MIME/extensions, and maxBytes. Random keys avoid path traversal. Private files require an authenticated serving route; v1 buffers each file in memory.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
A workspace runs isolated applications behind one domain-routing gateway. Add an application from the workspace root; the CLI scaffolds apps/reports and registers it in wrnexus.workspace.ts:
wrnexus workspace add reports --domain=reports.localhost
+ Preview guide · 0.2.24Workspaces and gateway
A workspace runs isolated applications behind one domain-routing gateway. Add an application from the workspace root; the CLI scaffolds apps/reports and registers it in wrnexus.workspace.ts:
wrnexus workspace add reports --domain=reports.localhost
bun install
bun run dev
Forward authentication
Point protected applications at a dedicated verifier endpoint. The verifier must return 2xx for an authenticated session, 401/403 to deny access, or an HTTP redirect to begin browser login.
// wrnexus.workspace.ts
{
@@ -28,8 +28,8 @@ export const GET = async (ctx: Context) => {
return redirectToLogin(ctx, "/login", {
allowedHosts: ["admin.localhost:3000", "reports.localhost:3000"],
});
-};
Always allowlist redirect hosts. After login, validate or sign the returnTo value before redirecting. Keep internal app ports private and open applications through the gateway port.
Release scope
This guide describes installed 0.2.23 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
-
+};Always allowlist redirect hosts. After login, validate or sign the returnTo value before redirecting. Keep internal app ports private and open applications through the gateway port.
This guide describes installed 0.2.24 capabilities. Follow linked package declarations for exact signatures; undocumented behavior is not guaranteed.
WRNexusJS v0.2.23
WRNexusJS is an SSR-first, Bun-native full-stack framework. Build typed pages, APIs, validated forms, realtime rooms, secure sessions, workspaces, and optional mobile experiences with the .wrn component language.
Private developer preview. Request access to the package registry.
page Dashboard {
+ Private Developer PreviewWRNexusJS v0.2.24
Build from the server.
Ship only what matters.
WRNexusJS is an SSR-first, Bun-native full-stack framework. Build typed pages, APIs, validated forms, realtime rooms, secure sessions, workspaces, and optional mobile experiences with the .wrn component language.
Private developer preview. Request access to the package registry.
app/pages/dashboard.wrnpage Dashboard {
ssr { api tasks GET /api/tasks { return tasks } }
view {
<main>
@@ -35,10 +35,10 @@ export const POST = async (ctx) => {
return result.ok ? Response.json({ ok: true }, { status: 201 }) : result.response;
};
Request lifecycle
- RequestSecurity headers and request limits
- MiddlewareAuthentication, policy, and context
- File routePage or API handler
- Compiler + SSRSafe HTML and scoped runtime
- ResponseHTML, JSON, stream, or realtime upgrade
-Production proof
WorkRoot
Public creator/company site and approved WRNexusJS production showcase.
wrnexusjs.dev
This documentation application runs WRNexusJS 0.2.23.
-Capability status
Capability Status Details SSR, routing, compiler, APIs Preview Installed in 0.2.23; public support policy pending. Mobile/native Experimental Capacitor compatibility and native generation have platform limitations. Durable queues Experimental Production durability requires an appropriate driver strategy.
+Production proof
WorkRoot
Public creator/company site and approved WRNexusJS production showcase.
wrnexusjs.dev
This documentation application runs WRNexusJS 0.2.24.
+Capability status
Capability Status Details SSR, routing, compiler, APIs Preview Installed in 0.2.24; public support policy pending. Mobile/native Experimental Capacitor compatibility and native generation have platform limitations. Durable queues Experimental Production durability requires an appropriate driver strategy.
Continue exploring
-
+
}
}
\ No newline at end of file
diff --git a/app/pages/language.wrn b/app/pages/language.wrn
index f49e4fb3..03f73d21 100644
--- a/app/pages/language.wrn
+++ b/app/pages/language.wrn
@@ -7,15 +7,15 @@ page Thewrnlanguage {
view {
Skip to content
- W WRNexusJS
+ W WRNexusJS
Browse documentation
- Language reference · 0.2.23The .wrn language
File anatomy
page Account {
+ Language reference · 0.2.24The .wrn language
File anatomy
page Account {
layout = "public"
seo { title = "Account" description = "Manage your account." }
state count = 0
view { <button @click="count++">Count {count}</button> }
}
Pages, components, layouts, props, and state
Pages are routes. Components declare default-valued props and may hold state. Layouts provide shared slots. Mount components with data-component; fill default or named slots with data-slot.
Interpolation, conditionals, and loops
Interpolation is HTML-escaped. Use server {#if} and {#each} for SSR data. Use data-show for reactive client visibility.
Events and directives
@click and other events execute in the reactive scope. Data attributes opt into forms, i18n, themes, realtime, uploader, browser, and mobile behavior. Consult the exact package page because availability varies.
Forms, i18n, themes, and realtime
form[data-schema] connects descriptors to client and server validation. Translation keys use {t:key}. Theme toggles use data-wire-theme-toggle. Realtime pages opt into a named room.
Escaping and security
Text interpolation is escaped by default. Do not construct trusted HTML from user input. Server-only refinements must be repeated at the authoritative mutation boundary.
Common compiler errors
- Use balanced braces; a literal brace must be escaped.
- Declare UI in
view, not JSX or hooks. - Use a valid page, component, or layout declaration matching the file role.
- Keep server loops tied to available SSR bindings.
- Check troubleshooting and compiler API for this release.
-
+
}
}
\ No newline at end of file
diff --git a/app/pages/license.wrn b/app/pages/license.wrn
index ee221217..ec822e40 100644
--- a/app/pages/license.wrn
+++ b/app/pages/license.wrn
@@ -7,10 +7,10 @@ page License {
view {
Skip to content
- W WRNexusJS
+ W WRNexusJS
Browse documentation
License
Owner decision requiredThis documentation repository contains no public license file, and the packages are unavailable from the public npm registry. No open-source license or redistribution right should be inferred.
Approved preview users must follow the private/commercial terms supplied by WorkRoot. Contact WorkRoot before copying, redistributing, or using WRNexusJS in production.
-
+
}
}
\ No newline at end of file
diff --git a/app/pages/packages.wrn b/app/pages/packages.wrn
index 9807e540..932b8673 100644
--- a/app/pages/packages.wrn
+++ b/app/pages/packages.wrn
@@ -12,10 +12,10 @@ page Packages {
W WRNexusJS
-
+
Browse documentation
- 26 focused packagesPackage reference
Everything in the framework, organized by responsibility and documented from the published 0.2.23 APIs.
Showing {category} packages
+ 26 focused packagesPackage reference
Everything in the framework, organized by responsibility and documented from the published 0.2.24 APIs.
Showing {category} packages
AI@wrnexus/ai
Server-side Anthropic client with generation and streaming.
Open documentation →
@@ -93,7 +93,7 @@ page Packages {
Security@wrnexus/validation
Typed schemas, coercion, validation, and browser descriptors.
Open documentation →
-
+
Server-side Anthropic client with generation and streaming.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/ai@0.2.23Request preview access. Never put registry tokens in source control.
A tiny, zero-dependency Claude (Anthropic) client for WRNexusJS apps — generate and stream text with Claude from any server-side code.+ +
Server-side Anthropic client with generation and streaming.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/ai@0.2.24Request preview access. Never put registry tokens in source control.
A tiny, zero-dependency Claude (Anthropic) client for WRNexusJS apps — generate and stream text with Claude from any server-side code.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/ai is a thin, dependency-free wrapper over the Anthropic Messages API, built on fetch (Bun-native, no SDK). Use it in API routes, jobs, or middleware to call Claude. It defaults to the most capable model, claude-opus-4-8, reads your key from ANTHROPIC_API_KEY, and supports both one-shot generation and streaming.
// app/api/summarize.ts — summarize posted text
import { createAI } from "@wrnexus/ai";
const ai = createAI();
@@ -89,6 +90,19 @@ export const POST = async (ctx) => {
});
return Response.json({ summary });
};
+// app/api/chat.ts
+import { createAI } from "@wrnexus/ai";
+
+const ai = createAI({ model: "claude-sonnet-5" });
+
+export const POST = async (ctx) => {
+ const { messages } = await ctx.req.json();
+ return ai.streamResponse(messages, {
+ system: "Answer using concise Markdown.",
+ maxTokens: 1_500,
+ });
+};
fetch, ReadableStream, TextDecoder/TextEncoder, andExamples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/aiANTHROPIC_API_KEY=sk-ant-...import { createAI } from "@wrnexus/ai";
-const ai = createAI(); // or createAI({ apiKey, model, maxTokens, baseURL, version })const text = await ai.generate("Write a haiku about Bun.");
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
// app/api/summarize.ts — summarize posted text
+import { createAI } from "@wrnexus/ai";
+const ai = createAI();
-const reply = await ai.generate(
- [
- { role: "user", content: "My name is Ada." },
- { role: "assistant", content: "Hi Ada!" },
- { role: "user", content: "What's my name?" },
- ],
- { system: "You are concise." },
-);// app/api/chat.ts
+import { createAI } from "@wrnexus/ai";
+
+const ai = createAI({ model: "claude-sonnet-5" });
+
+export const POST = async (ctx) => {
+ const { messages } = await ctx.req.json();
+ return ai.streamResponse(messages, {
+ system: "Answer using concise Markdown.",
+ maxTokens: 1_500,
+ });
+};Role, permission, policy, and authorization guards.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/authz@0.2.23Request preview access. Never put registry tokens in source control.
Composable authorization for WRNexusJS — role-based (RBAC), policy-based (PBAC), and attribute-based (ABAC) access control that reduces to a boolean check plus an authorize() guard.
+
+ Role, permission, policy, and authorization guards.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/authz@0.2.24Request preview access. Never put registry tokens in source control.
Composable authorization for WRNexusJS — role-based (RBAC), policy-based (PBAC), and attribute-based (ABAC) access control that reduces to a boolean check plus an authorize() guard.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/authz is a small, server-side authorization toolkit. It gives you three interchangeable models — RBAC (roles → permissions), PBAC (policy predicates), and ABAC (attribute matchers) — that all collapse to a boolean | Promise<boolean> decision. Wrap any decision in a Middleware guard (authorize, requireRole, requirePermission) to protect WRNexusJS routes. Reach for it whenever a route or action needs to be gated on who the user is, what roles they hold, or attributes of the user and the resource. It plugs into @wrnexus/core by reading ctx.user as the authorization subject.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/authzimport { defineRbac, hasRole } from "@wrnexus/authz";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { defineRbac, hasRole } from "@wrnexus/authz";
const rbac = defineRbac({
admin: ["*"],
@@ -184,7 +184,7 @@ const user = { id: "u1", roles: ["editor"] };
rbac.can(user, "post:write"); // true
rbac.can(user, "post:delete"); // false
rbac.permissionsFor(["lead"]); // Set { "post:read", "post:write", "post:publish" }
-hasRole(user, "editor"); // trueimport { authorize, requireRole, requirePermission, defineRbac } from "@wrnexus/authz";
+hasRole(user, "editor"); // trueimport { authorize, requireRole, requirePermission, defineRbac } from "@wrnexus/authz";
const rbac = defineRbac({ admin: ["*"], editor: ["post:read", "post:write"] });
@@ -199,7 +199,7 @@ app.delete(
"/posts/:id",
authorize((ctx) => hasRole(ctx.user, "admin")),
handler,
-);import { any, all, attr, authorize, type Policy } from "@wrnexus/authz";
+);import { any, all, attr, authorize, type Policy } from "@wrnexus/authz";
interface User {
id: string;
@@ -227,7 +227,7 @@ app.put(
);Create, develop, build, generate, test, and maintain WRNexusJS apps.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/cli@0.2.23Request preview access. Never put registry tokens in source control.
The wrnexus command-line tool that scaffolds, runs, builds, tests, and manages WRNexusJS apps.
+
+ Create, develop, build, generate, test, and maintain WRNexusJS apps.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/cli@0.2.24Request preview access. Never put registry tokens in source control.
The wrnexus command-line tool that scaffolds, runs, builds, tests, and manages WRNexusJS apps.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/cli provides the wrnexus executable — the single entry point for developing a WRNexusJS app. It runs the HMR dev server, produces a self-contained production build, scaffolds apps/pages/components, drives database migrations, regenerates typed routes and queries, runs tests, and manages configuration profiles. It also scaffolds multi-app monorepos and serves them behind a domain-routing gateway. This is a CLI/build-time package (it shells out to the Bun binary for the dev child and tests) and it also exports the workspace config types via a subpath.
wrnexus testRuns the app's tests with bun test. Defaults to the test profile (config + .env.test). Pass --watch to re-run on change; extra flags pass straight through to bun test.
wrnexus test . --watch
+bunx @wrnexus/cli create customer-portal
+cd customer-portal
+bun install
+bun run dev
+wrnexus generate page reports/monthly
+wrnexus generate api reports/export
+wrnexus generate component report-filter
+wrnexus generate routes
+wrnexus workspace company-suite
+cd company-suite
+wrnexus workspace add reports --domain=reports.localhost
+bun install
+wrnexus gateway --port=3000
+Open http://reports.localhost:3000; the gateway selects apps/reports from the request host.
wrnexus update --latest --dry-run
+wrnexus update --latest
+wrnexus doctor
Pass --profile=<name> to dev, build, db (or set WRNEXUS_PROFILE) to select a config profile. The CLI publishes WRNEXUS_PROFILE so config loaders and the dev child pick it up, and loads that profile's .env cascade (.env, .env.local, .env.<profile>, .env.<profile>.local) into process.env.
wrnexus dev --profile=uat
@@ -114,13 +136,22 @@ export default config;
@wrnexus/dev-server (dev/prod server + gateway), @wrnexus/router (route + typed-routes codegen), @wrnexus/compiler (.wrn → .ts), @wrnexus/db (migrations, typed queries), @wrnexus/styles (config, profiles, .env, themes, styles), @wrnexus/ui (ejectable Wire UI components), @wrnexus/validation, @wrnexus/csr, and @wrnexus/i18n.wrnexus.config.ts for db / databases, theme, styles, seo, security, i18n, and profiles, and wrnexus.workspace.ts for the gateway.This declaration comes from the exact installed package and lists its exported functions, classes, interfaces, and types.
#!/usr/bin/env bun
-Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/clibunx wrnexus dev
-# or add scripts: "dev": "wrnexus dev .", "build": "wrnexus build ."wrnexus dev . --port=8080bun dist/server.js # PORT env var optional
-# Generated apps also provide: npm start
-# Build and start together: npm run productionExamples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bunx @wrnexus/cli create customer-portal
+cd customer-portal
+bun install
+bun run devwrnexus generate page reports/monthly
+wrnexus generate api reports/export
+wrnexus generate component report-filter
+wrnexus generate routeswrnexus workspace company-suite
+cd company-suite
+wrnexus workspace add reports --domain=reports.localhost
+bun install
+wrnexus gateway --port=3000wrnexus update --latest --dry-run
+wrnexus update --latest
+wrnexus doctorParser and code generators for the .wrn language.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/compiler@0.2.23Request preview access. Never put registry tokens in source control.
Compiler for the+ +.wrnlanguage — tokenizes, parses, and lowers.wrnpage and component files to TypeScript.
Parser and code generators for the .wrn language.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/compiler@0.2.24Request preview access. Never put registry tokens in source control.
Compiler for the.wrnlanguage — tokenizes, parses, and lowers.wrnpage and component files to TypeScript.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/compiler turns .wrn source into TypeScript that targets the framework's runtime primitives. A .wrn file declares either a page (a route) or a component (a reusable, prop-driven fragment) with blocks for state, view (plain HTML), seo, style, functions, api, ssr/client data bindings, and realtime websocket handlers. The pipeline is source → Lexer → parse() → PageAst → generate() → TypeScript. It is a build/server-side library — the WRNexusJS dev loader calls it to compile .wrn files on the fly, surfacing ParseError as a readable error page.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/compilerinterface CompileResult {
- code: string;
- ast: PageAst;
- diagnostics: string[];
-}class Lexer {
- pos: number;
- constructor(src: string);
- next(): Token; // consume next structural token
- peek(): Token; // look ahead without consuming
- readPath(): string; // route path, e.g. /users/[id]
- readToLineEnd(): string; // rest of line (state/prop initializers)
- readBalancedBraces(): string; // inner text of a { ... } block, string-aware
-}import { compileWireFile } from "@wrnexus/compiler";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { compileWireFile } from "@wrnexus/compiler";
const ts = compileWireFile(`
page Home {
@@ -353,10 +341,25 @@ page Home {
}
`);
// ts is a TypeScript module: exports `meta`, and a default page component
-// returning an HTML string, wrapped in a data-scope for the reactive runtime.import { compile, ParseError } from "@wrnexus/compiler";
+
+try {
+ const { code, ast, diagnostics } = compile(source);
+ console.log(ast.kind, ast.name, ast.states.length);
+} catch (err) {
+ if (err instanceof ParseError) console.error(err.message);
+}import { parse, generate } from "@wrnexus/compiler";
+
+const ast = parse(componentSource); // ast.kind === "component"
+const module = generate(ast); // exports render(props) + __wrnexusComponentimport { Lexer } from "@wrnexus/compiler";
+
+const lx = new Lexer("page Home {");
+lx.next(); // { type: "ident", value: "page", pos: 0 }
+lx.next(); // { type: "ident", value: "Home", pos: 5 }
+lx.next(); // { type: "lbrace", value: "{", pos: 10 }Contexts, middleware, security, sessions, caching, JSX, and realtime.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/core@0.2.23Request preview access. Never put registry tokens in source control.
The framework core: the request Context, middleware contract, and the security, session, caching, streaming, realtime, and JSX primitives every other WRNexusJS package builds on.
+
+ Contexts, middleware, security, sessions, caching, JSX, and realtime.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/core@0.2.24Request preview access. Never put registry tokens in source control.
The framework core: the request Context, middleware contract, and the security, session, caching, streaming, realtime, and JSX primitives every other WRNexusJS package builds on.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/core is the shared foundation of WRNexusJS. It defines the Context object that flows through every middleware, page, and API route, plus the Middleware/Next contract they implement. On top of that it ships the building blocks a real app needs: cookie-backed sessions, password auth, CSRF protection, rate limiting, request logging, HTTP + in-memory caching, file uploads, streaming/SSE responses, WebSocket "rooms", security headers/CORS, and a server-side JSX runtime that renders to HTML strings. Everything here is server-side and Bun-native (it uses Bun.password, Bun.write, the web-standard Request/Response, and crypto). You depend on it directly and transitively through the rest of the framework.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/core// tsconfig.json
-{
- "compilerOptions": {
- "jsx": "react-jsx",
- "jsxImportSource": "@wrnexus/core",
- },
-}import {
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import {
createContext,
withContextHeaders,
sessionAuth,
@@ -950,7 +944,7 @@ const chain: Middleware[] = [
csrfProtection(),
sessionAuth(),
requireAuth({ loginPath: "/login" }),
-];import { hashPassword, verifyPassword, logIn, getUser } from "@wrnexus/core";
+];import { hashPassword, verifyPassword, logIn, getUser } from "@wrnexus/core";
// Registration
const passwordHash = await hashPassword(form.password);
@@ -960,10 +954,43 @@ if (await verifyPassword(form.password, user.passwordHash)) {
logIn(ctx, { id: user.id, email: user.email });
}
-const current = getUser<{ id: string }>(ctx); // or nullimport { etag, notModified, withCacheControl } from "@wrnexus/core";
+
+const body = JSON.stringify(data);
+const tag = etag(body);
+if (notModified(ctx.req, tag)) {
+ return new Response(null, { status: 304, headers: { ETag: tag } });
+}
+const res = new Response(body, { headers: { ETag: tag, "content-type": "application/json" } });
+return withCacheControl(res, { maxAge: 60, staleWhileRevalidate: 300 });import { sse } from "@wrnexus/core";
+
+async function* ticks() {
+ for (let n = 0; ; n++) {
+ yield { event: "tick", data: String(n) };
+ await Bun.sleep(1000);
+ }
+}
+export default (ctx) => sse(ticks());// app/realtime/chat.ts
+import { defineRoom } from "@wrnexus/core";
+
+export default defineRoom({
+ authorize: (info) => !!info.user, // require auth
+ onConnect(client) {
+ client.user = client.query.user;
+ client.room.broadcast({ type: "join", id: client.id });
+ },
+ onMessage(client, msg) {
+ client.broadcast({ type: "say", from: client.id, text: msg.text });
+ },
+});import { createRealtimeRegistry, bridgeRealtime } from "@wrnexus/core";
+import { createPubSub } from "@wrnexus/pubsub";
+import { redisDriver } from "@wrnexus/pubsub/redis";
+
+const registry = createRealtimeRegistry();
+bridgeRealtime(registry, createPubSub(redisDriver(process.env.REDIS_URL)));Reactive, navigation, and realtime browser runtimes.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/csr@0.2.23Request preview access. Never put registry tokens in source control.
The browser-side client runtime for WRNexusJS — generic, self-contained JS that hydrates server-rendered pages with reactivity, client-side navigation, and realtime rooms.+ +
Reactive, navigation, and realtime browser runtimes.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/csr@0.2.24Request preview access. Never put registry tokens in source control.
The browser-side client runtime for WRNexusJS — generic, self-contained JS that hydrates server-rendered pages with reactivity, client-side navigation, and realtime rooms.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/csr holds the three client runtimes that WRNexusJS serves to the browser. Components are authored as .wrn files and rendered on the server; this package provides the single, generic runtime that hydrates that HTML in the browser — there are no per-component browser bundles. Each runtime is exported as a plain-JS string (no build step, no imports) intended to be served verbatim from a well-known URL:
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/csrgetReactiveRuntime(): string // → REACTIVE_RUNTIME
-getNavRuntime(): string // → NAV_RUNTIME
-getRealtimeRuntime(): string // → REALTIME_RUNTIMEwire.room(name): Room // open (or reuse) a room connection
-wire.bindRooms(root?) // (re)bind declarative [data-room] containers
-
-interface Room {
- name: string;
- send(obj: object | string): Room; // JSON-stringifies objects; queues until open
- on(type: string, cb): Room; // filter by msg.type; "*" or a fn = all messages
- on(cb): Room;
- close(): Room;
-}import { getReactiveRuntime, getNavRuntime, getRealtimeRuntime } from "@wrnexus/csr";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { getReactiveRuntime, getNavRuntime, getRealtimeRuntime } from "@wrnexus/csr";
const routes: Record<string, string> = {
"/__wrnexus/reactive.js": getReactiveRuntime(),
@@ -226,10 +215,27 @@ Bun.serve({
}
return new Response("Not found", { status: 404 });
},
-});<div data-scope="count: 0">
+ <button data-on-click="count++">+1</button>
+ <span data-text="count"></span>
+ <p>Total: {{count}}</p>
+</div>
+<script src="/__wrnexus/reactive.js"></script><div data-room="lobby" data-room-user="ada">
+ <div data-room-status></div>
+ <ul data-room-log></ul>
+ <template data-room-item="chat"><li>%user%: %text%</li></template>
+ <form data-room-send>
+ <input name="text" data-room-reset />
+ <input type="hidden" name="type" value="chat" />
+ <button>Send</button>
+ </form>
+</div>
+<script src="/__wrnexus/realtime.js"></script>const room = wire.room("lobby");
+room.on("chat", (msg) => console.log(msg.user, msg.text));
+room.send({ type: "chat", user: "ada", text: "hi" });Database adapters, typed queries, models, migrations, and sessions.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/db@0.2.23Request preview access. Never put registry tokens in source control.
The database layer for WRNexusJS: TS models as the single source of truth for DDL, validation, and result typing, plus a driver-based Db client, migrations, and a sqlc-style query generator.
+
+ Database adapters, typed queries, models, migrations, and sessions.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/db@0.2.24Request preview access. Never put registry tokens in source control.
The database layer for WRNexusJS: TS models as the single source of truth for DDL, validation, and result typing, plus a driver-based Db client, migrations, and a sqlc-style query generator.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/db is the server-side data layer. You describe tables as TypeScript models (the v column builder + table()); those models drive migrations, coerce raw DB rows into typed objects, and feed the query generator. A thin Driver interface is implemented by adapters for SQLite (bun:sqlite), Postgres/MySQL (Bun.SQL), and MongoDB. The Db client adds ergonomics — model-mapped all/one, transactions, createTable, pagination, and batched relation loading. A process-wide registry (getDb/setDb) exposes configured connections to pages and API routes. Reach for it whenever a WRNexusJS app needs persistence.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/dbimport { v, table } from "@wrnexus/db";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { v, table, createDb } from "@wrnexus/db";
+import { sqlite } from "@wrnexus/db/sqlite";
-const users = table("users", {
- id: v.id(), // auto-increment primary key
+const users = table<{ id: number; email: string; name: string | null }>("users", {
+ id: v.id(),
email: v.text().unique(),
- name: v.text().optional(), // NULLable
- age: v.int().default(0),
- active: v.bool().default(true),
- createdAt: v.timestamp().default("now"), // CURRENT_TIMESTAMP
-});createDb(driver: Driver): Dbconst users = await getDb().all("SELECT * FROM users");
-const events = await getDb("analytics").all("SELECT * FROM hits");import { connectFromConfig } from "@wrnexus/db/connect";
+import { setDb, getDb } from "@wrnexus/db";
+
+setDb(connectFromConfig({ driver: "sqlite", url: "file:./dev.db" }, process.cwd()));
+const rows = await getDb().all("SELECT * FROM users");import { migrate, paginate } from "@wrnexus/db";
+
+await migrate(db, "app/db/migrations");
+const pageTwo = await paginate(
+ db,
+ { sql: "SELECT * FROM users ORDER BY id", model: users },
+ { page: 2 },
+);import { mongo } from "@wrnexus/db/mongo";
+
+const mdb = await mongo(process.env.MONGO_URL!, "app");
+const repo = mdb.collection(users);
+await repo.insert({ email: "a@b.com" });
+const active = await repo.find({ active: true });Development and production servers, HMR, assets, and gateways.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/dev-server@0.2.23Request preview access. Never put registry tokens in source control.
The WRNexusJS HTTP + WebSocket server runtime — request dispatch, SSR document assembly, live-reload (HMR), and the portable production handler.+ +
Development and production servers, HMR, assets, and gateways.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/dev-server@0.2.24Request preview access. Never put registry tokens in source control.
The WRNexusJS HTTP + WebSocket server runtime — request dispatch, SSR document assembly, live-reload (HMR), and the portable production handler.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
This package is the server runtime that powers a WRNexusJS app in both development and production. A single request runtime (createHandlers) owns HTTP/WebSocket dispatch and SSR document assembly; it knows nothing about _how_ modules and assets are produced, so the dev and prod entry points wire in different backends: dev uses dynamic module loading plus on-the-fly bundling and injects a live-reload client; prod uses a static, pre-built manifest with cache-immutable assets. The package also ships a multi-app gateway (route several apps by Host header behind one port) and a portable node:http adapter for WinterCG hosts. It is entirely server-side and Bun-native (Bun.serve, Bun.file, Bun.gzipSync).
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/dev-serverinterface ServeOptions {
- appDir: string; // absolute/relative path to the app/ dir
- port?: number; // default 3000
- hostname?: string; // default "localhost"
- mode?: Mode; // "development" | "production"; default "development"
- hmr?: boolean; // inject live-reload client; default (mode === "development")
- styleEntry?: string | null; // resolved absolute path to the global CSS entry
- stylesConfig?: StylesConfig; // custom styles processor (e.g. Tailwind/PostCSS)
- head?: string; // raw HTML appended to every page <head>
- seo?: SeoConfig; // global SEO defaults
- security?: SecurityConfig; // security headers + CORS policy
- theme?: ThemeConfig; // design-token theme (merged over built-in light/dark)
- i18n?: I18nConfig; // default language + supported locales
- db?: { driver: string; url: string }; // default db → getDb(); dev auto-migrates
- databases?: Record<string, { driver: string; url: string }>; // named dbs → getDb("<name>")
- realtime?: { scale?: boolean; redisUrl?: string }; // bridge rooms over Redis across processes
-}
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { startServer } from "@wrnexus/dev-server";
-interface RunningServer {
- port: number;
- hostname: string;
- url: string;
- router: Router;
- stop(): void;
-}interface RuntimeDeps {
- mode: Mode;
- hmr: boolean; // inject the live-reload client into pages
- router: Router;
- loadModule(file: string): Promise<Record<string, unknown>>;
- getMiddleware(): Promise<Middleware[]>;
- assets: AssetServer; // serves /__wrnexus/* (islands, reactive, hmr)
- hasStyles?: boolean; // inject the global stylesheet link
- hasUi?: boolean; // inject the Wire UI stylesheet (/__wrnexus/ui.css)
- theme?: ResolvedTheme; // enables /__wrnexus/theme.css + <html data-theme>
- i18n?: ResolvedI18n; // enables ctx.t, <html lang>, {t:key} markers
- inlineStyles?: string; // inline small prod stylesheets into <head>
- assetVersion?: string; // cache-busting ?v= on framework asset URLs
- head?: string; // raw HTML appended to every page <head>
- seo?: SeoConfig;
- security?: SecurityConfig;
- maxBodyBytes?: number; // 413 above this; default 10 MB
- hub?: HmrHub; // browser HMR sockets (dev only)
- realtimeBus?: RealtimeBus; // cross-process room bridge (Redis pub/sub)
-}
+const server = await startServer({
+ appDir: "./app",
+ port: 3000,
+ mode: "development",
+ theme: {/* design tokens */},
+ db: { driver: "sqlite", url: "file:./data/app.db" },
+});
-interface Handlers {
- fetch(req: Request, server: UpgradeServer): Promise<Response | undefined>;
- websocket: { open; message; close; drain };
-}interface ProdManifest {
- pages: { raw: string; mod: RouteModule }[];
- api: { raw: string; mod: RouteModule }[];
- realtime: { raw: string; mod: RouteModule }[];
- middleware: Middleware[];
- components: { name: string; mod: RouteModule }[];
- layouts: { name: string; mod: RouteModule }[];
-}
+console.log(`Running at ${server.url}`);
+// server.stop();import { createProductionServer } from "@wrnexus/dev-server";
+import { manifest } from "./dist/manifest.js"; // generated by `wrnexus build`
-interface ProdOptions {
- stylesPath?: string;
- inlineStyles?: string;
- reactivePath?: string;
- themePath?: string;
- themeJsPath?: string;
- theme?: ResolvedTheme;
- uiCssPath?: string;
- schemasJs?: string;
- i18n?: ResolvedI18n;
- db?: { driver: string; url: string };
- databases?: Record<string, { driver: string; url: string }>;
- realtime?: { scale?: boolean; redisUrl?: string };
- assetVersion?: string;
- publicDir?: string;
- head?: string;
- seo?: SeoConfig;
- security?: SecurityConfig;
- port?: number;
- hostname?: string;
- maxBodyBytes?: number;
-}import { createProductionHandlers, serveNode } from "@wrnexus/dev-server";
+
+const handlers = createProductionHandlers(manifest, opts);
+await serveNode(handlers.fetch, { port: 8080 });import { startGateway } from "@wrnexus/dev-server";
+
+await startGateway({
+ port: 3000,
+ apps: [
+ { name: "web", dir: "./apps/web", domains: ["localhost", "web.localhost"] },
+ {
+ name: "admin",
+ dir: "./apps/admin",
+ domains: ["admin.localhost"],
+ auth: { basic: { user: "root", pass: "s3cret" } },
+ },
+ ],
+ security: { trustedHostsOnly: true, rateLimit: { max: 600 } },
+});Hashing, HMAC, authenticated encryption, and key derivation.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/encryption@0.2.23Request preview access. Never put registry tokens in source control.
Dependency-free crypto helpers for WRNexusJS: authenticated symmetric encryption (AES-256-GCM), hashing, and HMAC signing.+ +
Hashing, HMAC, authenticated encryption, and key derivation.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/encryption@0.2.24Request preview access. Never put registry tokens in source control.
Dependency-free crypto helpers for WRNexusJS: authenticated symmetric encryption (AES-256-GCM), hashing, and HMAC signing.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
This package provides small, focused cryptographic primitives for server-side use: encrypting secrets/tokens/database fields at rest with AES-256-GCM, deriving keys from passwords via PBKDF2, computing SHA-256 digests, and signing/verifying payloads with HMAC-SHA256. It is built entirely on the standard Web Crypto API (crypto.subtle) plus btoa/atob and TextEncoder/TextDecoder — no third-party dependencies. Reach for it whenever you need to protect sensitive values or verify webhook signatures. All functions are async (Web Crypto is promise-based).
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/encryptionimport { generateKey, encrypt, decrypt } from "@wrnexus/encryption";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { generateKey, encrypt, decrypt } from "@wrnexus/encryption";
const key = await generateKey(); // store this safely (env/secret manager)
const box = await encrypt("card #1234", key); // opaque base64 string, safe to persist
-const plain = await decrypt(box, key); // "card #1234"import { deriveKey, encrypt } from "@wrnexus/encryption";
+const plain = await decrypt(box, key); // "card #1234"import { deriveKey, encrypt } from "@wrnexus/encryption";
const key = await deriveKey("correct horse battery staple", "per-user-salt");
-const box = await encrypt("secret note", key);import { sha256, hmacSign, hmacVerify } from "@wrnexus/encryption";
+const box = await encrypt("secret note", key);import { sha256, hmacSign, hmacVerify } from "@wrnexus/encryption";
const digest = await sha256("some content"); // 64-char hex string
@@ -108,7 +108,7 @@ const ok = await hmacVerify(rawBody, webhookSecret, incomingSignatureHeader);
if (!ok) throw new Error("Invalid webhook signature");Safe Context URL helpers and forward-auth login redirects.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/helpers@0.2.23Request preview access. Never put registry tokens in source control.
Safe convenience helpers for common WRNexusJS application flows. The package uses standard Context, URL, and Response values and has no runtime dependency beyond @wrnexus/core.
Safe Context URL helpers and forward-auth login redirects.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/helpers@0.2.24Request preview access. Never put registry tokens in source control.
Safe convenience helpers for common WRNexusJS application flows. The package uses standard Context, URL, and Response values and has no runtime dependency beyond @wrnexus/core.
bun add @wrnexus/helpers
The package is private, so the machine must be authenticated to the wrnexus npm organization.
The gateway calls an SSO verifier on a different URL from the original application. These helpers reconstruct the original URL from the gateway headers and safely place it in the login redirect:
import type { Context } from "@wrnexus/core";
import { redirectToLogin } from "@wrnexus/helpers";
@@ -34,9 +35,22 @@ export const GET = async (ctx: Context) => {
};
This creates a response such as:
Location: http://sso.localhost:3000/login?returnTo=http%3A%2F%2Fadmin.localhost%3A3000%2F
-Always list the application hosts that are valid redirect destinations. Forwarded host headers are rejected when allowedHosts is absent or does not match, preventing an open redirect. A callback can support dynamic tenant domains:
Always list the application hosts that are valid redirect destinations. Forwarded host headers are rejected when allowedHosts is absent or does not match, preventing an open redirect.
The SSO hostname is the login destination, not an allowedHosts entry. For example, when protecting admin.localhost:3000, keep admin.localhost:3000 in the allowlist even though the verifier runs at sso.localhost:3000. WRNexus preserves both hosts across a nested gateway request.
allowedHosts: (host) => host.endsWith(".example.test");
+import type { Context } from "@wrnexus/core";
+import { getOriginalRequestOrigin, redirectToLogin } from "@wrnexus/helpers";
+
+export const GET = async (ctx: Context) => {
+ const allowedHosts = (host: string) => host === "example.test" || host.endsWith(".example.test");
+
+ console.info("Authentication requested by", getOriginalRequestOrigin(ctx, { allowedHosts }));
+ return redirectToLogin(ctx, "https://auth.example.test/login", {
+ allowedHosts,
+ returnToParam: "continue",
+ status: 303,
+ });
+};
getOriginalRequestUrl(ctx, options): URL — reconstruct the gateway URL.Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/helpersimport type { Context } from "@wrnexus/core";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import type { Context } from "@wrnexus/core";
import { redirectToLogin } from "@wrnexus/helpers";
export const GET = async (ctx: Context) => {
@@ -101,10 +115,22 @@ export const GET = async (ctx: Context) => {
return redirectToLogin(ctx, "/login", {
allowedHosts: ["admin.localhost:3000", "reports.localhost:3000"],
});
-};Location: http://sso.localhost:3000/login?returnTo=http%3A%2F%2Fadmin.localhost%3A3000%2FallowedHosts: (host) => host.endsWith(".example.test");import type { Context } from "@wrnexus/core";
+import { getOriginalRequestOrigin, redirectToLogin } from "@wrnexus/helpers";
+
+export const GET = async (ctx: Context) => {
+ const allowedHosts = (host: string) => host === "example.test" || host.endsWith(".example.test");
+
+ console.info("Authentication requested by", getOriginalRequestOrigin(ctx, { allowedHosts }));
+ return redirectToLogin(ctx, "https://auth.example.test/login", {
+ allowedHosts,
+ returnToParam: "continue",
+ status: 303,
+ });
+};Translation loading, locale resolution, and Intl formatting.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/i18n@0.2.23Request preview access. Never put registry tokens in source control.
Per-request translations plus locale-aware number, date, and currency formatting for WRNexusJS apps.+ +
Translation loading, locale resolution, and Intl formatting.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/i18n@0.2.24Request preview access. Never put registry tokens in source control.
Per-request translations plus locale-aware number, date, and currency formatting for WRNexusJS apps.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/i18n loads locale files from app/locales/<lang>.json, resolves the active language for each request (cookie → Accept-Language → default), and builds a t(key, params) translator used both in server code and in .wrn views. It also ships Intl-based formatting helpers and a tiny client runtime that wires up a language switcher. Translation lookup, language resolution, and HTML marker rewriting run server-side; only the small I18N_RUNTIME snippet runs in the browser.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/i18nimport {
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import {
loadLocales,
resolveI18n,
resolveLang,
@@ -203,14 +203,36 @@ t("nav.home"); // dotted key → "Home"
t("greeting", { name: "Ada" }); // "Hello, {name}" → "Hello, Ada"
// After rendering a .wrn view, resolve translation markers in the HTML:
-const finalHtml = translateHtml(renderedHtml, t);{
+const finalHtml = translateHtml(renderedHtml, t);{
"nav": { "home": "Home" },
"greeting": "Hello, {name}"
-}<h1 data-t="nav.home">Home</h1>
-<input t:placeholder="search.placeholder" /><h1 data-t="nav.home">Home</h1>
+<input t:placeholder="search.placeholder" />import { renderI18nData, I18N_RUNTIME, I18N_JS_HREF } from "@wrnexus/i18n";
+
+// In the document <head>:
+const head = `
+ <script>${renderI18nData(i18n, lang)}</script>
+ <script src="${I18N_JS_HREF}"></script>
+`;
+
+// Serve I18N_RUNTIME at I18N_JS_HREF; then in markup:
+// <button data-wire-lang-set="es">Español</button>
+// <select data-wire-lang>…</select>import {
+ formatNumber,
+ formatCurrency,
+ formatDate,
+ formatRelativeTime,
+ plural,
+} from "@wrnexus/i18n";
+
+formatNumber(1234.5, lang); // "1,234.5"
+formatCurrency(9.99, "USD", lang); // "$9.99"
+formatDate(Date.now(), lang); // "Jul 4, 2026"
+formatRelativeTime(-3, "day", lang); // "3 days ago"
+plural(2, { one: "# item", other: "# items" }, lang); // "2 items"HS256 JWT signing, verification, and bearer authentication.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/jwt@0.2.23Request preview access. Never put registry tokens in source control.
Dependency-free JSON Web Tokens (HS256) via Web Crypto, plus a bearer-token auth middleware for WRNexusJS.+ +
HS256 JWT signing, verification, and bearer authentication.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/jwt@0.2.24Request preview access. Never put registry tokens in source control.
Dependency-free JSON Web Tokens (HS256) via Web Crypto, plus a bearer-token auth middleware for WRNexusJS.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/jwt signs and verifies stateless JSON Web Tokens using the HS256 (HMAC-SHA-256) algorithm. It has no runtime dependencies — signing and verification are implemented directly on the standard Web Crypto API (crypto.subtle), which Bun provides natively. It runs server-side and pairs with the session-based auth in @wrnexus/core, giving you a stateless option for API and mobile clients. Reach for it when you need bearer-token auth rather than cookie sessions.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/jwtfunction signJwt(payload: JwtClaims, secret: string, options?: SignOptions): Promise<string>;function verifyJwt<T extends JwtClaims = JwtClaims>(
- token: string,
- secret: string,
- options?: { now?: number },
-): Promise<T>;function jwtAuth(options: JwtAuthOptions): Middleware;Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { signJwt, verifyJwt, jwtAuth, JwtError } from "@wrnexus/jwt";
+
+const secret = process.env.JWT_SECRET!;
+
+// Sign a token that expires in one hour
+const token = await signJwt({ sub: user.id, role: "admin" }, secret, {
+ expiresIn: 3600,
+});
+
+// Verify it later
+try {
+ const claims = await verifyJwt<{ sub: string; role: string }>(token, secret);
+ console.log(claims.sub, claims.role);
+} catch (err) {
+ if (err instanceof JwtError) {
+ // invalid signature, expired, malformed, etc.
+ }
+}import { jwtAuth } from "@wrnexus/jwt";
+
+// Require a valid bearer token; ctx.user holds the verified claims
+app.use(jwtAuth({ secret: process.env.JWT_SECRET! }));
+
+// Optional auth — populate ctx.user when present, but don't 401
+app.use(jwtAuth({ secret: process.env.JWT_SECRET!, required: false }));SSR-safe compatibility access to Capacitor plugins.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/mobile@0.2.23Request preview access. Never put registry tokens in source control.
SSR-safe access to Capacitor plugins from WRNexusJS browser code.
-wrnexus mobile add @capacitor/camera
-import { Camera } from "@capacitor/camera";
+
+ Native · Preview@wrnexus/mobile
SSR-safe compatibility access to Capacitor plugins.
Private registry access required
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/mobile@0.2.24
Request preview access. Never put registry tokens in source control.
SSR-safe access to Capacitor plugins from WRNexusJS browser code.
+Overview
+@wrnexus/mobile keeps optional native imports out of server rendering while giving browser-owned modules one consistent registry for Capacitor plugins. During SSR, mobile.isNative() is false and mobile.platform() is "web".
+Install a plugin through the WRNexusJS CLI so the web and native projects stay aligned:
+wrnexus mobile add @capacitor/camera @capacitor/haptics
+Usage
+Register and invoke a Capacitor plugin
+Import Capacitor packages only from browser-owned code, never from API routes or SSR helpers.
+import { Camera, CameraResultType } from "@capacitor/camera";
import { mobile } from "@wrnexus/mobile";
-if (mobile.isNative()) {
- mobile.registerPlugin("Camera", Camera);
- const photo = await mobile.invoke("Camera", "getPhoto", { resultType: "uri" });
+mobile.registerPlugin("Camera", Camera);
+
+export async function takePhoto() {
+ if (!mobile.isNative()) return null;
+ return mobile.invoke("Camera", "getPhoto", {
+ quality: 85,
+ resultType: CameraResultType.Uri,
+ });
}
-isNative() is false and platform() is web during SSR. plugin() returns undefined when unavailable; requirePlugin() and invoke() throw an actionable MobileUnavailableError.
-Import and register Capacitor packages only from browser-owned code. Do not import them in server routes, SSR helpers, or other Bun-only modules.
Complete TypeScript API
This declaration comes from the exact installed package and lists its exported functions, classes, interfaces, and types.
export { native } from '@wrnexus/native';
+Provide a browser fallback
+whenNative runs the first callback only in a Capacitor WebView and can return a web/SSR-safe fallback everywhere else.
+import { Haptics, ImpactStyle } from "@capacitor/haptics";
+import { mobile } from "@wrnexus/mobile";
+
+mobile.registerPlugin("Haptics", Haptics);
+
+export const confirmAction = () =>
+ mobile.whenNative(
+ () => mobile.invoke("Haptics", "impact", { style: ImpactStyle.Medium }),
+ () => navigator.vibrate?.(30),
+ );
+Read an optional plugin without throwing
+import type { NetworkPlugin } from "@capacitor/network";
+import { mobile } from "@wrnexus/mobile";
+
+const network = mobile.plugin<NetworkPlugin>("Network");
+const status = network ? await network.getStatus() : { connected: true, connectionType: "unknown" };
+API
+
+registerPlugin(name, instance) registers a browser-imported plugin.
+plugin(name) returns a plugin or undefined; requirePlugin(name) throws when absent.
+invoke(plugin, method, options?) calls a registered method and returns its result.
+whenNative(native, fallback?) selects native behavior without breaking SSR.
+isNative() and platform() report the current Capacitor environment.
+
+Unavailable required plugins throw MobileUnavailableError with an actionable message.
+Requirements / Notes
+
+- Capacitor plugin imports must remain in browser-owned modules.
+@wrnexus/mobile re-exports native from @wrnexus/native for applications that
+prefer the higher-level cross-platform capability API.
+
Complete TypeScript API
This declaration comes from the exact installed package and lists its exported functions, classes, interfaces, and types.
export { native } from '@wrnexus/native';
/** @wrnexus/mobile — SSR-safe access to Capacitor's native bridge. */
@@ -63,16 +105,34 @@ declare const mobile: {
};
export { type CapacitorBridge, type MobilePlatform, MobileUnavailableError, invoke, isNative, mobile, platform, plugin, registerPlugin, requirePlugin, whenNative };
-
Examples
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
Example 1
wrnexus mobile add @capacitor/camera
Example 2
import { Camera } from "@capacitor/camera";
+
Examples
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
Register and invoke a Capacitor plugin
import { Camera, CameraResultType } from "@capacitor/camera";
import { mobile } from "@wrnexus/mobile";
-if (mobile.isNative()) {
- mobile.registerPlugin("Camera", Camera);
- const photo = await mobile.invoke("Camera", "getPhoto", { resultType: "uri" });
-}
-
+mobile.registerPlugin("Camera", Camera);
+
+export async function takePhoto() {
+ if (!mobile.isNative()) return null;
+ return mobile.invoke("Camera", "getPhoto", {
+ quality: 85,
+ resultType: CameraResultType.Uri,
+ });
+}Provide a browser fallback
import { Haptics, ImpactStyle } from "@capacitor/haptics";
+import { mobile } from "@wrnexus/mobile";
+
+mobile.registerPlugin("Haptics", Haptics);
+
+export const confirmAction = () =>
+ mobile.whenNative(
+ () => mobile.invoke("Haptics", "impact", { style: ImpactStyle.Medium }),
+ () => navigator.vibrate?.(30),
+ );
Read an optional plugin without throwing
import type { NetworkPlugin } from "@capacitor/network";
+import { mobile } from "@wrnexus/mobile";
+
+const network = mobile.plugin<NetworkPlugin>("Network");
+const status = network ? await network.getStatus() : { connected: true, connectionType: "unknown" };
+
Cross-platform browser and Capacitor capability registry.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/native@0.2.23Request preview access. Never put registry tokens in source control.
Cross-platform capabilities for browsers, Capacitor WebViews, and compiled native apps.
+ +Cross-platform browser and Capacitor capability registry.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/native@0.2.24Request preview access. Never put registry tokens in source control.
Cross-platform capabilities for browsers, Capacitor WebViews, and compiled native apps.+
@wrnexus/native exposes capabilities by name so application code can ask what the current platform supports before presenting an action. Browser capabilities use Web APIs; mobile capabilities use installed Capacitor plugins. platform() returns "server" during SSR, "browser" on the web, and the Capacitor platform in a native WebView.
bun add @wrnexus/native
+import { native } from "@wrnexus/native";
-if (native.supports("share")) await native.run("share", { title: "WRNexusJS", url: location.href });
-Built-ins include camera, clipboard.write, share, geolocation, network, haptics, storage, filesystem, notifications, and device information. Browser capabilities use Web APIs; mobile capabilities use installed Capacitor plugins.
platform() returns server during SSR, browser on the web, and the Capacitor platform in a native WebView. Unsupported operations reject with NativeUnavailableError; use supports() before presenting optional UI.
This declaration comes from the exact installed package and lists its exported functions, classes, interfaces, and types.
import { N as NativePlatform, a as NativeCapability, b as NativeRunOptions, c as NativeTarget } from './types-CDShWg0i.js';
+export async function shareCurrentPage() {
+ if (!native.supports("share")) return false;
+ await native.run("share", {
+ title: document.title,
+ url: location.href,
+ });
+ return true;
+}
+register returns an unregister function, which is useful for tests and temporary feature modules.
import { native } from "@wrnexus/native";
+
+const unregister = native.register("orders.scan", {
+ browser: {
+ supported: () => typeof window !== "undefined",
+ run: async ({ orderId }: { orderId: string }) => {
+ const code = window.prompt(`Scan code for order ${orderId}`);
+ return { code };
+ },
+ },
+});
+
+const result = await native.run<{ code: string | null }>("orders.scan", { orderId: "ord_42" });
+unregister();
+import { native } from "@wrnexus/native";
+
+const canUseMobileCamera = native.supports("camera", "mobile");
+const position = await native.run(
+ "geolocation",
+ { enableHighAccuracy: true },
+ { target: "browser" },
+);
+supports(name, target?) checks availability without running the capability.run(name, options?, runOptions?) executes it or rejects with NativeUnavailableError.register(name, capability) adds or overrides a capability and returns cleanup.registered() lists capability names; clearRegistry() resets the registry.isMobile() and platform() report the current target safely during SSR.Built-ins include camera, clipboard.write, share, geolocation, network, haptics, storage, filesystem, notifications, and device information.
Use supports() before showing optional controls. Mobile capabilities require their matching Capacitor plugins to be installed and registered by the application.
This declaration comes from the exact installed package and lists its exported functions, classes, interfaces, and types.
import { N as NativePlatform, a as NativeCapability, b as NativeRunOptions, c as NativeTarget } from './types-CDShWg0i.js';
export { d as NativeAdapter, e as NativeBrowserRuntime } from './types-CDShWg0i.js';
export { browserCapabilities } from './browser.js';
export { mobileCapabilities } from './mobile.js';
@@ -46,12 +92,39 @@ declare const native: {
};
export { NativeCapability, NativePlatform, NativeRunOptions, NativeTarget, NativeUnavailableError, clearRegistry, isMobile, native, platform, register, registered, run, supports };
-Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { native } from "@wrnexus/native";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { native } from "@wrnexus/native";
-if (native.supports("share")) await native.run("share", { title: "WRNexusJS", url: location.href });import { native } from "@wrnexus/native";
+
+const unregister = native.register("orders.scan", {
+ browser: {
+ supported: () => typeof window !== "undefined",
+ run: async ({ orderId }: { orderId: string }) => {
+ const code = window.prompt(`Scan code for order ${orderId}`);
+ return { code };
+ },
+ },
+});
+
+const result = await native.run<{ code: string | null }>("orders.scan", { orderId: "ord_42" });
+unregister();import { native } from "@wrnexus/native";
+
+const canUseMobileCamera = native.supports("camera", "mobile");
+const position = await native.run(
+ "geolocation",
+ { enableHighAccuracy: true },
+ { target: "browser" },
+);OAuth 2.0, PKCE, provider presets, and profile mapping.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/oauth@0.2.23Request preview access. Never put registry tokens in source control.
Dependency-free OAuth 2.0 sign-in for any provider, with PKCE and presets for Google, GitHub, and Discord.+ +
OAuth 2.0, PKCE, provider presets, and profile mapping.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/oauth@0.2.24Request preview access. Never put registry tokens in source control.
Dependency-free OAuth 2.0 sign-in for any provider, with PKCE and presets for Google, GitHub, and Discord.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/oauth implements the OAuth 2.0 Authorization Code flow (with PKCE) for server-side sign-in. It ships ready-made provider presets and a defineProvider helper for custom providers, then gives you two flow functions — startAuth (build the redirect) and completeAuth (exchange the code and fetch the user's profile). It has no runtime dependencies: it uses the platform fetch and WebCrypto only. Pairs naturally with @wrnexus/core's logIn to establish a session once you have a normalized profile.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/oauthinterface ProviderCredentials {
- clientId: string;
- clientSecret: string;
- scopes?: string[]; // override the preset's default scopes
-}interface OAuthProvider {
- name: string;
- authorizeUrl: string;
- tokenUrl: string;
- userInfoUrl: string;
- scopes: string[];
- clientId: string;
- clientSecret: string;
- authorizeParams?: Record<string, string>; // e.g. access_type, prompt
- mapProfile: (raw: Record<string, unknown>) => OAuthProfile;
-}interface StartAuthOptions {
- redirectUri: string;
- state?: string; // reuse a state instead of generating one
- params?: Record<string, string>; // extra authorize params, merged last
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { google, startAuth, completeAuth } from "@wrnexus/oauth";
+import { logIn } from "@wrnexus/core";
+
+const provider = google({
+ clientId: process.env.GOOGLE_CLIENT_ID!,
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
+});
+
+const redirectUri = "https://example.com/auth/callback";
+
+// 1. Kick off sign-in: redirect the user to the provider.
+async function beginLogin(ctx) {
+ const { url, state, verifier } = await startAuth(provider, { redirectUri });
+ // Persist state + verifier in the session, then redirect.
+ ctx.session.set("oauth_state", state);
+ ctx.session.set("oauth_verifier", verifier);
+ return Response.redirect(url, 302);
}
-interface StartAuthResult {
- url: string; // authorize URL to redirect to
- state: string; // CSRF state — verify on callback
- verifier: string; // PKCE code verifier — pass to completeAuth
-}import { defineProvider, startAuth } from "@wrnexus/oauth";
+
+const gitlab = defineProvider({
+ name: "gitlab",
+ authorizeUrl: "https://gitlab.com/oauth/authorize",
+ tokenUrl: "https://gitlab.com/oauth/token",
+ userInfoUrl: "https://gitlab.com/api/v4/user",
+ scopes: ["read_user"],
+ clientId: process.env.GITLAB_CLIENT_ID!,
+ clientSecret: process.env.GITLAB_CLIENT_SECRET!,
+ mapProfile: (raw) => ({
+ id: String(raw.id),
+ email: raw.email as string | undefined,
+ name: raw.name as string | undefined,
+ avatar: raw.avatar_url as string | undefined,
+ raw,
+ }),
+});In-process and Redis-backed publish/subscribe.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/pubsub@0.2.23Request preview access. Never put registry tokens in source control.
Topic-based publish/subscribe with a pluggable driver — in-process by default, Redis for cross-process messaging.+ +
In-process and Redis-backed publish/subscribe.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/pubsub@0.2.24Request preview access. Never put registry tokens in source control.
Topic-based publish/subscribe with a pluggable driver — in-process by default, Redis for cross-process messaging.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/pubsub is a small server-side pub/sub bus. You publish messages to a topic and subscribe with topic patterns; handlers fire for matching topics. The default driver keeps everything in-process, and you can swap in the Redis driver (@wrnexus/pubsub/redis) to fan messages out across processes or hosts. It also backs @wrnexus/core's realtime bridge for horizontal scaling.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/pubsubinterface PubSub {
- publish<T = unknown>(topic: string, message: T): Promise<void>;
- subscribe<T = unknown>(pattern: string, handler: Handler<T>): () => void;
-}
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { createPubSub } from "@wrnexus/pubsub";
-type Handler<T = unknown> = (message: T, topic: string) => void | Promise<void>;interface PubSubDriver {
- publish(topic: string, message: unknown): void | Promise<void>;
- subscribe(pattern: string, handler: Handler): () => void;
-}function redisDriver(url?: string): PubSubDriver & { close(): void };import { createPubSub } from "@wrnexus/pubsub";
+import { redisDriver } from "@wrnexus/pubsub/redis";
+
+const driver = redisDriver("redis://localhost:6379");
+const bus = createPubSub(driver);
+
+bus.subscribe("order:*", (msg, topic) => {
+ // received on any app process subscribed to this pattern
+});
+
+await bus.publish("order:created", { id: 7 });
+
+// on shutdown
+driver.close();Background jobs with delay, concurrency, retry, and repetition.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/queue@0.2.23Request preview access. Never put registry tokens in source control.
A background job queue with delays, retries + exponential backoff, recurring jobs, and concurrent workers.+ +
Background jobs with delay, concurrency, retry, and repetition.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/queue@0.2.24Request preview access. Never put registry tokens in source control.
A background job queue with delays, retries + exponential backoff, recurring jobs, and concurrent workers.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/queue is a server-side in-process job queue. You register named workers, enqueue jobs (optionally delayed or recurring), and let the queue poll and run them on a timer — with per-job retry limits and doubling backoff between attempts. The default store lives in memory; the design allows a pluggable driver to back it with Redis/SQL for durability across restarts. Reach for it when you need to defer work (emails, webhooks, cleanup) off the request path without a heavyweight external broker. Tests can drive it deterministically via drain().
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/queuefunction createQueue(options?: QueueOptions): Queue;type JobHandler<T = unknown> = (job: Job<T>) => void | Promise<void>;interface Job<T = unknown> {
- id: string; // e.g. "job_1"
- name: string;
- data: T;
- attempts: number;
- maxAttempts: number;
- runAt: number; // epoch ms; job runs when now ≥ runAt
- repeat?: number; // if set, re-enqueue this many ms after each success
-}Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { createQueue } from "@wrnexus/queue";
+
+const queue = createQueue({ maxAttempts: 3, backoffMs: 1000 });
+
+// Register a worker for the "email" job name.
+queue.process<{ to: string }>("email", async (job) => {
+ await send(job.data.to);
+});
+
+// Enqueue a delayed job with up to 3 attempts.
+await queue.add("email", { to: "a@b.com" }, { delayMs: 5000, maxAttempts: 3 });
+
+queue.start(); // begin polling; queue.stop() to haltqueue.process("heartbeat", async () => ping());
+await queue.add("heartbeat", {}, { repeat: 60_000 }); // runs ~every minuteconst queue = createQueue({
+ onFailed: (job, error) => {
+ console.error(`job ${job.id} (${job.name}) gave up`, error);
+ },
+});let clock = 0;
+const queue = createQueue({ now: () => clock });
+
+queue.process("task", async () => {
+ /* ... */
+});
+await queue.add("task", {}, { delayMs: 5000 });
+
+clock = 5000;
+const ran = await queue.drain(); // => 1Small type-safe reactive signal primitives.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/reactive@0.2.23Request preview access. Never put registry tokens in source control.
Tiny, type-safe reactive primitives (signals) with zero dependencies.+ +
Small type-safe reactive signal primitives.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/reactive@0.2.24Request preview access. Never put registry tokens in source control.
Tiny, type-safe reactive primitives (signals) with zero dependencies.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/reactive is the seed of WRNexusJS's reactivity layer: a minimal signal primitive that holds a value, notifies subscribers when it changes, and hands back an unsubscribe function. It is deliberately small and framework-agnostic — it powers nothing on its own, but is shaped so client islands (and later the .wrn compiler's state blocks) can build reactive bindings on top of it. Reach for it when you need observable state without pulling in a full reactivity library.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/reactivetype Subscriber<T> = (value: T) => void;
-type Unsubscribe = () => void;
-
-interface Signal<T> {
- get(): T;
- set(next: T): void;
- update(fn: (current: T) => T): void;
- subscribe(fn: Subscriber<T>): Unsubscribe;
-}import { signal } from "@wrnexus/reactive";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { signal } from "@wrnexus/reactive";
const count = signal(0);
@@ -128,13 +120,13 @@ count.set(1); // no-op — value unchanged, no notification
count.update((n) => n + 1); // logs: count is now 2
off(); // stop listening
-count.set(3); // nothing loggedimport { signal, type Signal } from "@wrnexus/reactive";
+count.set(3); // nothing loggedimport { signal, type Signal } from "@wrnexus/reactive";
const user: Signal<{ name: string } | null> = signal(null);
user.set({ name: "Ada" });Filesystem discovery, route matching, and typed route generation.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/router@0.2.23Request preview access. Never put registry tokens in source control.
File-based router that maps an app/ directory onto route tables and matches request paths against them.
+
+ Filesystem discovery, route matching, and typed route generation.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/router@0.2.24Request preview access. Never put registry tokens in source control.
File-based router that maps an app/ directory onto route tables and matches request paths against them.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/router scans an application's app/ directory once at startup and builds route tables for pages, API endpoints, realtime channels, middleware, server-rendered .wrn components, layouts, and validation schemas. It also compiles URL patterns (/users/[id]) into RegExps and matches request paths against them. Request input is never turned into a file path, which makes the router immune to path traversal. This is a server-side package used by the WRNexusJS runtime to resolve incoming requests, plus a codegen helper for compile-time typed links.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/routerapp/pages/index.tsx -> GET /
-app/pages/about.tsx -> GET /about
-app/pages/users/[id].tsx -> GET /users/:id
-app/api/hello.ts -> /api/hello
-app/realtime/chat.ts -> /realtime/chat
-app/pages/*.wrn (api) -> embedded /api/* routes
-app/pages/*.wrn (rt) -> embedded /realtime/* routes
-app/middleware/*.ts -> global middleware (alphabetical)
-app/components/*.wrn -> server-rendered components (by basename)
-app/layouts/*.wrn -> named page layouts
-app/schemas/*.ts -> validation schemasfunction buildRouter(appDir: string, opts?: RouterOptions): Router;
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { buildRouter } from "@wrnexus/router";
-interface RouterOptions {
- /** Extra dirs scanned for `.wrn` components (e.g. `@wrnexus/ui`), before
- * `app/components`, so an app component of the same name wins. */
- componentDirs?: string[];
-}interface Router {
- pages: Route[];
- api: Route[];
- realtime: Route[];
- /** Absolute paths of middleware modules, in execution order (alphabetical). */
- middlewareFiles: string[];
- /** Server-rendered `.wrn` components, mounted via `data-component`. */
- components: ComponentRef[];
- /** Named page layouts (`app/layouts/<name>.wrn`); a page picks one via `layout`. */
- layouts: ComponentRef[];
- /** Validation schemas (`app/schemas/<name>.ts`) shared by API + forms. */
- schemas: ComponentRef[];
- matchPage(pathname: string): RouteMatch | null;
- matchApi(pathname: string): RouteMatch | null;
- matchRealtime(pathname: string): RouteMatch | null;
+const router = buildRouter("./app", {
+ componentDirs: ["./node_modules/@wrnexus/ui/components"],
+});
+
+// Resolve an incoming request.
+const match = router.matchPage("/users/42");
+if (match) {
+ console.log(match.route.file); // absolute path to the page module
+ console.log(match.params); // { id: "42" }
}
-interface ComponentRef {
- /** Validated component name (matches a `data-component` attribute). */
- name: string;
- /** Absolute path to the component's `.wrn` module. */
- file: string;
-}import { generateRoutesFile } from "@wrnexus/router";
+import { writeFileSync } from "node:fs";
+
+const router = buildRouter("./app");
+writeFileSync("./app/routes.gen.ts", generateRoutesFile(router.pages));// Then, in app code, links are checked at compile time:
+import { href } from "./routes.gen.ts";
+
+href("/users/[id]", { id: "42" }); // "/users/42"
+href("/about"); // "/about"
+href("/nope"); // type error: unknown pathimport { compileRoutePattern, matchRoute, sortRoutes, type Route } from "@wrnexus/router";
+
+const { regex, paramNames } = compileRoutePattern("/posts/[slug]");
+const routes = sortRoutes([{ raw: "/posts/[slug]", file: "…", regex, paramNames }]);
+const m = matchRoute(routes, "/posts/hello"); // { route, params: { slug: "hello" } }Secure HTML document rendering and SEO metadata.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/ssr@0.2.23Request preview access. Never put registry tokens in source control.
Server-side rendering: wraps a page's HTML body in a complete HTML document with a metadata-driven <head>.
+
+ Secure HTML document rendering and SEO metadata.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/ssr@0.2.24Request preview access. Never put registry tokens in source control.
Server-side rendering: wraps a page's HTML body in a complete HTML document with a metadata-driven <head>.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
Pages in WRNexusJS return an HTML string for the body. @wrnexus/ssr takes that body and produces a full HTML document — building the <head> from page metadata and global SEO defaults, resolving canonical/Open Graph/Twitter tags, and injecting module preloads and <script type="module"> tags. It is deliberately server-only: nothing in this package touches the DOM or ships to the browser, keeping server code genuinely server-only. Reach for it on the server when turning a rendered page body into a response document.
<title>, and as applicable description, robots, keywords, theme-color, and canonical link, plus Open Graph (og:title, og:description, og:type, og:url, og:site_name, og:locale, og:image) and Twitter (twitter:card, twitter:title, twitter:description, twitter:image, twitter:site) meta tags. The document always includes charset, viewport, and a /favicon.ico icon link.import { renderDocument } from "@wrnexus/ssr";
const html = renderDocument({
@@ -79,6 +80,17 @@ return new Response(html, {
headers: { "content-type": "text/html; charset=utf-8" },
});
The produced document has <title>About Us — Acme</title>, the SEO/Open Graph/Twitter tags derived from the merged metadata, a modulepreload link and module <script> for each entry in scripts, and the body wrapped in <div id="app">.
Use extraHead and extraBody only for HTML generated by your application or the framework. User-provided values belong in meta, where they are escaped.
const html = renderDocument({
+ meta: { title: "Dashboard", robots: "noindex" },
+ body: dashboardHtml,
+ url: ctx.url,
+ extraHead: '<link rel="stylesheet" href="/_wrnexus/admin.css">',
+ extraBody: `<script type="application/json" id="boot">${JSON.stringify(bootData).replaceAll("<", "\\u003c")}</script>`,
+});
+
+return new Response(html, { headers: { "content-type": "text/html; charset=utf-8" } });
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/ssrtype SeoConfig = {
- title?: string;
- titleTemplate?: string; // e.g. "%s — My Site"; %s is replaced with the page title
- description?: string;
- canonical?: string;
- canonicalBase?: string; // origin used to absolutize canonical/image URLs
- robots?: string;
- keywords?: string | string[];
- image?: string;
- siteName?: string;
- type?: string; // Open Graph type; defaults to "website"
- locale?: string;
- twitterCard?: string; // defaults to "summary"
- twitterSite?: string;
- themeColor?: string;
-};import { renderDocument } from "@wrnexus/ssr";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { renderDocument } from "@wrnexus/ssr";
const html = renderDocument({
meta: {
@@ -163,10 +160,18 @@ const html = renderDocument({
return new Response(html, {
headers: { "content-type": "text/html; charset=utf-8" },
-});const html = renderDocument({
+ meta: { title: "Dashboard", robots: "noindex" },
+ body: dashboardHtml,
+ url: ctx.url,
+ extraHead: '<link rel="stylesheet" href="/_wrnexus/admin.css">',
+ extraBody: `<script type="application/json" id="boot">${JSON.stringify(bootData).replaceAll("<", "\\u003c")}</script>`,
+});
+
+return new Response(html, { headers: { "content-type": "text/html; charset=utf-8" } });CSS pipeline, themes, fonts, profiles, and application config.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/styles@0.2.23Request preview access. Never put registry tokens in source control.
Global CSS bundling, the+ +--wire-*design-token theme system, and thewrnexus.config.tsapp-config loader for WRNexusJS apps.
CSS pipeline, themes, fonts, profiles, and application config.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/styles@0.2.24Request preview access. Never put registry tokens in source control.
Global CSS bundling, the--wire-*design-token theme system, and thewrnexus.config.tsapp-config loader for WRNexusJS apps.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
This package owns three server-side concerns that shape every page a WRNexusJS app renders:
@@ -509,30 +509,7 @@ declare function bundleCss(entryPath: string, mode: Mode): Promise<string> declare function renderStyles(ctx: StyleProcessContext, styles?: StylesConfig): Promise<string>; export { type AppConfig, DEFAULT_THEMES, type FontConfig, type FontDisplay, type GoogleFont, type LocalFontFace, type MobileConfig, type Mode, type PwaConfig, type ResolvedTheme, type StyleProcessContext, type StylesConfig, type Mode as StylesMode, THEME_COOKIE, THEME_CSS_HREF, THEME_JS_HREF, type ThemeConfig, type ThemeTokens, bundleCss, findStyleEntry, fontCspSources, headToString, loadAppConfig, loadEnv, loadRawConfig, renderFontHead, renderProductionFontHead, renderStyles, renderThemeCss, renderThemeRuntime, resolveProfile, resolveThemeConfig, resolveThemeName }; -Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/stylesinterface StylesConfig {
- /** CSS entry path relative to the app root. Default: app/styles/global.css */
- entry?: string;
- /** Custom processor — return the final CSS string (Tailwind/PostCSS/Sass). */
- process?: (ctx: StyleProcessContext) => string | Promise<string>;
-}
-
-interface StyleProcessContext {
- entryPath: string | null; // resolved absolute CSS entry, or null
- appDir: string;
- appRoot: string;
- mode: Mode; // "development" | "production"
-}type ThemeTokens = Record<string, string>;
-
-interface ThemeConfig {
- default?: string; // theme used when no cookie is present
- themes?: Record<string, ThemeTokens>; // deep-merged over built-in light/dark
-}
-
-interface ResolvedTheme {
- default: string;
- names: string[];
- themes: Record<string, ThemeTokens>;
-}import type { AppConfig } from "@wrnexus/styles";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import type { AppConfig } from "@wrnexus/styles";
export default {
head: [
@@ -560,10 +537,50 @@ export default {
db: { driver: "postgres", url: process.env.DATABASE_URL! },
},
},
-} satisfies AppConfig;import {
+ loadAppConfig,
+ resolveProfile,
+ loadEnv,
+ findStyleEntry,
+ renderStyles,
+} from "@wrnexus/styles";
+
+const appRoot = process.cwd();
+const mode = "production" as const;
+
+const profile = resolveProfile({ mode });
+loadEnv(appRoot, profile);
+
+const config = await loadAppConfig(appRoot, profile);
+
+const appDir = `${appRoot}/app`;
+const entryPath = findStyleEntry(appDir, appRoot, config.styles?.entry);
+const css = await renderStyles({ entryPath, appDir, appRoot, mode }, config.styles);import {
+ resolveThemeConfig,
+ resolveThemeName,
+ renderThemeCss,
+ renderThemeRuntime,
+ THEME_COOKIE,
+} from "@wrnexus/styles";
+
+const theme = resolveThemeConfig(config.theme);
+
+// Server: pick the active theme from the request cookie (no flash).
+const active = resolveThemeName(cookies[THEME_COOKIE], theme);
+// → render <html data-theme={active}>
+
+const themeCss = renderThemeCss(theme); // served at THEME_CSS_HREF
+const themeJs = renderThemeRuntime(theme); // served at THEME_JS_HREF.card {
+ background: var(--wire-color-surface);
+ color: var(--wire-color-text);
+ border: 1px solid var(--wire-color-border);
+ border-radius: var(--wire-radius);
+ box-shadow: var(--wire-shadow-1);
+}<button data-wire-theme-toggle>Toggle theme</button>
+<button data-wire-theme-set="brand">Brand theme</button>WRNexusJS-aware component, route, and browser testing utilities.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/test@0.2.23Request preview access. Never put registry tokens in source control.
Testing utilities for WRNexusJS apps — component rendering, reactive-DOM mounting, route handler calls, and a full in-process app harness, plus a one-import re-export of bun:test.
+
+ WRNexusJS-aware component, route, and browser testing utilities.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/test@0.2.24Request preview access. Never put registry tokens in source control.
Testing utilities for WRNexusJS apps — component rendering, reactive-DOM mounting, route handler calls, and a full in-process app harness, plus a one-import re-export of bun:test.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/test is the server-side test toolkit you reach for when writing tests for a WRNexusJS app. It runs under bun test (invoked via wrnexus test) and gives you a single import surface: the bun:test primitives (test, expect, mock, …) re-exported alongside WRNexusJS-aware helpers that compile .wrn components, hydrate server HTML in a DOM, invoke API route handlers, and boot the real app on an ephemeral port for integration tests.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/testfunction renderComponent(source: string, props?: Record<string, unknown>): Promise<string>;function mountHtml(html: string): {
- document: Document;
- window: unknown;
- querySelector: (sel: string) => Element | null;
- querySelectorAll: (sel: string) => Element[];
-};function callRoute(
- handler: (ctx: Context) => Response | Promise<Response>,
- request: Request,
-): Promise<Response>;Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { test, expect, renderComponent, mountHtml, createHarness } from "@wrnexus/test";
+
+test("counter renders its label", async () => {
+ const html = await renderComponent(SRC, { start: 3, label: "Hits" });
+ expect(html).toContain("Hits");
+});
+
+test("reactive scope hydrates", () => {
+ const { querySelector } = mountHtml(serverHtml);
+ expect(querySelector("[data-text]")?.textContent).toBe("3");
+});
+
+test("home page responds", async () => {
+ const app = await createHarness("examples/basic-app");
+ const res = await app.fetch("/");
+ expect(res.status).toBe(200);
+ await app.close();
+});import { test, expect, callRoute } from "@wrnexus/test";
+import { GET } from "../app/api/health.ts";
+
+test("health endpoint", async () => {
+ const res = await callRoute(GET, new Request("http://test/api/health"));
+ expect(res.status).toBe(200);
+});Error/event capture, middleware, filtering, and sinks.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/tracking@0.2.23Request preview access. Never put registry tokens in source control.
Error tracking for WRNexusJS apps: capture exceptions manually or via middleware and fan them out to pluggable sinks.+ +
Error/event capture, middleware, filtering, and sinks.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/tracking@0.2.24Request preview access. Never put registry tokens in source control.
Error tracking for WRNexusJS apps: capture exceptions manually or via middleware and fan them out to pluggable sinks.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/tracking is a small, server-side error-capture layer. You create a tracker with one or more sinks, then feed it errors — either manually with tracker.capture(err, context) or automatically by mounting tracker.middleware() in your request pipeline. A consoleSink is included; forwarding to Sentry, Datadog, or any other backend is just a matter of writing a tiny sink. Reach for it when you want a single, sink-agnostic place to route application errors. Sinks run best-effort — a throwing sink never breaks the request.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/tracking{ method: ctx.req.method, path: ctx.url.pathname, requestId: ctx.locals.requestId }interface ErrorEvent {
- error: Error;
- context: Record<string, unknown>; // request info, user id, tags…
- timestamp: number; // epoch ms
-}
-
-interface ErrorSink {
- name?: string;
- capture(event: ErrorEvent): void | Promise<void>;
-}import { createTracker, consoleSink } from "@wrnexus/tracking";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { createTracker, consoleSink } from "@wrnexus/tracking";
const tracker = createTracker({ sinks: [consoleSink] });
@@ -149,10 +140,31 @@ try {
} catch (err) {
await tracker.capture(err, { userId: 42, op: "doWork" });
throw err;
-}import { createTracker, consoleSink } from "@wrnexus/tracking";
+
+const tracker = createTracker({ sinks: [consoleSink] });
+
+app.use(tracker.middleware()); // captures + re-throws downstream errorsimport { createTracker, type ErrorSink } from "@wrnexus/tracking";
+
+const sentrySink: ErrorSink = {
+ name: "sentry",
+ async capture(event) {
+ await Sentry.captureException(event.error, { extra: event.context });
+ },
+};
+
+const tracker = createTracker({
+ sinks: [sentrySink],
+ beforeSend(event) {
+ delete event.context.password; // scrub secrets
+ return event; // return null to drop the event entirely
+ },
+});
+
+tracker.addSink(anotherSink); // add more sinks laterThemeable server-rendered UI components and CSS.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/ui@0.2.23Request preview access. Never put registry tokens in source control.
First-party Wire UI component library — a set of themeable .wrn components plus a single tokenized stylesheet.
+
+ Themeable server-rendered UI components and CSS.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/ui@0.2.24Request preview access. Never put registry tokens in source control.
First-party Wire UI component library — a set of themeable .wrn components plus a single tokenized stylesheet.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
@wrnexus/ui ships a library of server-rendered .wrn components (layout, form controls, and feedback UI) together with one themeable stylesheet, ui.css. The components are auto-discovered by the framework router — you don't import them in code. Once the package's component directory is on the router's scan path, you mount any component in a page with data-component="<name>". Every visual is driven by var(--wire-*) theme tokens, so components restyle instantly when the theme changes. The tiny JS surface (src/index.ts) exists only so the toolchain (CLI build + dev server) can locate the component directory and stylesheet.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/ui"exports": {
- ".": "./src/index.ts",
- "./ui.css": "./ui.css"
-}import { buildRouter } from "@wrnexus/router";
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { buildRouter } from "@wrnexus/router";
import { uiComponentsDir } from "@wrnexus/ui";
-const router = buildRouter(appDir, { componentDirs: [uiComponentsDir()] });<div data-component="card">
+const router = buildRouter(appDir, { componentDirs: [uiComponentsDir()] });<div data-component="card">
<div data-component="badge" label="New"></div>
<button data-component="button" label="Save" variant="primary" size="lg"></button>
<div data-component="alert" variant="success" title="Done" message="Saved."></div>
</div>Validated local/S3 uploads and secure file serving.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/uploader@0.2.23Request preview access. Never put registry tokens in source control.
Config-driven file uploads + serving for WRNexusJS. Declare named storage stores (local disk or any S3-compatible backend) in wrnexus.config.ts, upload with one function call, drop a drag-and-drop widget on a page, and serve files back — public or private. Zero external dependencies (S3 is signed with a built-in AWS SigV4 implementation, like the rest of the framework).
Validated local/S3 uploads and secure file serving.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/uploader@0.2.24Request preview access. Never put registry tokens in source control.
Config-driven file uploads + serving for WRNexusJS. Declare named storage stores (local disk or any S3-compatible backend) in wrnexus.config.ts, upload with one function call, drop a drag-and-drop widget on a page, and serve files back — public or private. Zero external dependencies (S3 is signed with a built-in AWS SigV4 implementation, like the rest of the framework).
// wrnexus.config.ts
import type { AppConfig } from "@wrnexus/styles";
@@ -46,7 +47,7 @@ const config: AppConfig = {
},
};
export default config;
-// app/api/upload.ts — one-liner
import { handleUpload } from "@wrnexus/uploader";
export const POST = handleUpload({ store: "public" });
@@ -56,7 +57,7 @@ import { upload, getStore } from "@wrnexus/uploader";
const { files } = await upload("docs", ctx.req, { prefix: "invoices" });
await getStore("docs").driver.delete(files[0].key);
Uploads are validated (size + type), stored under a random, collision-proof, path-safe key (the client filename is never used as a path), and — for public stores — returned with a servable url.
Drop the element anywhere; the runtime (drag-and-drop, per-file progress, success/failed states) is auto-injected on pages that contain data-uploader:
<div
data-uploader="public"
@@ -78,7 +79,7 @@ await getStore("docs").driver.delete(files[0].key);
wrnexus:upload — detail: { file, result: { key, url, name, size, type } }wrnexus:upload-error — detail: { file, error }/__wrnexus/uploads/<store>/<key> (immutable cache).url is the bucket/CDN URL directly.Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
// wrnexus.config.ts
+Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
// wrnexus.config.ts
import type { AppConfig } from "@wrnexus/styles";
const config: AppConfig = {
@@ -400,22 +401,30 @@ const config: AppConfig = {
},
},
};
-export default config;// app/api/upload.ts — one-liner
+export default config;// app/api/upload.ts — one-liner
import { handleUpload } from "@wrnexus/uploader";
export const POST = handleUpload({ store: "public" });
-// → { ok: true, files: [{ key, url, name, type, size }] }// or drive it yourself, anywhere you have the request
+// → { ok: true, files: [{ key, url, name, type, size }] }// or drive it yourself, anywhere you have the request
import { upload, getStore } from "@wrnexus/uploader";
const { files } = await upload("docs", ctx.req, { prefix: "invoices" });
-await getStore("docs").driver.delete(files[0].key);<div
+await getStore("docs").driver.delete(files[0].key);<div
data-uploader="public"
data-endpoint="/api/upload"
data-accept="image/*"
data-max="10000000"
data-multiple
-></div><div
+ data-component="file-upload"
+ store="public"
+ endpoint="/api/upload"
+ accept="image/*"
+ multiple="true"
+></div>// app/api/files/[key].ts
+import { serveFromStore } from "@wrnexus/uploader";
+export const GET = serveFromStore("docs"); // your middleware decides who gets inTyped schemas, coercion, validation, and browser descriptors.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/validation@0.2.23Request preview access. Never put registry tokens in source control.
One fluent schema, validated on the server (API bodies, env vars) and mirrored to an eval-free browser validator for forms.+ +
Typed schemas, coercion, validation, and browser descriptors.
This package is not available from the public npm registry. After WorkRoot approves access and supplies private registry instructions, install the release-aligned package:
bun add @wrnexus/validation@0.2.24Request preview access. Never put registry tokens in source control.
One fluent schema, validated on the server (API bodies, env vars) and mirrored to an eval-free browser validator for forms.
Part of the WRNexusJS framework — an SSR-first, Bun-native full-stack web framework.
Define a schema once with the fluent v builder, then reuse it in three places: .parse() runs server-side and returns coerced values plus per-field errors; .describe() emits a plain-JSON SchemaDescriptor that the browser runtime interprets (no eval, no bundled validator); and helpers like parseBody and parseEnv wire schemas straight into API routes and startup config. The server rule logic (applyRule/checkField) and the client runtime (VALIDATE_RUNTIME) mirror each other exactly, so a form validates identically in both places. Schemas are conventionally kept in app/schemas/.
Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
bun add @wrnexus/validationimport { v } from "@wrnexus/validation";schema.parse(input: unknown): ParseResult
-schema.describe(): SchemaDescriptorinterface ParseResult<T = Record<string, unknown>> {
- ok: boolean; // true when errors is empty
- value: T; // coerced values (present pass or fail)
- errors: Record<string, string>; // field name → first failing message
-}Examples are taken from this package's installed documentation and must be evaluated with its requirements and stability notes.
import { v, parseBody } from "@wrnexus/validation";
+
+export const signupSchema = v.object({
+ email: v.string().required("Enter your email address").trim().email(),
+ password: v.string().required("Enter your password").min(8).max(200),
+ age: v.number().integer().min(13).max(120).optional(),
+ role: v.string().oneOf(["user", "admin"]).default("user"),
+ agree: v.boolean(),
+});
+
+// inside a route handler
+const result = await parseBody(signupSchema, req);
+if (!result.ok) return result.response; // ready 400 with field errors
+const { email, password, role } = result.value;const schema = v.object({
+ username: v
+ .string()
+ .min(3)
+ .refine((name) => !RESERVED.has(String(name)), "That name is taken"),
+});import { v, parseEnv } from "@wrnexus/validation";
+
+export const env = parseEnv(
+ v.object({
+ DATABASE_URL: v.string().min(1),
+ PORT: v.number().integer().default(3000),
+ DEBUG: v.boolean().optional(),
+ }),
+);
+// throws one readable error listing every bad variable if misconfiguredimport { renderSchemasScript, VALIDATE_RUNTIME } from "@wrnexus/validation";
+import { signupSchema } from "./app/schemas/signup.ts";
+
+const head = `<script>${renderSchemasScript({ signup: signupSchema.describe() })}</script>
+<script>${VALIDATE_RUNTIME}</script>`;
+// render a <form data-schema="signup"> with [data-error="email"] etc.Released 2026-07-13. All 26 installed packages are aligned to this version. Highlights include the new helpers package, reliable workspace app addition, and browser SSO redirects through forward authentication. See the changelog, upgrade guide, and package references.
Roadmap items are direction, not delivery commitments. Dates require explicit owner approval.
This build-time index is local and sends no query to a third party. Use your browser’s find command to filter this compact index.
Get started · Packages · Language · Architecture
Project structure · Routing · Pages and components · Server data · API routes · Middleware · Forms and validation · Authentication · Authorization · Application security · Database · Uploads · Realtime · Pub/sub · Queues · Testing · Workspaces and gateway · Deployment · Configuration and profiles · Internationalization and themes · Mobile · Observability · Upgrading · Troubleshooting
@wrnexus/ai · @wrnexus/authz · @wrnexus/compiler · @wrnexus/core · @wrnexus/csr · @wrnexus/db · @wrnexus/dev-server · @wrnexus/encryption · @wrnexus/helpers · @wrnexus/i18n · @wrnexus/jwt · @wrnexus/mobile · @wrnexus/native · @wrnexus/oauth · @wrnexus/pubsub · @wrnexus/queue · @wrnexus/reactive · @wrnexus/router · @wrnexus/ssr · @wrnexus/styles · @wrnexus/test · @wrnexus/tracking · @wrnexus/ui · @wrnexus/uploader · @wrnexus/validation · @wrnexus/cli
WRNexusJS provides primitives for CSP, CSRF, Trusted Types, sessions, validation, authorization, encryption, upload restrictions, request limits, and WebSocket-origin checks. Applications remain responsible for correct configuration, business authorization, secrets, dependencies, data protection, and operations.
Only the current private-preview release 0.2.23 is documented here. A formal old-release support window is not yet published.
Use WorkRoot’s approved private contact path at workroot.in. Do not publish exploit details or secrets. Include affected version, impact, reproduction, and a safe contact method. Response targets, encryption key, bounty, audit, and certification are not currently claimed.
Use restrictive CSP and permissions policies, HSTS only on HTTPS production origins, MIME sniffing protection, restrictive referrers, explicit CORS, secure cookies, CSRF validation, request limits, and origin checks. See application security.
WRNexusJS provides primitives for CSP, CSRF, Trusted Types, sessions, validation, authorization, encryption, upload restrictions, request limits, and WebSocket-origin checks. Applications remain responsible for correct configuration, business authorization, secrets, dependencies, data protection, and operations.
Only the current private-preview release 0.2.24 is documented here. A formal old-release support window is not yet published.
Use WorkRoot’s approved private contact path at workroot.in. Do not publish exploit details or secrets. Include affected version, impact, reproduction, and a safe contact method. Response targets, encryption key, bounty, audit, and certification are not currently claimed.
Use restrictive CSP and permissions policies, HSTS only on HTTPS production origins, MIME sniffing protection, restrictive referrers, explicit CORS, secure cookies, CSRF validation, request limits, and origin checks. See application security.
Only confirmed public properties are listed; no customer or traffic claims are made.
Creator/company site demonstrating a public WRNexusJS deployment. Exact deployed version and infrastructure notes await owner confirmation.
This documentation portal, built and verified against WRNexusJS 0.2.23 on Bun.
Screenshots are intentionally deferred until approved assets and alt text are available.
Only confirmed public properties are listed; no customer or traffic claims are made.
Creator/company site demonstrating a public WRNexusJS deployment. Exact deployed version and infrastructure notes await owner confirmation.
This documentation portal, built and verified against WRNexusJS 0.2.24 on Bun.
Screenshots are intentionally deferred until approved assets and alt text are available.
WRNexusJS has no public Discord, public issue tracker, or guaranteed community support channel listed by this repository. Preview access and support begin through WorkRoot’s public contact path.
Include WRNexusJS version, Bun version, OS, a minimal reproduction, expected and actual behavior, and sanitized logs. Never include registry tokens, credentials, session cookies, or private data.
Support scope, service levels, and commercial terms require owner confirmation.
This tutorial connects the installed 0.2.23 APIs into one design. Snippets are limited to declarations and README patterns verified in the installed packages; a CI-compiled standalone fixture remains on the roadmap.
A .wrn page renders tasks from an SSR API binding. A shared validation schema protects mutations. Session middleware identifies users, authorization policies gate updates, and a realtime room broadcasts changes.
import { v, parseBody } from "@wrnexus/validation";
+ Preview · runnable-project extraction pendingSecure task board
This tutorial connects the installed 0.2.24 APIs into one design. Snippets are limited to declarations and README patterns verified in the installed packages; a CI-compiled standalone fixture remains on the roadmap.
Application shape
A .wrn page renders tasks from an SSR API binding. A shared validation schema protects mutations. Session middleware identifies users, authorization policies gate updates, and a realtime room broadcasts changes.
Schema and create route
import { v, parseBody } from "@wrnexus/validation";
const task = v.object({ title: v.string().trim().min(3).max(120) });
export const POST = async (ctx) => {
const parsed = await parseBody(task, ctx.req);
@@ -23,7 +23,7 @@ export const POST = async (ctx) => {
</ul></main>
}
}
Production checklist
- Choose SQLite for local development or configure the supported PostgreSQL driver.
- Run migrations before accepting traffic.
- Enable session authentication and enforce authorization on every mutation.
- Validate upload types and sizes; keep private objects behind authenticated routes.
- Use Redis pub/sub when realtime rooms span processes.
- Treat the default queue as non-durable until a production driver is selected.
Follow the focused database, authentication, authorization, realtime, and upload guides.
-
+