$ show servicetitan/Stl.Fusion
Stl.Fusion is a high-performance .NET framework for building real-time, distributed, and stateful applications. It implements a Distributed REAactive Memoization (DREAM) pattern, where computed values automatically track their dependencies and invalidate when those dependencies change. This enables transparent caching, automatic UI updates, and efficient client-server state synchronization without manual cache management. The framework is architected as a layered set of libraries: Stl (base utilities), Stl.Interception (AOP proxy generation), Stl.CommandR (CQRS command pipeline), Stl.Rpc (full-duplex RPC with WebSocket transport), Stl.Fusion (core compute engine with states and operations), Stl.Fusion.Server (ASP.NET Core integration), Stl.Fusion.Blazor (Blazor components), and Stl.Fusion.EntityFramework (EF Core integration with operation log change tracking). It also includes Redis integration for pub/sub and caching, and a Roslyn source generator for proxy types. The framework is designed for Blazor Server and WebAssembly, microservices, and any .NET application requiring real-time reactivity. It provides extensive test coverage, performance benchmarks showing orders-of-magnitude improvements over traditional caching, and sample applications (TodoApp, HelloCart) demonstrating end-to-end usage.
The LLM identified 5 files worth highlighting for reuse:
A memory-efficient set implementation for up to 3 elements that avoids heap allocation entirely by storing elements in inline fields. When the set exceeds 3 elements, it gracefully degrades to a standard HashSet<T>. This pattern is reusable in any performance-critical .NET code that frequently works with small collections, such as tracking dependencies or temporary state. It demonstrates non-obvious skill in micro-optimization and struct-based data structures.
An async-compatible lock with configurable reentry modes (Unchecked, CheckedFail, CheckedPass). It uses a SemaphoreSlim internally and supports cancellation, timeouts, and async disposal. The lock is thread-safe and can be used in high-concurrency scenarios. This component is self-contained and can be extracted into any .NET project requiring async mutual exclusion with reentrancy control.
A configurable sequence of retry delays supporting linear, exponential, and constant backoff strategies with optional random spread. It is used by the framework's retry infrastructure but is a standalone utility that can be reused in any .NET application needing retry logic. The implementation is clean, well-documented, and demonstrates proper handling of time calculations and randomness.
A byte serializer that wraps another serializer and adds type discrimination by prepending type information. It enables polymorphic serialization without requiring the underlying serializer to support it. This pattern is reusable for any .NET project that needs to serialize objects of unknown types across boundaries (e.g., RPC, caching). The implementation is clean, with proper handling of type resolution and fallback.
Implements a bidirectional streaming protocol with acknowledgment and sliding-window flow control over RPC. It supports polymorphic items, missing-position detection, error signaling, and single-enumeration enforcement. This component is a sophisticated, self-contained streaming abstraction that could be extracted for use in any .NET RPC or messaging system requiring reliable, ordered streaming with backpressure.