RedisUI.Dashboard 2.2.1

Suggested Alternatives

RedisUI.Dashboard 2.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RedisUI.Dashboard --version 2.2.1
                    
NuGet\Install-Package RedisUI.Dashboard -Version 2.2.1
                    
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="RedisUI.Dashboard" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RedisUI.Dashboard" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="RedisUI.Dashboard" />
                    
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 RedisUI.Dashboard --version 2.2.1
                    
#r "nuget: RedisUI.Dashboard, 2.2.1"
                    
#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 RedisUI.Dashboard@2.2.1
                    
#: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=RedisUI.Dashboard&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=RedisUI.Dashboard&version=2.2.1
                    
Install as a Cake Tool

RedisUI.Dashboard

A modern Redis UI for ASP.NET Core with enhanced features, built as a fork of RedisUI.

NuGet Codacy Badge


πŸ”₯ What’s New in RedisUI.Dashboard

This fork includes major improvements over the original RedisUI:

  • βœ… Support for Redis data types: Stream, Sorted Set, Hash, List, Set, String.
  • βœ… Error prevention: Null-safe resolution to prevent NullReferenceException.
  • βœ… Monokai-highlighted JSON: Key values rendered as readable formatted JSON.
  • βœ… UI and performance upgrades:
    • Redesigned layout and styles
    • SCAN cursor enhancements
    • Async parallel Redis key & stat resolution
  • βœ… Middleware refactor: Clearer API with overloads instead of optional params.
  • βœ… .NET 9 support: Added to TargetFrameworks.
  • Extras

πŸš€ Installation

Install via NuGet:

dotnet add package RedisUI.Dashboard

πŸ”§ Recent Enhancements by @frankyjquintero

This project has undergone several significant improvements to enhance functionality, robustness, and forward compatibility. Notable changes include:

  • βœ… Support for additional Redis data types: Stream, Sorted Set, Hash, and more are now properly rendered, enabling a complete view of Redis contents regardless of type.
  • βœ… Error prevention enhancements: Added null-safety guards and robust checks to prevent potential NullReferenceException issues identified via static analysis tools.
  • βœ… Cleaner JSON handling: Redis key values are now intelligently parsed into JSON with Monokai syntax highlighting, making complex structures easier to inspect and debug.
  • βœ… Improved UI stability and experience: Reorganized HTML layout with Bootstrap 5.3, cleaned JS logic, and improved key loading via cursor-based SCAN to support large datasets.
  • βœ… Optimized performance: Implemented async parallel processing for Redis INFO and key type/value resolution, along with a singleton-managed ConnectionMultiplexer.
  • βœ… Simplified middleware API: Refactored core middleware components (RedisUIMiddleware, RedisKeyValueResolver) and transitioned from optional parameters to clearer overloads for maintainability.
  • βœ… Extended .NET support: Added multi-target support for .NET 6, 7, 8, and 9 for wider compatibility and future readiness.
  • βœ… Authorization filters added: Introduced pluggable security options including Basic Auth, JWT Role, Claim-based, IP Whitelisting, and environment-based access control.
  • βœ… Dashboard path customization: You can now configure the Redis UI path, enabling cleaner route separation (e.g., /redis-admin).
  • βœ… Package metadata improvements: Updated NuGet packaging details (license, readme, tags, project URL) for better discoverability and transparency.
  • βœ… Redis key explorer UI improvements: TreeView redesigned for flat mode, zebra-style list groups, expandable folders, delete buttons, and TTL/size display.

These improvements aim to modernize and stabilize the RedisUI integration, making it more production-ready and developer-friendly.

πŸ”§ Custom JS and CSS for RedisUI Viewer

You can customize the appearance and behavior of the Redis UI by providing your own JavaScript and CSS files. This is useful if you want to use local versions of Bootstrap, syntax highlighters, or JSON viewers.

Example

app.UseRedisUI(new RedisUISettings
{
    CssLink = "/assets/css/bootstrap.min.css",
    JsLink = "/assets/js/bootstrap.bundle.min.js",
    HighlightTheme = "/assets/css/highlight-dark.css",
    HighlightJs = "/assets/js/highlight.min.js",
    HighlightJson = "/assets/js/json-viewer.js"
});

πŸ” Dashboard Authorization Filters

You can protect the Redis dashboard endpoint using different types of authorization filters by configuring the CacheOptions:Dashboard section in your appsettings.json.

πŸ“† Supported Authentication Modes

Mode Description
basic Uses HTTP Basic Auth with username/password.
jwt Requires the user to have a specific role from a JWT token.
claim Requires a specific claim (type + value) to be present in the user token.
ip Restricts access to specific IP addresses.
env Allows access only in Development or Staging environments.

βš™οΈ Example Configuration (appsettings.json)

βœ… Basic Auth
"CacheOptions": {
  "Provider": "Redis",
  "RedisConnection": "localhost:6379",
  "Dashboard": {
    "Enabled": true,
    "Path": "/redis-admin",
    "AuthenticationMode": "basic",
    "Username": "admin",
    "Password": "secret"
  }
}
βœ… Claim-based Authorization
"Dashboard": {
  "Enabled": true,
  "AuthenticationMode": "claim",
  "ClaimType": "role",
  "ClaimValue": "Admin"
}
βœ… IP Whitelist
"Dashboard": {
  "Enabled": true,
  "AuthenticationMode": "ip",
  "AllowedIps": [ "127.0.0.1", "::1", "192.168.0.100" ]
}
βœ… JWT Role Check
"Dashboard": {
  "Enabled": true,
  "AuthenticationMode": "jwt",
  "Role": "Administrator"
}
βœ… Environment-based (Dev/Staging only)
"Dashboard": {
  "Enabled": true,
  "AuthenticationMode": "env"
}

🧩 Custom Filter Injection

If you want to plug in a fully custom implementation, you can manually assign your own IRedisAuthorizationFilter in Program.cs:

app.UseRedisUI(new RedisUISettings
{
    Path = "/redis-admin",
    AuthorizationFilter = new MyCustomRedisAuthFilter()
});

🌐 Authorization Filter Factory (Automatic Selection)

To make filter setup easier and based on configuration, you can use the built-in factory to instantiate the correct filter automatically:

public static class DashboardAuthorizationFactory
{
    public static IRedisAuthorizationFilter Create(CacheDashboardOptions options, IWebHostEnvironment env)
    {
        return options.AuthenticationMode?.ToLower() switch
        {
            "basic" => new DashboardBasicAuthorizationFilter(options.Username, options.Password),
            "jwt"   => new DashboardJwtAuthorizationFilter(options.Role),
            "claim" => new DashboardClaimAuthorizationFilter(options.ClaimType, options.ClaimValue),
            "ip"    => new DashboardIpWhitelistAuthorizationFilter(options.AllowedIps),
            "env"   => new DashboardEnvironmentAuthorizationFilter(env),
            _       => new DashboardBasicAuthorizationFilter(options.Username, options.Password)
        };
    }
}

Usage inside UseCacheDashboard extension:

public static IApplicationBuilder UseCacheDashboard(this IApplicationBuilder app, IConfiguration configuration)
{
    var options = configuration.GetSection("CacheOptions").Get<CacheOptions>();

    if (options is { Provider: "Redis", Dashboard.Enabled: true })
    {
        var env = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>();

        app.UseRedisUI(new RedisUISettings
        {
            Path = options.Dashboard.Path,
            ConnectionString = options.RedisConnection,
            AuthorizationFilter = DashboardAuthorizationFactory.Create(options.Dashboard, env)
        });
    }

    return app;
}

Extra: Example mapping CacheOptions

using System.Globalization;

public class CacheOptions : IAppOptions
{
    public string Provider { get; set; } = "Redis";
    public string RedisConnection { get; set; } = string.Empty;
    public string SqlConnection { get; set; } = string.Empty;
    public string Prefix { get; set; } = string.Empty;
    public Dictionary<string, string> ExpirationTimes { get; set; } = new();
    public CacheDashboardOptions Dashboard { get; set; } = new();

    public TimeSpan GetExpiration(string key)
    {
        key = key.Replace(":", "__");
        return ExpirationTimes.TryGetValue(key, out var value) && 
               TimeSpan.TryParse(value, CultureInfo.InvariantCulture, out var timeSpan)
            ? timeSpan
            : TimeSpan.FromMinutes(30);
    }
}

public class CacheDashboardOptions
{
    public bool Enabled { get; set; } = false;
    public string Path { get; set; } = "/redis-admin";
    public string Role { get; set; } = "Admin";
    public string Username { get; set; } = "admin";
    public string Password { get; set; } = "secret";
    public string AuthenticationMode { get; set; } = "basic"; // basic, jwt, claim, ip, env
    public string ClaimType { get; set; } = string.Empty;
    public string ClaimValue { get; set; } = string.Empty;
    public List<string> AllowedIps { get; set; } = new();
}

Extra: Example auto register Options:


public static IServiceCollection AddAllConfigurations(this IServiceCollection services, IConfiguration configuration)
{
    var assembly = typeof(IAppOptions).Assembly;

    var optionsTypes = assembly.GetTypes()
        .Where(t => typeof(IAppOptions).IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);

    foreach (var type in optionsTypes)
    {
        var method = typeof(OptionsConfigurationServiceCollectionExtensions)
            .GetMethods(BindingFlags.Static | BindingFlags.Public)
            .First(m => m.Name == "Configure" && m.GetParameters().Length == 2)
            .MakeGenericMethod(type);

        method.Invoke(null, new object[] { services, configuration.GetSection(type.Name) });
    }

    return services;
}

These filters give you flexibility to secure your Redis UI in the way that best matches your application's security model.

UI image image

Server Statistics image

πŸ‘‰ You can review the updated source and commits at github.com/frankyjquintero/RedisUI

Redis Integrated UI

NuGet Codacy Badge

Redis Integrated UI is a .NET project designed to simplify the integration of a Redis User Interface (UI) page into your web applications. With this project, users can easily incorporate a Redis UI page, enabling them to interact with Redis keys and view Redis server statistics seamlessly.

Features

  • Integration Ease: Simplifies the process of integrating a Redis UI page into web applications.

  • Redis Key Management: Provides functionality to interact with Redis keys conveniently.

    image

  • Server Statistics: Displays statistics related to the Redis server for monitoring and analysis purposes.

    image

Getting Started

To integrate the Redis UI into your application, follow these steps:

  • Install RedisUI from the NuGet Gallery.
PM> Install-Package RedisUI
  • Add the middleware to your project.
using RedisUI;

app.UseRedisUI();
  • Run your project and browse /redis path. easy peasy!

Settings

  • The Path is "/redis" by default, set a new path.
app.UseRedisUI(new RedisUISettings
{
    Path = "/myredisui",
});
  • The ConnectionString is "localhost" by default, set the connection string.
app.UseRedisUI(new RedisUISettings
{
    ConnectionString = "1.1.1.1:6379",
});
  • Use ConfigurationOptions for detailed settings.
ConfigurationOptions options = new ConfigurationOptions
{
    EndPoints = { { "my-redis.cloud.redislabs.com", 6379 } },
    User = "default",  // use your Redis user. More info https://redis.io/docs/management/security/acl/
    Password = "secret", // use your Redis password
    Ssl = true,
    SslProtocols = System.Security.Authentication.SslProtocols.Tls12                
};
app.UseRedisUI(new RedisUISettings
{
    ConfigurationOptions = options
});
  • The UI is using Bootstrap 5.3.2 version from CDN, you can get it from locally via setting properties below:
app.UseRedisUI(new RedisUISettings
{
    CssLink = "..\\mypath\\bootstrap.min.cs",
    JsLink = "..\\mypath\\bootstrap.js"
});

Authorization

You can limit access to Redis data in the production environment.

  • Add a new authorization filter and implement IRedisAuthorizationFilter
using RedisUI;

public class MyAuthorizationFilter : IRedisAuthorizationFilter
{
    private readonly bool _isDevelopment;

    public MyAuthorizationFilter(bool isDevelopment)
    {
        _isDevelopment = isDevelopment;
    }

    public bool Authorize(HttpContext context)
    {
        return _isDevelopment || (context.User.Identity != null && context.User.Identity.IsAuthenticated);
    }
}
app.UseRedisUI(new RedisUISettings
{
    AuthorizationFilter = new MyAuthorizationFilter(app.Environment.IsDevelopment())
});

Contributing

Contributions are welcome! If you'd like to contribute to Redis Integrated UI, please follow these guidelines:

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License.

Contact

For any inquiries or support regarding Redis Integrated UI, feel free to contact the project maintainer:

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 is compatible.  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 is compatible.  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 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on RedisUI.Dashboard:

Package Downloads
Franky.Core.Infrastructure

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

βœ… Added support for Redis data types (Stream, Sorted Set, Hash)
βœ… Improved null-safety to prevent NullReferenceException
βœ… Enhanced JSON key inspection with Monokai highlighting
βœ… Refactored UI rendering and JS cleanup (SCAN optimized)
βœ… Async parallel performance for Redis stats and key resolution
βœ… Middleware API improvements with overloads instead of optionals
βœ… Extended support to .NET 9 in TargetFrameworks
βœ… Dashboard Authorization Filters
βœ… Added RedisUISettings for configuration jsonEditor, highlight.js, and Bootstrap links
βœ… Added BuildTreeView, colored cells, and improved key rendering