Scalar Consoles
Bielu.AspNetCore.AsyncApi integrates with Scalar to provide a modern, interactive documentation UI. Additionally, we provide companion packages that inject live, invocable consoles into the Scalar reference.
Basic Scalar Integration
Install the Scalar.AspNetCore package and point it at the AsyncAPI document generated by this library.
dotnet add package Scalar.AspNetCore
app.MapAsyncApi();
app.MapScalarApiReference(options =>
{
options.AddAsyncApiDocument("v1", "My API", "/asyncapi/v1.json");
});
SignalR Console
The Bielu.AspNetCore.AsyncApi.Scalar.SignalR package adds a live console that allows you to connect to hubs, invoke client-to-server methods, and watch server-to-client events.
Installation
dotnet add package Bielu.AspNetCore.AsyncApi.Scalar.SignalR
Usage
app.MapScalarSignalRAssets(); // Serves the console bundle
app.MapScalarApiReference(options =>
{
options.AddAsyncApiDocument("v1", "Chat", "/asyncapi/v1.json");
options.WithSignalRClient(); // Injects the console into Scalar
});
gRPC Console
The Bielu.AspNetCore.AsyncApi.Scalar.Grpc package adds a console for invoking unary and server-streaming gRPC methods over gRPC-Web.
Installation
dotnet add package Bielu.AspNetCore.AsyncApi.Scalar.Grpc
Usage
app.UseGrpcWeb(new GrpcWebOptions { DefaultEnabled = true }); // From Grpc.AspNetCore.Web
app.MapGrpcService<GreeterService>();
app.MapScalarGrpcAssets(); // Serves the console bundle and descriptors
app.MapScalarApiReference(options =>
{
options.AddAsyncApiDocument("v1", "Greeter", "/asyncapi/v1.json");
options.WithGrpcClient(); // Injects the console into Scalar
});
.NET Aspire Support
For .NET Aspire applications, use the .Aspire companion packages to enable these consoles in the Scalar resource.
dotnet add package Bielu.AspNetCore.AsyncApi.Scalar.SignalR.Aspire
dotnet add package Bielu.AspNetCore.AsyncApi.Scalar.Grpc.Aspire
In your AppHost:
var api = builder.AddProject<Projects.MyApi>("api");
builder.AddScalar("scalar")
.WithSignalRClient()
.WithGrpcClient();
Each console registers itself through Scalar's PluginUrls option, which loads the plugin as an ES
module before the API Reference mounts. The Scalar container keeps its own bundle — only the plugin is
added — so both consoles can be enabled on the same resource, and they stay compatible with whatever
Scalar version the container ships.
By default each console loads the plugin module published alongside this package, pinned to an exact version on jsDelivr:
https://cdn.jsdelivr.net/npm/@bielu/scalar-signalr@<version>/dist/scalar-plugin.mjs
Pass your own URL to load the plugin from somewhere else — a private registry, or a copy you host yourself:
builder.AddScalar("scalar")
.WithSignalRClient(pluginUrl: "https://cdn.example.com/scalar-signalr/scalar-plugin.mjs");
The URL must point at dist/scalar-plugin.mjs, the ES module whose default export is the plugin.
The package's other build outputs are not interchangeable: dist/plugin.js is a <script> bundle that
installs itself by hooking window.Scalar, and dist/standalone.js bundles Scalar itself.
By default the consoles discover AsyncAPI documents from the Scalar configuration they are rendered with. To name them explicitly:
builder.AddScalar("scalar")
.WithGrpcClient(options => options.AddDocument("grpc", "https://api.example.com/asyncapi/grpc.json"));
Those URLs are resolved by the browser, so they must be reachable from the Scalar page's origin — not just from inside the Aspire network.