JSPM

  • Created
  • Published
  • Downloads 458
  • Score
    100M100P100Q98277F
  • License NOSL

XyPriss is a lightweight, TypeScript-first, open-source Node.js web framework crafted for developers seeking a familiar Express-like API without Express dependencies. It features built-in security middleware, a robust routing system, and performance optimizations to build scalable, secure web applications effortlessly. Join our community and contribute on GitHub!

Package Exports

  • xypriss
  • xypriss/package.json

Readme

XyPriss Logo

XyPriss (Beta)

A powerful Node.js web framework with built-in security, clustering, and performance optimizations for modern web applications.

npm version TypeScript License: NOSL Powered by Nehonix XyNginC


Overview

XyPriss is a powerful, TypeScript-first, open-source Node.js web framework that enhances your development experience with built-in security middleware, clustering, and performance optimizations. Whether you're building new applications or enhancing existing ones, XyPriss provides the tools you need for scalable, secure web development.

For production deployments, XyPriss integrates seamlessly with XyNginC for automated Nginx configuration and SSL management.

Key Features

  • Familiar API: Intuitive syntax for defining routes and middleware
  • Built-in Security: 12+ security middleware modules (CSRF, XSS, rate limiting)
  • File Upload Support: Seamless multipart/form-data handling with automatic error handling
  • XJson API: Advanced JSON serialization handling BigInt, circular references, and large data
  • Multi-Server Mode: Run multiple server instances with different configurations
  • Flexible Routing: Parameters, wildcards, and modular routers
  • TypeScript Support: Full type definitions for better DX
  • Performance: Advanced clustering, caching, and optimizations

Note: XyPriss is the successor to FortifyJS, which will be deprecated. Migration Guide


Installation

npm install xypriss
# or
yarn add xypriss

For additional security features:

npm install xypriss-security

Quick Start

# Install the CLI globally
npm install -g xypriss-cli

# Create a new project
xypcli init

# Start development
cd your-project-name
npm run dev

The CLI automatically generates a complete project structure with authentication, file upload support, and multi-server configuration (all optional).

Manual Setup

import { createServer } from "xypriss";

const server = createServer({
    server: { port: 3000 },
    security: { enabled: true },
    performance: { clustering: true },
});

server.get("/", (req, res) => {
    res.json({ message: "Hello from XyPriss!", powered: "Nehonix" });
});

// XJson example for handling BigInt and large data
server.get("/api/data", (req, res) => {
    const data = {
        id: 123n, // BigInt value
        timestamp: new Date(),
        items: Array.from({ length: 1000 }, (_, i) => ({
            id: i,
            value: BigInt(i * 1000),
        })),
    };

    res.xJson(data); // Advanced JSON handling
});

server.start(() => {
    console.log(`Server running at http://localhost:${server.getPort()}`);
});

Documentation

Core Guides

Additional Resources


Quick Examples

Routing

import { createServer, Router } from "xypriss";

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

userRouter.get("/:id", (req, res) => {
    res.json({ userId: req.params.id });
});

app.use("/api/users", userRouter);

→ Full Routing Guide

File Upload

import { createServer, FileUploadAPI } from "xypriss";

const app = createServer({
    fileUpload: {
        enabled: true,
        maxFileSize: 5 * 1024 * 1024, // 5MB
    },
});

const upload = new FileUploadAPI();
await upload.initialize(app.configs?.fileUpload);

app.post("/upload", upload.single("file"), (req, res) => {
    res.json({ success: true, file: req.file });
});

→ Full File Upload Guide

Security

const server = createServer({
    security: {
        enabled: true,
        level: "enhanced",
        cors: {
            origin: ["localhost:*", "*.myapp.com"],
            credentials: true,
        },
        rateLimit: { max: 100, windowMs: 15 * 60 * 1000 },
    },
});

→ Full Security Guide

Multi-Server

const app = createServer({
    multiServer: {
        enabled: true,
        servers: [
            {
                id: "api-server",
                port: 3001,
                routePrefix: "/api",
                allowedRoutes: ["/api/*"],
            },
            {
                id: "admin-server",
                port: 3002,
                routePrefix: "/admin",
                security: { level: "maximum" },
            },
        ],
    },
});

await app.startAllServers();

→ Full Multi-Server Guide

Production Deployment

Integrate XyNginC directly into your server for automated Nginx & SSL management:

import { createServer } from "xypriss";
import XNCP from "xynginc";

const app = createServer({
    plugins: {
        register: [
            XNCP({
                domains: [
                    {
                        domain: "api.example.com",
                        port: 3000,
                        ssl: true,
                        email: "admin@example.com",
                    },
                ],
            }),
        ],
    },
});

app.start();

→ Full XyNginC Guide


Modules

ACPES (Advanced Cross-Platform Encrypted Storage)

Secure storage solution for web, mobile, and Node.js environments.

import { Storage, STORAGE_KEYS } from "xypriss-acpes";

await Storage.setItem(STORAGE_KEYS.SESSION_TOKEN, "secure-token");
const token = await Storage.getItem(STORAGE_KEYS.SESSION_TOKEN);

→ ACPES Documentation

Security Module

Advanced security utilities for data handling and request protection.

import { fString, generateSecureToken } from "xypriss-security";

const secureData = fString(data, { enableEncryption: true });
const token = generateSecureToken({ length: 32 });

→ Security Module Documentation


Performance

XyPriss is designed for efficiency and scalability:

  • Independent HTTP Server: No Express dependency
  • Clustering: Automatic scaling based on CPU cores
  • Caching: Memory, Redis, or hybrid strategies
  • Auto Port Switching: Detects and switches ports if conflicts arise
const server = createServer({
    server: {
        port: 3000,
        autoPortSwitch: { enabled: true, portRange: [3000, 3100] },
    },
    cache: {
        strategy: "redis",
        maxSize: 100 * 1024 * 1024, // 100MB
        ttl: 3600,
    },
    cluster: { enabled: true, workers: "auto" },
});

→ Full Configuration Guide


Works Great With Express

XyPriss complements the Node.js ecosystem:

  • Use XyPriss standalone for new projects
  • Enhance existing Express apps with XyPriss security modules
  • Run both frameworks side by side
  • Migrate gradually
import express from "express";
import { XyPrissSecurity } from "xypriss-security";

const app = express();

app.use(
    XyPrissSecurity.middleware({
        csrf: true,
        xss: true,
        rateLimit: { windowMs: 15 * 60 * 1000, max: 100 },
    })
);

Contributing

We welcome contributions! See the Contributing Guide for details.


Support


License

XyPriss is licensed under the NOSL License.


Built with ❤️ by Nehonix Devs and its collaborators

Website GitHub