Steel Documentation
Welcome to Steel, a high-performance HTTP router for Go that makes building APIs a joy. With automatic OpenAPI documentation, real-time WebSocket/SSE support, and comprehensive testing utilities, Steel helps you build robust APIs faster.
Why Steel?
Fast radix tree-based routing with zero allocations for parameter extraction
🚀High PerformanceGenerate complete OpenAPI 3.0 documentation from your handlers automatically
📚Automatic OpenAPIBuilt-in WebSocket and Server-Sent Events support with AsyncAPI documentation
🔌Real-time SupportOpinionated handlers with automatic parameter binding and validation
🎯Type-SafeComprehensive testing framework with request builders and assertions
🧪Testing UtilitiesFlexible middleware with built-in recovery, logging, and timeout support
⚡Middleware SystemQuick Example
Here’s a complete API server in just a few lines:
package main
import (
"fmt"
"log"
"net/http"
"github.com/xraph/steel"
)
type User struct {
ID int `json:"id" path:"id" description:"User ID"`
Name string `json:"name" query:"name" description:"User name"`
}
type UserResponse struct {
ID int `json:"id" description:"User ID"`
Name string `json:"name" description:"User name"`
Message string `json:"message" description:"Welcome message"`
}
func main() {
r := steel.NewRouter()
// Add middleware
r.Use(steel.Logger, steel.Recoverer)
// Opinionated handler with automatic OpenAPI generation
r.OpinionatedGET("/users/:id", func(ctx *steel.Context, req User) (*UserResponse, error) {
return &UserResponse{
ID: req.ID,
Name: req.Name,
Message: fmt.Sprintf("Welcome, %s!", req.Name),
}, nil
}, steel.WithSummary("Get User"), steel.WithTags("users"))
// Enable automatic OpenAPI documentation
r.EnableOpenAPI()
log.Println("Server starting on :8080")
log.Println("API docs available at http://localhost:8080/openapi/docs")
log.Fatal(http.ListenAndServe(":8080", r))
}Visit http://localhost:8080/openapi/docs to see your automatically generated API documentation!
Key Features
🏗️ Architecture Highlights
- Radix Tree Routing: Efficient O(log n) route matching
- Zero Allocations: Parameter extraction without memory allocations
- Reflection-Based Binding: Automatic request binding using Go reflection
- Real-time Documentation: OpenAPI and AsyncAPI specs generated on-the-fly
- Connection Management: Built-in WebSocket and SSE connection pooling
📊 Documentation Viewers
Steel supports multiple documentation viewers out of the box:
- Swagger UI - Interactive API documentation with try-it-out
- ReDoc - Beautiful, responsive documentation
- Scalar - Modern documentation with excellent UX
- Stoplight Elements - Comprehensive documentation platform
🔧 Developer Experience
- Type Safety: Full Go type system integration
- Error Handling: Rich error types with automatic documentation
- Testing: Built-in testing utilities and load testing
- Debugging: Route inspection and middleware debugging tools
- Hot Reload: Development server with automatic reloading
Getting Started
Ready to build your first API? Let’s get started!
Prerequisites: Go 1.24+ is required. Steel takes advantage of the latest Go features for optimal performance.
- Install Steel
go get github.com/xraph/steel-
Follow the Getting Started Guide
-
Explore Examples
-
Read the API Reference
Community & Support
Ready to forge your next API? Let’s dive into the Getting Started Guide!