Avenged.AspNetCore.HealthChecks.Typesense 1.0.0

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

Typesense Health Checks

A lightweight .NET health check extension for monitoring the availability of your Typesense service.

Easily integrate into ASP.NET Core Health Checks to ensure your Typesense instance is responsive and healthy.


โœจ Features

  • Adds a HealthCheck for Typesense using ASP.NET Core's health checks system.
  • Supports both synchronous and asynchronous client factories.
  • Uses ListKeys as a lightweight and reliable health probe.
  • Customizable name, failure status, tags, and timeout.
  • Compatible with Microsoft.Extensions.Diagnostics.HealthChecks.

๐Ÿ“ฆ Installation

Install via NuGet:

dotnet add package Avenged.AspNetCore.HealthChecks.Typesense

โš™๏ธ Requirements

  • .NET Standard 2.1 or .NET 6.0+
  • A configured ITypesenseClient (from Typesense.Net)
<PackageReference Include="Typesense.Net" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />

๐Ÿš€ Getting Started

1. Configure your ITypesenseClient

Register your ITypesenseClient using DI:

services.AddSingleton<ITypesenseClient>(_ =>
    new TypesenseClient(new Configuration
    {
        ApiKey = "your-api-key",
        Nodes = new[] { new Node("https", "localhost", "8108") },
        ConnectionTimeout = TimeSpan.FromSeconds(5)
    }));

2. Add the health check

You can add the health check using either the sync or async factory:

Option A: Using DI-registered client
services.AddHealthChecks()
        .AddTypesense();
Option B: Using a custom factory (sync)
services.AddHealthChecks()
        .AddTypesense(sp =>
        {
            var config = new Configuration { ApiKey = "...", Nodes = ... };
            return new TypesenseClient(config);
        });
Option C: Using a custom factory (async)
services.AddHealthChecks()
        .AddTypesense(async sp =>
        {
            await Task.Delay(100); // any async initialization
            return new TypesenseClient(new Configuration { ... });
        });

๐Ÿ” How It Works

  • TypesenseHealthCheck tries to list the API keys via ListKeys() to confirm the Typesense server is reachable and responsive.
  • The health check will return:
    • Healthy if the request completes successfully.
    • Unhealthy if any exception occurs (e.g., connection failure, timeout, auth error).

๐Ÿงช Example Use Case

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddHealthChecks()
                .AddTypesense();

var app = builder.Build();

app.MapHealthChecks("/health");

app.Run();

โš™๏ธ Customization

You can customize the health check registration:

services.AddHealthChecks()
        .AddTypesense(
            name: "typesense-api",
            failureStatus: HealthStatus.Degraded,
            tags: new[] { "search", "typesense" },
            timeout: TimeSpan.FromSeconds(3));

๐Ÿ“„ License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.

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 210 7/1/2025