SwrSharp

SwrSharp

Powerful asynchronous state management, server-state utilities and data fetching for .NET

Tinkered to work with Blazor, Avalonia, MAUI, and any .NET application

Program.cs
var result = UseQuery(
    key: "todos",
    fetcher: async () =>
    {
        var response = await httpClient.GetAsync("/api/todos");
        return await response.Content
            .ReadFromJsonAsync<List<Todo>>();
    }
);

Why SwrSharp?

Make fetching, caching, synchronizing and updating server state in your .NET applications a breeze.

Declarative & Automatic

Automatic background refetching, request deduplication, and stale-while-revalidate out of the box.

Multi-Platform

Works with Blazor, Avalonia, MAUI, and any .NET client. One library, every platform.

Smart Caching

Intelligent cache management with configurable stale times, garbage collection, and cache invalidation.

Type-Safe

Full C# type safety with generics throughout. Catch errors at compile time, not runtime.

Network Resilient

Automatic retries with exponential backoff, offline support, and configurable network modes.

Lightweight

Zero dependencies beyond .NET standard libraries. Small footprint, big impact.