Kestrun 1.0.0-alpha.3

This is a prerelease version of Kestrun.
dotnet add package Kestrun --version 1.0.0-alpha.3
                    
NuGet\Install-Package Kestrun -Version 1.0.0-alpha.3
                    
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="Kestrun" Version="1.0.0-alpha.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kestrun" Version="1.0.0-alpha.3" />
                    
Directory.Packages.props
<PackageReference Include="Kestrun" />
                    
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 Kestrun --version 1.0.0-alpha.3
                    
#r "nuget: Kestrun, 1.0.0-alpha.3"
                    
#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 Kestrun@1.0.0-alpha.3
                    
#: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=Kestrun&version=1.0.0-alpha.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Kestrun&version=1.0.0-alpha.3&prerelease
                    
Install as a Cake Tool
██╗  ██╗███████╗███████╗████████╗██████╗ ██╗   ██╗███╗   ██╗
██║ ██╔╝██╔════╝██╔════╝╚══██╔══╝██╔══██╗██║   ██║████╗  ██║
█████╔╝ █████╗  ███████╗   ██║   ██████╔╝██║   ██║██╔██╗ ██║
██╔═██╗ ██╔══╝  ╚════██║   ██║   ██╔██╗  ██║   ██║██║╚██╗██║
██║  ██╗███████╗███████║   ██║   ██║ ██╗ ╚██████╔╝██║ ╚████║
╚═╝  ╚═╝╚══════╝╚══════╝   ╚═╝   ╚═╝ ╚═╝  ╚═════╝ ╚═╝  ╚═══╝
Kestrun — PowerShell brains. Kestrel speed.

CI CodeQL ClamAV Scan

CodeFactor Coveralls Badge Coverage Status

Linux macOS Windows

x64 Arm64

.NET 8 .NET 9 PowerShell 7.4 PowerShell 7.5 PowerShell 7.6

License: MIT Contributions Releases

Docs NuGet PowerShell Gallery

Kestrun is a hybrid web framework that combines the speed and scalability of ASP.NET Core (Kestrel) with the flexibility and scripting power of PowerShell. It enables you to build web APIs, automation endpoints, and dynamic services using both C# and PowerShell in a single, integrated environment.

Rich Documentation and Tutorial

Full documentation and tutorial for Kestrun is available online at docs.kestrun.dev. You can find guides, API references, and usage examples to help you get started and explore advanced features.

Core Capabilities

  • 🚀 Fast, cross-platform web server Powered by ASP.NET Core (Kestrel) with full access to advanced HTTP/2, header compression, and TLS options.

  • 🐚 Native PowerShell integration Routes can be backed by PowerShell scripts with isolated, pooled runspaces and dynamic $Context.Request / $Context.Response variables.

  • 🧠 Multi-language script routing Register HTTP routes using:

    • 🐚 PowerShell For Building:

    • .NET 8 SDK AND .NET 9 SDK (solution multi-targets net8.0 + net9.0)

    • PowerShell 7.4+ (7.4 / 7.5 run on .NET 8; 7.6 preview runs on .NET 9)

    • Invoke-Build and Pester PowerShell modules:

    Install-PSResource -Name 'InvokeBuild','Pester' -Scope CurrentUser
    

    For Runtime (Run Only):

    If you're only running Kestrun apps (not building from source), install the ASP.NET Core Runtime matching the PowerShell version you are using:

    PowerShell Version Install (Run-only) Rationale
    7.4 / 7.5 .NET 8 ASP.NET Core Runtime Bundles Microsoft.NETCore.App + Microsoft.AspNetCore.App 8.x
    7.6 (preview) .NET 9 ASP.NET Core Runtime Preview runtime aligning with PS 7.6 build

    Installing the .NET SDK already gives you the corresponding runtimes. For run-only scenarios the ASP.NET Core Runtime alone is sufficient (it includes the base .NET runtime).

    Download PowerShell from the official PowerShell Releases.

    Verify installation

    # List SDKs (expect 8.x and 9.x if building from source)
    dotnet --list-sdks
    
    # List runtimes (look for Microsoft.NETCore.App and Microsoft.AspNetCore.App)
    dotnet --list-runtimes | Where-Object { $_ -match 'Microsoft.(AspNetCore|NETCore).App' }
    

    Expected (abbreviated):

    Microsoft.NETCore.App 8.0.x
    Microsoft.AspNetCore.App 8.0.x
    Microsoft.NETCore.App 9.0.x
    Microsoft.AspNetCore.App 9.0.x
    

    If something is missing, install the matching ASP.NET Core Runtime from the download links above.

    Build & Run

    Clone the repository:

    git clone https://github.com/Kestrun/Kestrun.git
    cd Kestrun
    
  • 🛠️ CI/CD ready

    • Build- and run-time configurable
    • Works in containerized / headless environments
    • Supports Dev/Prod fallback module path detection
  • 🛡️ Optional Add-ons Add via fluent extensions:

    • AddAntiforgery() middleware
    • AddStaticFiles(), AddDefaultFiles(), AddFileServer()
    • AddCors(policy) or AddCorsAllowAll()
    • AddSignalR<T>() for real-time hubs
    • AddAuthentication() with multiple schemes (Windows, Basic, JWT, Certificate, etc.)
    • Ready for Swagger, gRPC, custom middleware hooks
  • ⚡ Task Scheduling & Background Jobs

    • Cron-based scheduling: Full cron expression support via Cronos
    • Multi-language job support: Schedule PowerShell, C#, and VB.NET scripts as background jobs
    • Job management: Start, stop, and monitor scheduled tasks with detailed logging

Deployment & Extensibility

This section summarizes extension capabilities (see earlier sections for build & run instructions).

Using the PowerShell Module

Import the module (from source):

Import-Module ./src/PowerShell/Kestrun/Kestrun.psm1

Running Tests

The project includes an Invoke-Build script that automatically handles both C# (xUnit) and PowerShell (Pester) tests:

Invoke-Build Test

Manual Test Execution

C# Tests
Invoke-Build Kestrun.Tests
PowerShell Tests
Invoke-Build Test-Pester

Documentation and Tutorial

Kestrun docs are built with Just-the-Docs. All new documentation must be compatible (front matter, parent, nav_order, etc.).

See docs/ for structure.

Project Structure

  • src/CSharp/ — C# core libraries and web server
    • Kestrun/Authentication — authentication handlers and schemes
    • Kestrun/Certificates — certificate management utilities
    • Kestrun/Hosting — host configuration and extensions
    • Kestrun/Languages — multi-language scripting support (C#, VB.NET, etc.)
    • Kestrun/Logging — Serilog integration and logging helpers
    • Kestrun/Middleware — custom middleware components
    • Kestrun/Models — request/response classes and data models
    • Kestrun/Razor — Razor Pages integration with PowerShell
    • Kestrun/Scheduling — task scheduling and background job support
    • Kestrun/Scripting — script execution and validation
    • Kestrun/Security — security utilities and helpers
    • Kestrun/SharedState — thread-safe global state management
    • Kestrun/Utilities — shared utility functions
  • src/PowerShell/ — PowerShell module and scripts
  • examples/ — Example projects and demonstrations
    • CSharp/Authentication — authentication examples
    • CSharp/Certificates — certificate usage examples
    • CSharp/HtmlTemplate — HTML templating examples
    • CSharp/MultiRoutes — multi-route examples
    • CSharp/RazorSample — Razor Pages examples
    • CSharp/Scheduling — task scheduling examples
    • CSharp/SharedState — shared state examples
    • PowerShell/ — PowerShell examples
    • Files/ — test files and resources
  • tests/ — Test projects (C#, PowerShell)
  • docs/ — Documentation files (Just-the-Docs)
  • Utility/ — Build and maintenance scripts
  • .github/ — GitHub Actions workflows
  • Lint/ — Code analysis rules

Contributing

Contributions of all sizes are welcome — from docs improvements to new feature modules. See CONTRIBUTING.md and the online guide at https://docs.kestrun.dev/contributing.

License

Licensed under the MIT License. See LICENSE.

Acknowledgements

Documentation

Code Quality

AI Assistance

  • ChatGPT for conversational AI support
  • Copilot for AI-powered code suggestions

Collaboration and Version Control

Scripting and Automation

  • PowerShell for scripting and automation
  • .NET for the underlying framework
  • Pester for PowerShell testing
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 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.

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.0.0-alpha.3 244 9/16/2025
1.0.0-alpha.2 89 9/5/2025