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();

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.