LuciferCore 5.30.0

Prefix Reserved
dotnet add package LuciferCore --version 5.30.0
                    
NuGet\Install-Package LuciferCore -Version 5.30.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LuciferCore" Version="5.30.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LuciferCore" Version="5.30.0" />
                    
Directory.Packages.props
<PackageReference Include="LuciferCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LuciferCore --version 5.30.0
                    
#r "nuget: LuciferCore, 5.30.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LuciferCore@5.30.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LuciferCore&version=5.30.0
                    
Install as a Cake Addin
#tool nuget:?package=LuciferCore&version=5.30.0
                    
Install as a Cake Tool

LuciferCore

NuGet Downloads

LuciferCore is a high-performance, event-driven framework for .NET.

It is built for modulith architecture: start as one clean monolith, then split modules into microservices later when needed.

LuciferCore combines:

  • OOP for clear architecture
  • DOD for data speed and memory efficiency

The core idea is a Buffer-Model design to reduce allocations and improve CPU cache usage.


🚀 Key Features

  • Modulith-first design
    Build independent business modules in one app. Move to microservices later with minimal changes.

  • Fast DI (LuciferModel)
    Uses static-generic patterns and compiled expressions to reduce runtime overhead.

  • Smart pooling
    Combines ArrayPool<byte> and ObjectPool<T> to reduce GC pressure.

  • Attribute-driven architecture
    Use attributes like [Server], [Handler], [Manager], [Middleware], [Route] for clear structure.


🧠 Design Philosophy (OOP + DOD)

Data-Oriented flow for performance

Network payloads are handled in contiguous buffers to improve memory locality and reduce cache misses.

OOP flow for maintainability

High-level components like Session/Request/Response stay clean and modular.

Compiled DI for low overhead

LuciferModel builds dependency factories ahead of time, avoiding heavy runtime reflection.


⚡ Typical Workflow

  1. Decorate classes with attributes ([Server], [Handler], [Manager], [Middleware])
  2. Implement your logic
  3. Run with:
Lucifer.CMD("/run"u8);

🛠 Quick Start

1) Create server

[Server("ChatServer", 8443)]
public class ChatServer : WssServer
{
    public ChatServer(SslContext context, IPAddress address, int port) : base(context, address, port)
    {
        AddStaticContent(_staticContentPath);
        Cache.Freeze();

        Mapping = new(true)
        {
            { "/", "/index.html" },
            { "/404", "/404.html" }
        };
        Mapping.Freeze();
    }

    public ChatServer(int port) : this(CreateSslContext(), IPAddress.Any, port) { }

    protected override ChatSession CreateSession() => new(this);

    [Config("WWW", "assets/client/dev")]
    private static string _staticContentPath { get; set; } = string.Empty;

    [Config("CERTIFICATE", "assets/tools/certificates/server.pfx")]
    private static string s_certPath { get; set; } = string.Empty;

    [Config("CERT_PASSWORD", "RootCA!SecureKey@Example2025Strong")]
    private static string s_certPassword { get; set; } = string.Empty;

    public static SslContext CreateSslContext()
    {
#if DEBUG
        return SslContext.CreateDevelopmentContext();
#else
        var cert = X509CertificateLoader.LoadPkcs12FromFile(s_certPath, s_certPassword);
        return new(SslProtocols.Tls12, cert);
#endif
    }
}

2) Create session

[RateLimiter(10, 1)]
public partial class ChatSession : WssSession
{
    public ChatSession(ChatServer server) : base(server) { }

    protected override void OnWsReceived(byte[] buffer, long offset, long size)
    {
        // Handle websocket message
    }

    protected override void OnReceivedRequest(RequestModel request)
        => RouteHandler.Route(request, this);
}

3) Create handler

[Handler("v1", "/api/user")]
internal class HttpsHandler : RouteHandler
{
    [Authorize(UserRole.Guest)]
    [HttpGet("")]
    protected void GetHandle([Data] RequestModel request, [Session] HttpsSession session)
        => throw new NotImplementedException();
}

4) Add middleware

[Middleware("AuthGuard")]
internal sealed class AuthGuardMiddleware : MiddlewareHandler
{
    protected override bool Handle(IRoutable data, SessionTransport session)
        => session.IsAuthenticated;
}

Use it in handler:

[HttpGet("")]
[UseMiddleware("AuthGuard")]
[Authorize(UserRole.Guest)]
public void SendChat([Session] ChatSession session, [Data] PacketModel data)
{
}

5) Add manager

[Manager("MasterManager")]
public class ManagerMaster : ManagerBase
{
    protected override void Setup()
    {
    }

    protected override void Update()
    {
        Lucifer.Log(this, "Master is running...."u8);
        workload = 10;
    }
}

6) Program entry point

using LuciferCore.Main;

Lucifer.CMD("/run"u8);

Console Commands

Built-in examples:

  • /start managers
  • /stop managers
  • /restart managers
  • /start servers
  • /stop servers
  • /restart servers

Custom command example:

[ConsoleCommand("/start proxy", "Start proxy")]
private static void CmdStartProxy() => Start();

[ConsoleCommand("/stop proxy", "Stop proxy")]
private static void CmdStopProxy() => Stop();

📦 Installation

dotnet add package LuciferCore

📜 License

LuciferCore uses dual licensing:

  • AGPL-3.0 (open-source / evaluation)
  • Commercial License (for closed-source or enterprise use)

If your company uses LuciferCore in proprietary products or SaaS, you need a commercial license:

👉 https://bufmod.lemonsqueezy.com/


👤 Author


Pushing .NET performance with practical architecture and efficient memory design.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.30.0 43 8/16/2026
5.29.1 55 8/12/2026
5.28.0 65 8/12/2026
5.27.0 84 8/10/2026
5.26.0 79 8/9/2026
5.25.1 94 8/8/2026
5.24.1 82 8/8/2026
5.23.0 107 8/7/2026
5.22.0 93 8/7/2026
5.21.0 88 8/6/2026
5.20.0 99 8/5/2026
5.19.0 100 8/5/2026
5.18.0 100 8/4/2026
5.17.0 99 8/4/2026
5.16.0 101 8/3/2026
5.15.1 99 8/3/2026
Loading failed

fix(core): refine http cookie parsing, span memory safety, and core facades

     This update introduces critical memory safety fixes for span manipulations and improves the reliability of the HTTP parsing engine, alongside new public utilities.

     HTTP Parsing & Models:
     - HttpModel: Integrated SIMD-accelerated Trim directly into header parsing for improved throughput.
     - RequestModel: Refactored cookie parsing to a robust `while(true)` loop, ensuring the final token is successfully captured even if the trailing `;` is missing.
     - ResponseModel: Added strict validation to reject empty keys in `Set-Cookie` headers, preventing malformed memory offsets while still permitting empty values.

     Buffer Utilities:
     - Memory Safety: Fixed `Trim` and `TrySplitAt` to return a 0-length slice (`span[..0]` / `span[span.Length..]`) instead of a default empty span. This preserves the original memory pointer, preventing fatal negative offset calculations during span arithmetic.
     - Byte Computation: Updated the generic `SizeOf<T>` method to return accurate byte counts. It now explicitly calculates UTF-8 byte lengths for `char` types, while maintaining the `Length * Unsafe.SizeOf<T>()` calculation for all other unmanaged types.

     Lucifer Facades:
     - Exposed `GetIdentity` from the session middleware to the public API for broader accessibility.
     - Added a new `Random` utility method for optimized, allocation-free random byte generation using a customizable ASCII charset.