A modern HTTP server library written in pure Go for faster prototyping.
Note
Faster alternative to FastAPI, natively written in Golang.
- Fast prototyping, get started in less than 10 lines of code <- support H/1.1,2,3 without extra LOC.
package main
import (
"context"
"log"
crazyserver "github.com/ayushanand18/crazyhttp/pkg/server"
"github.com/ayushanand18/crazyhttp/pkg/types"
)
func main() {
ctx := context.Background()
server := crazyserver.NewHttpServer(ctx)
if err := server.Initialize(ctx); err != nil {
log.Fatalf("Server failed to Initialize: %v", err)
}
server.GET("/test").Serve(func(ctx context.Context, request interface{}) (response interface{}, err error) {
return "Hello World from GET.", nil
})
if err := server.ListenAndServe(ctx); err != nil {
log.Fatalf("Server failed to start: %v", err)
}
}
- Built-in support for MCP, let your server accept MCP requests and handle them.
- Focus on server performance, benchmark results here
- Supports HTTP v1.1, v2, v3 (+TLS).
- Supports HTTPS (self-signed/CA issued TLS Certificates) (guide to trust it locally on machine too).
- Supports streaming HTTP responses (LLM/media use-cases).
- How to run
- See dev pipeline and next feature releases
- Installation
- Examples
- Performance and Benchmark results
- Acknowledgement
- Documentation - Coming Soon!
Import the Go package in your service using
go mod add github.com/ayushanand18/crazyhttp
Note
More information here
Parameter | crazyhttp::h1 | FastAPI (H/1.1) | crazyhttp::h3 | crazyhttp::h3 [latest] |
---|---|---|---|---|
Startup Time | 0.005 s | 0.681 s | 0.014 s | 4.4499ms |
RTT (p50) | 1.751ms | |||
RTT (p90) | 6.88 ms | 7.68 ms | 4.49 ms | 3.765ms |
RTT (p95) | 8.97 ms | 9.34 ms | 7.74 ms | 4.796ms |
RTT (p99) | 7.678ms |
Tested by using
time
on Linux. These times are an average of 3 consecutive runs so as to offset system load irregularities however these figure might (and probably shall) differ on each and every run.
- Startup Time: 153x faster than FastAPI.
- 50.97% faster than FastAPI (p90).
- 48.65% faster than FastAPI (p95).
This repository includes examples for building a simple server over HTTP/3.
Other performant libraries form the backbone of this repository, and made it possible to build. We
utilise the following open source libraries for developing ashttp3lib
- cloudflare/quiche - older versions (in C++), not currently used
- google/boringssl - older versions (in C++), not currently used
- quic-go.
Thanks!