High-Performance Go Web Framework
Blazing fast routing, minimal dependencies, and everything you need to build modern web applications.
go get github.com/ch-hash-lab/rue
Radix tree-based routing with ~8ns static route matching and zero allocations.
Logger, Recovery, CORS, Rate Limiter, JWT, API Key authentication built-in.
JSON, XML, Form, Query binding with powerful struct validation.
Full RFC 6455 implementation with Hub for broadcasting.
Server-Sent Events and GraphQL with built-in Playground UI.
Next-generation protocol support via quic-go.
Seamless gRPC support with middleware adapter.
Gzip and Brotli with automatic content negotiation.
package main
import (
"net/http"
"github.com/ch-hash-lab/rue"
)
func main() {
r := rue.Default()
r.GET("/", func(c *rue.Context) {
c.JSON(http.StatusOK, rue.H{"message": "Hello, Rue!"})
})
r.GET("/users/:id", func(c *rue.Context) {
c.JSON(http.StatusOK, rue.H{"user_id": c.Param("id")})
})
r.Run(":8080")
}
package main
import (
"github.com/ch-hash-lab/rue"
)
func main() {
r := rue.New()
// Built-in middleware
r.Use(rue.Logger())
r.Use(rue.Recovery())
r.Use(rue.CORS())
r.Use(rue.RateLimiter(100, 200))
r.Use(rue.Compress())
// JWT protected routes
api := r.Group("/api")
api.Use(rue.JWT([]byte("secret")))
{
api.GET("/profile", getProfile)
}
r.Run(":8080")
}
package main
import "github.com/ch-hash-lab/rue"
func main() {
r := rue.Default()
hub := rue.NewWebSocketHub()
go hub.Run()
r.GET("/ws", func(c *rue.Context) {
handler := &rue.WebSocketHandler{
Hub: hub,
OnMessage: func(conn *rue.WebSocketConn, t int, data []byte) {
hub.Broadcast(t, data)
},
}
handler.Handle(c)
})
r.Run(":8080")
}
package main
import "github.com/ch-hash-lab/rue"
func main() {
r := rue.Default()
schema := &rue.GraphQLSchema{
Query: &rue.ObjectType{
Name: "Query",
Fields: map[string]*rue.Field{
"hello": {
Type: rue.StringType,
Resolve: func(ctx *rue.ResolveContext) (any, error) {
return "Hello, GraphQL!", nil
},
},
},
},
}
handler := rue.NewGraphQLHandler(schema)
r.POST("/graphql", handler.Handle)
r.GET("/graphql", handler.Playground)
r.Run(":8080")
}
| Benchmark | Iterations | Time/op | Bytes/op | Allocs/op |
|---|---|---|---|---|
| Router_StaticRoute | 145,144,989 | 8.35 ns | 0 B | 0 |
| Router_ParamRoute | 44,290,861 | 26.83 ns | 32 B | 1 |
| Engine_SimpleRoute | 3,112,678 | 387.5 ns | 1064 B | 11 |
| Engine_JSONResponse | 1,598,793 | 778.3 ns | 1633 B | 18 |
| Brotli Compression | 66,400 | 18.1 ยตs | 15920 B | 14 |