Table of Contents

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();