LuciferCore 4.5.0
Prefix ReservedSee the version list below for details.
dotnet add package LuciferCore --version 4.5.0
NuGet\Install-Package LuciferCore -Version 4.5.0
<PackageReference Include="LuciferCore" Version="4.5.0" />
<PackageVersion Include="LuciferCore" Version="4.5.0" />
<PackageReference Include="LuciferCore" />
paket add LuciferCore --version 4.5.0
#r "nuget: LuciferCore, 4.5.0"
#:package LuciferCore@4.5.0
#addin nuget:?package=LuciferCore&version=4.5.0
#tool nuget:?package=LuciferCore&version=4.5.0
LuciferCore
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
CombinesArrayPool<byte>andObjectPool<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
- Decorate classes with attributes (
[Server],[Handler],[Manager],[Middleware]) - Implement your logic
- 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)
=> Lucifer.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....");
workload = 10;
}
}
6) Program entry point
using LuciferCore.Main;
Lucifer.CMD("/run"u8);
Console Commands
Built-in examples:
/start host/stop host/restart host/start servers/stop servers/restart servers/start managers/stop managers/restart managers
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
- Nguyen Minh Thuan (thuangf45)
- Portfolio: https://thuangf45.github.io
- LinkedIn: https://www.linkedin.com/in/thuangf45
- GitHub: https://github.com/thuangf45
- Blog: https://dev.to/thuangf45
- Email: kingnemacc@gmail.com
- NuGet: https://www.nuget.org/profiles/thuangf45
- Repository: https://github.com/thuangf45/LuciferCore
- Documentation: https://bufmod.gitbook.io/lucifercore
- Store: https://bufmod.lemonsqueezy.com/
Pushing .NET performance with practical architecture and efficient memory design.
| Product | Versions 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. |
-
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 |
|---|---|---|
| 4.6.0 | 42 | 7/2/2026 |
| 4.6.0-debug | 43 | 7/2/2026 |
| 4.5.0 | 41 | 7/2/2026 |
| 4.5.0-debug | 40 | 7/2/2026 |
| 4.4.0 | 55 | 7/2/2026 |
| 4.4.0-debug | 39 | 7/2/2026 |
New Middleware Pipeline
This update adds a new middleware pipeline for better security and performance.
What's new
- Attribute-based middleware: Use [UseMiddleware] to turn middleware on or off for each session or route. No more hardcoded logic.
- Auto-discovery: Middleware is found and registered automatically. You can create custom middleware without extra setup.
- Separate pipelines: Session middleware and static file middleware now run separately. API requests skip unneeded checks, so throughput is faster.
- New pre-processing stage: Middleware now runs between the Network Layer and Route Handlers. This makes request handling cleaner and safer.
- Updated contract: The Handle method now accepts IRoutable?. Middleware can run at both the Session and Route level without needing extra data.
Breaking change
- Middleware is now opt-in. You must add [UseMiddleware] to enable it. If a middleware attribute is declared but not found at runtime, the request is denied by default.