Skip to content

mberrishdev/HubDocs

Repository files navigation

🧭 HubDocs is a developer-friendly UI tool like Swagger, but for SignalR hubs — auto-discover your hubs, explore methods, invoke calls, and preview live client messages.

https://hubdocs.mberrishdev.me/

GitHub stars GitHub forks Open issues

HubDocs

NuGet License

HubDocs is a powerful tool for exploring and documenting SignalR hubs in your ASP.NET Core applications. It provides a beautiful, Swagger-like UI that automatically discovers and displays all your SignalR hubs and their methods.

Features

  • 🔍 Automatic Hub Discovery: Automatically finds all SignalR hubs in your application
  • 📝 Method Documentation: Shows method signatures, parameters, and return types
  • 🎨 Beautiful UI: Swagger-inspired dark theme interface
  • 🔌 Easy Integration: Simple setup with just a few lines of code
  • 📦 NuGet Package: Easy to install and use in any ASP.NET Core project
  • 📡 Live Client Logging: Displays real-time messages sent from server to clients via strongly-typed interfaces

🎥 Live Demo

HubDocs Demo

The HubDocs UI in action — exploring hubs, invoking methods, and seeing real-time client logs.


🖼️ Screenshots

HubDocs Screenshot 1
📌 SignalR Hub list

HubDocs Screenshot 2
🔍 Interactive method parameter inputs with \"Try it\" support

HubDocs Screenshot 4
📡 Live client method logging with JSON preview

HubDocs Screenshot 3
📭 No methods found — HubDocs will show helpful instructions if a hub is registered without a route.

🔍 What You Get

  • A dashboard of all registered hubs
  • Parameter-aware “Try It” method testers
  • Strongly-typed client method preview with JSON payloads
  • Live server → client message tracking

Installation

dotnet add package HubDocs

Quick Start

  1. Add HubDocs to your ASP.NET Core application:
using HubDocs;

var builder = WebApplication.CreateBuilder(args);
// ... your other configurations ...

var app = builder.Build();

//Configure and register hub
// Required for HubDocs - registers your hub and makes it discoverable
app.MapHubAndRegister<YourHub>("/hub");

// Configure HubDocs middleware
app.AddHubDocs();

// ... your other middleware configurations ...
  1. Access the HubDocs UI at /hubdocs/index.html or /hubdocs/ in your browser.

Example

public interface IChatClient
{
    Task ReceiveMessage(string user, string message);
    Task Connected(string connectionId);
}

public class ChatHub : Hub<IChatClient>
{
    public async Task SendMessage(string user, string message)
    {
        await Clients.All.ReceiveMessage(user, message);
    }

    public override async Task OnConnectedAsync()
    {
        await Clients.Caller.Connected(Context.ConnectionId);
    }
}

Note: To fully leverage HubDocs, your hubs should implement Hub<T> with a strongly-typed client interface (T) that defines the client-callable methods. HubDocs will automatically extract and render both hub and client method metadata in the UI.

HubDocs will automatically discover this hub and display:

  • The hub name and full type name
  • All public methods with their parameters and return types
  • A beautiful, interactive UI to explore the hub

Configuration

HubDocs is designed to work out of the box with minimal configuration. However, you can customize it by passing specific assemblies to scan:

app.MapHubAndRegister<ChatHub>("/hubs/chat");

app.AddHubDocs();

Contributing

We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Inspired by Swagger UI
  • Built with ASP.NET Core
  • Uses Tailwind CSS for styling

Support

If you find a bug or have a feature request, please open an issue.

Authors

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

About

https://hubdocs.mberrishdev.me/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published