Lyra 0.0.1

dotnet add package Lyra --version 0.0.1
                    
NuGet\Install-Package Lyra -Version 0.0.1
                    
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="Lyra" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyra" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Lyra" />
                    
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 Lyra --version 0.0.1
                    
#r "nuget: Lyra, 0.0.1"
                    
#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 Lyra@0.0.1
                    
#: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=Lyra&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Lyra&version=0.0.1
                    
Install as a Cake Tool

🌟 Lyra - Lightweight, AOT-Ready Web API Framework for .NET

Lyra is a minimal, fast, and AOT-friendly web API framework for C#. Inspired by Express.js, it’s designed for microservices, internal tools, and self-hosted apps that need performance without the bloat.

βœ… Express-like routing and middleware β€” in pure C#
βœ… Self-hosted with HttpListener β€” no Kestrel or ASP.NET
βœ… AOT-friendly JSON binding β€” works with source generators
βœ… Lightweight and composable β€” just one DLL and you're ready

πŸš€ Why Lyra?

Feature Lyra ASP.NET Minimal API Express.js
Lightweight & self-hosted βœ”οΈ ❌ (Kestrel) βœ”οΈ
AOT-friendly (no reflection) βœ”οΈ ⚠️ Partial ❌
Express-like simplicity βœ”οΈ ❌ βœ”οΈ
Minimal dependencies βœ”οΈ ❌ βœ”οΈ
Good for internal tools/CLI βœ”οΈ ❌ βœ”οΈ

πŸš€ Get Started Instantly

You don’t need a package. Just clone the repo and run a sample:

git clone https://github.com/syanmi/Lyra.git
cd Lyra/sandbox/LyraSampleApp/
start /b dotnet run
curl http://localhost:8080/hello

Or create a simple app like this:

var app = new LyraApp();

app.Get("/hello", ctx => LyraResult.Text("Hello from Lyra!"));

await app.RunAsync();
  • No NuGet installation needed
  • No build templates or scaffolding tools
  • Just C# and .NET β€” ready to go

🧬 AOT-Ready JSON Binding

app.UseJsonContext(MyJsonContext.Default);

[JsonSerializable(typeof(MyRequest))]
public partial class MyJsonContext : JsonSerializerContext {}
  • Uses System.Text.Json source generators
  • Reflection-free & trimming-friendly
  • Ideal for native AOT builds

🧱 Middleware and SubApps

var sub = new LyraApp();
sub.Get("/hi", ctx => LyraResult.Text("Hello from SubApp!"));

app.Use(async (ctx, next) =>
{
    Console.WriteLine("Before SubApp");
    await next();
});

app.Map("/sub", sub);
  • Compose multiple apps like Express's app.use('/path', sub)
  • Build modular and reusable APIs

πŸ“‚ Static File Serving (🚧coming soon)

app.UseStaticFiles("wwwroot");
  • Serve static files for admin tools or dashboards

πŸ“¦ Current Features

Feature Status
GET/POST Routing βœ…
Path Parameters βœ…
JSON Binding (AOT) βœ…
Middleware βœ…
SubApps βœ…
Static Files 🚧 (coming soon)
CLI Integration 🚧 (coming soon)
NuGet Package 🚧 (planned for v1.0)

πŸ“Œ Roadmap

Version Features
v0.1 Basic routing, responses
v0.2 Path params, body reader
v0.3 ReadBodyAsync<T>() with AOT-ready JSON
v0.4 Middleware, subapps
v0.5 static files
v1.0 Logging, CORS, file download, CLI scaffolding

CLI tools (dotnet new lyra) and NuGet packaging are planned for v1.0


πŸ“„ License

MIT License.
Contributions welcome!

⭐ Like Lyra?

If Lyra helps you build faster and smaller .NET apps, a ⭐ would mean a lot!

βœ… Summary

Lyra is for developers who want:

  • Fast startup and small output size
  • Native AOT-ready web APIs
  • Express-like simplicity in C#
  • No heavy dependencies or runtime costs
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.
  • net8.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
0.0.1 173 6/19/2025