Fast Track

Quick Start Guide

Launch your first XyPriss server in minutes using the CLI or manual setup.

Method 1: Using XyPriss CLI (Recommended)

The CLI provides the fastest way to initialize a production-ready project with all the necessary boilerplate.

Initialize the project

Run the following command to start the interactive project setup:

bash
xfpm init

Verification and Install

Navigate to your project directory. While xfpm init usually handles dependency installation, you can run this manually if the process was interrupted (network failure, crash, etc.):

bash
cd my-app && xfpm install

Start development

Launch the development server with hot-reload enabled:

bash
xfpm dev
CLI Features
The CLI automatically configures TypeScript, security headers, and can optionally set up authentication and file upload support.
Optional: Security Shield
For projects requiring advanced protection, you can install the optional security shield layer:
bash
xfpm install xypriss-security

Method 2: Manual Setup

If you prefer full control, you can write the server code directly without relying on the CLI scaffolding.

CLI handles this for you
The recommended method (`xfpm init`) already bootstraps the project, installs dependencies, and generates the same boilerplate shown below. Use this manual path only if you want to integrate XyPriss into an existing codebase or avoid CLI scaffolding.

Create a Basic Server

Create an `index.ts` file and add the following code to initialize a secure server:

index.ts
import { createServer } from "xypriss";

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

app.get("/", (req, res) => {
    res.success("Hello from XyPriss Stable");
});

app.start();

Advanced Features

Typed Routing

Native support for typed path parameters and API versioning.

typescript
app.version("v1", (v1) => {
  v1.get("/user/:id<number>", (req, res) => {
    res.success(`User ${req.params.id}`);
  });
});

Multi-Server

Run multiple isolated server instances from a single process.

typescript
const app = createServer({
  multiServer: {
    enabled: true,
    servers: [
      { id: "api", port: 3001 },
      { id: "admin", port: 3002 }
    ]
  }
});

Running your app

Always use xfpm run to execute your scripts and entry points.

bash
xfpm dev
Unsupported Runtimes
Using `npm run` or `node` directly is not supported and will cause undefined behavior due to the native engine requirements.
Deep Dive into XHSC

Learn how the native Go-core handles routing, security, and performance at the lowest level.