LiteAPI.Core 1.1.1

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

🚀 LiteAPI

A minimal, dependency-free C# micro web framework for building lightweight REST APIs, dashboards, internal tools, and microservices without the complexity of heavy frameworks.


📦 Installation

Install via NuGet:

dotnet add package LiteAPI.Core --version 1.1.0

Or via Package Manager:

Install-Package LiteAPI.Core -Version 1.1.0

Ready for .NET 6, 7, 8 LTS.


✨ Features

Zero dependencies – fully standalone, tiny, fast.

JSON + text responses out of the box.

Lightweight DI container (Singleton, Scoped, Transient).

Signature-based routing with parameter extraction.

Automatic model binding:

  • [FromBody], [FromForm], [FromQuery], [FromRoute].

Async/await handler support.

Middleware pipeline (app.UseLogging(), app.UseCors(), etc).

Authentication & Authorization:

  • API Key, Bearer Token auth.
  • Policy and role-based route protection.

Route grouping for modular structure.

Static file serving (app.MapStaticFiles()).

Optional OpenAPI (Swagger) generation for testing endpoints.

Launch browser on startup for local dashboards.

Clean, readable structure with intuitive extension methods.

No black-box magic, easy to learn and extend.


🚀 Quick Example

using LiteAPI;

var builder = LiteWebApplication.CreateBuilder(args);
builder.Configure<MyConfiguration>();

builder.AddAuthentication(auth =>
{
    auth.DefaultScheme = AuthScheme.Bearer;
    auth.ValidateBearerToken = token => token == "secret-token";
});

builder.AddAuthorization(authz =>
{
    authz.AddPolicy("AdminOnly", ctx =>
        ctx.Headers.TryGetValue("X-Role", out var role) && role == "Admin");
});

var app = builder.Build();
app.UseLogging();
app.UseAuthentication();
app.UseAuthorization();

app.Get("/", ctx => Response.Ok("Welcome to LiteAPI 🚀"));

app.Get("/api/users/{id}", (HttpListenerRequest req, [FromRoute] int id) =>
{
    var userService = req.GetService<UserService>();
    var user = userService.GetById(id);
    return user != null ? Response.OkJson(user) : Response.NotFound();
}).RequireRoles("Admin");

app.Post("/api/users", (HttpListenerRequest req, [FromBody] UserDto user) =>
{
    var userService = req.GetService<UserService>();
    var created = userService.Add(user);
    return Response.Created($"/api/users/{created.Id}", created);
});

app.Run();

🛠️ Advanced Usage

Dependency Injection:

builder.Services.AddSingleton<UserService>();

Query parsing:

app.Get("/api/items", (HttpListenerRequest req, [FromQuery] QueryParams query) =>
{
    var items = ItemService.GetPaged(query.Page, query.PageSize, query.Search);
    return Response.OkJson(items);
});

Route grouping:

app.MapGroup<UsersRoutes>("/api/users");

Middleware pipeline:

app.UseLogging();
app.UseCors();
app.UseExceptionHandling();

Async handlers:

app.Get("/delay", async ctx =>
{
    await Task.Delay(1000);
    return Response.Ok("Done!");
});

Static files:

app.MapStaticFiles();

OpenAPI (Swagger):

app.UseOpenApi();

🪐 Roadmap

✅ Middleware pipeline

✅ Auth & policy-based authorization

✅ OpenAPI (Swagger) support

✅ Route grouping & parameter binding

✅ Static file serving

✅ Async pipeline

✅ Lightweight DI

✅ Rate limiting middleware

Next planned:

  • Caching middleware.
  • Request validation extensions.
  • CLI scaffolding for generating LiteAPI projects quickly.

🤝 Contributing

Pull requests and discussions are welcome!

✅ Add examples

✅ Improve documentation

✅ Suggest advanced DI features


🪐 License

MIT License.


✉️ Contact

Author: @nbkabdulaxadov on Telegram

Email: nbkabdulakhadov@gmail.com


Start building clean, fast, lightweight APIs with LiteAPI today 🚀!


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
1.1.1 89 7/4/2025
1.1.0 91 7/4/2025
1.0.1 122 7/2/2025
1.0.0 120 7/2/2025