XyPriss XyPriss Router

The XyPriss routing engine is built on a high-performance radix-tree lookup algorithm backed by the XHSC core. It is designed for sub-millisecond route resolution, native security, and developer clarity.

Radix-Tree

Sub-millisecond resolution regardless of total route count.

Declarative Guards

Typed, inheritable security chains applied directly to definitions.

Native Throttling

Per-route rate limiting and caching enforced at the native level.

Quick Start

typescript
import { createServer, Router } from "xypriss";

const app = createServer();
const router = Router();

router.get("/hello", (req, res) => {
    res.success("Hello from XyPriss Router!");
});

app.use(router);
app.start();

Performance Benchmarks

This benchmark measures raw routing throughput on a minimal JSON payload. It intentionally isolates the routing engine from business logic, which makes the IPC bridge overhead visible. That said, it still reflects real-world capability under concurrent connections.

Routing Throughput (5k)
~4 569 req/s

XyPriss at 5 000 concurrent connections — zero errors.

Stability

XyPriss achieves zero errors at 1 000 and 5 000 connections.

vs Express
×2.1 – ×4.3

Higher throughput than Express at every load level.

Throughput (req/s) — Routing

Concurrent connections

02391478171729562100911883539131 0001579899743595 000216595624569ExpressFastifyXyPriss

Higher is better (single worker)

Average Latency — Routing

Lower is better (ms)

054610921638218410010005000
Context: Fastify leads on raw routing speed
Fastify is purpose-built for in-process routing (llhttp parser, compiled schemas), which is why it tops this benchmark. XyPriss pays an IPC bridge cost on trivial payloads because the request crosses Go → Node.js → Go. On real workloads (auth + file transfer), that fixed cost is amortised and XyPriss becomes the latency leader. Use the routing metric as a lower bound; real applications will see a smaller gap thanks to middleware, I/O, and XInS smoothing.
Error Rate at 1 000 & 5 000 connections
Express drops 61 requests at 1,000 connections — its event loop saturates. XyPriss and Fastify both achieve zero errors at 1,000 and 5,000 connections, thanks to the XHSC goroutine buffer absorbing spikes before they reach Node.js.

HTTP Server Modularity

The XHSC HTTP server core is modularized into specialized components to handle high-concurrency traffic with minimal overhead.

RouteManager

Handles high-speed registration, parameter extraction, and radix-based route matching.

BodyParser

A high-efficiency utility for parsing JSON and URL-encoded request bodies.

RequestForwarder

Manages server-side request forwarding (req.forward) for seamless internal communication.

HttpErrorHandler

Centralizes 404 management and internal server error handling across the framework.

Core Concepts

Declarative Route Options

Unlike traditional middleware stacks, XyPriss Router lets you declare security, throttling, and caching directly on the route definition.

typescript
router.get(
    "/api/data",
    {
        guards: ["authenticated"],
        rateLimit: { max: 100, windowMs: 60_000 },
        cache: "1h",
    },
    (req, res) => {
        res.json({ data: "protected and cached" });
    },
);

Guard Inheritance Chain

Guards cascade from the broadest to most specific scope, ensuring a robust security hierarchy:

Router Guards → Group Guards → Route Guards
XyGuard API
XyGuard allows you to define the logic for these declarative guards globally, keeping your route definitions clean and expressive.
Groups and Versioning

Learn how to organize your API with prefixes, nested groups, and versioning.