Skip to content

Nalix¶

Nalix Logo

NuGet version GitHub stars License

Nalix is a real-time TCP and UDP networking framework for .NET 10. It provides a unified packet model shared between client and server, zero-allocation hot paths, shard-aware dispatch pipelines, and middleware-driven packet processing with production-grade transport infrastructure.


Get Started View Packages


What does building with Nalix look like?¶

A typical Nalix application involves five clean steps:

  1. Define packets: Create shared contracts using [Packet] attributes.
  2. Register handlers: Map packets to logic via fluent routing.
  3. Configure transport: Select TCP/UDP and set security policies.
  4. Run the server: Start the host using the NetworkApplicationBuilder.
  5. Connect using SDK: Leverage the client-side session to communicate.

Quickstart

See Quickstart for a full, copy-pasteable example.


If you're new to Nalix, follow this path to go from zero to production-ready:

  1. Introduction — Understand the design philosophy and mental model.
  2. Architecture — Explore the layered component system.
  3. Quickstart — Build your first Ping/Pong server in minutes.
  4. End-to-End Guide — Move beyond basics with a full feature implementation.
  5. Middleware — Learn how to secure and scale your traffic.

Next

Explore the API Reference as needed.


Nalix Data Flow

Zero-alloc hot path¶

Pooled buffers, pooled contexts, and frozen lookups reduce GC pressure for sustained low-latency traffic.

Shard-aware dispatch¶

Worker distribution prevents head-of-line blocking and scales packet handling across logical cores.

Fault Isolation¶

Handler exceptions are trapped and logged without affecting other connections or crashing the worker loops.


Why Nalix¶

Capability How Nalix delivers it
Unified packet model Define packet types once in a shared assembly. Both Nalix.Network (server) and Nalix.SDK (client) consume the same contracts, attributes, and serialization metadata.
Zero-allocation data paths Pooled buffers (BufferLease), pooled packet contexts, frozen registry lookups (FrozenDictionary), and function-pointer–based deserialization eliminate GC pressure on hot paths.
Shard-aware dispatch PacketDispatchChannel distributes work across multiple worker loops to prevent head-of-line blocking. Workers scale to logical CPU core count.
Middleware pipeline Production-grade packet middleware system (MiddlewarePipeline) for application policy (permissions, rate limiting, timeouts) and observability.
Production transport Built-in connection guarding, token-bucket rate limiting, policy-based throttling, concurrency gates, and timing-wheel–based idle timeout management.

Architecture Overview¶

Nalix organizes networking into four clean layers.

graph TD
    subgraph Client ["Nalix.SDK"]
        Session["TransportSession / TcpSession"]
    end

    subgraph Server ["Nalix.Hosting"]
        Builder["NetworkApplicationBuilder"]
        Host["NetworkApplication"]
    end

    subgraph Runtime ["Nalix.Runtime"]
        Dispatch["PacketDispatchChannel"]
        Middleware["Middleware Pipeline"]
    end

    subgraph Base ["Nalix.Abstractions / Framework"]
        Registry["PacketRegistry"]
        Pool["BufferPoolManager"]
        Crypto["FrameCipher / FrameCompression"]
    end

    Session -- "TCP / UDP" --> Host
    Host --> Dispatch
    Dispatch --> Registry
    Dispatch --> Middleware
    Middleware --> Handlers["Handler Logic"]

Start Here¶

Choose the path that matches your role.

  1. Introduction — Design philosophy and mental model
  2. Installation — Package selection and prerequisites
  3. Quickstart — Build a Ping/Pong server end-to-end
  4. Architecture — Layered component overview
  5. Server Blueprint — Production-oriented project structure
  1. Introduction — Design philosophy and mental model
  2. Installation — Package selection and prerequisites
  3. Quickstart — Connect a client to your first server
  4. Nalix.SDK — Client transport sessions and request helpers
  5. TCP Session — Detailed session API
  1. Selecting Building Blocks — Decision guide
  2. Middleware — Middleware Pipeline and lifecycle
  3. Custom Middleware Guide — End-to-end walkthrough
  4. Custom Metadata Provider — Convention-based metadata
  1. Architecture — System design and component boundaries
  2. Packet System — Serialization and unified packet model
  3. Binary Specification — Detailed wire format and layout rules
  4. Packet Lifecycle — Request path from socket to handler
  5. Error Reporting — Runtime and protocol signaling
  6. Glossary — Term definitions

Core Packages¶

Package Purpose
Nalix.Network TCP/UDP listeners, connections, protocol logic, and transport infrastructure
Nalix.Runtime Packet dispatch, middleware execution, handler compilation, and session resume
Nalix.SDK Client-side transport sessions, request/response helpers, and handshake flows
Nalix.Framework Configuration, service registry, serialization, packet registry, pooling, compression, and identifiers
Nalix.Hosting Fluent builder and application lifecycle for server bootstrap
Nalix.Abstractions Shared contracts, packet attributes, middleware primitives, and connection abstractions

For the full package map, see Packages Overview.


Nalix is built by PPN Corporation. Licensed under Apache 2.0.