Fiber

An Express-inspired Go web framework built on Fasthttp for zero-allocation, extreme-performance HTTP servers.

Framework
Go
vv2.52.15
40,130stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity100
Maintenance100
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture85
Code Quality88
Innovation70
Learning Curve90

Fiber is a Go web framework modeled closely on Express.js, aimed at giving developers coming from Node.js a familiar, low-friction path into Go’s web ecosystem. Rather than building on net/http, Fiber is built directly on top of Fasthttp, one of the fastest HTTP engines available for Go, which lets it push extreme request throughput with minimal memory allocation.

The framework centers on a single App instance created with fiber.New(), onto which routes, groups, and middleware are registered using an Express-like chainable API (app.Get, app.Post, app.Use, route Groups, and named routes). A Ctx object wraps each request/response pair and exposes helpers for parsing bodies, binding query/params/headers into structs, setting cookies, streaming responses, and returning typed errors via fiber.Error.

Fiber ships as a mono-repo of first-party middleware — CORS, CSRF, rate limiting, compression, caching, session handling, structured logging, basic auth, key auth, request ID, recover, and more — each versioned and tested alongside the core module. This keeps common production concerns (security headers, panic recovery, structured request logs) a one-line app.Use() away instead of requiring separate third-party packages of varying quality.

Because Fiber sits on Fasthttp rather than net/http, it intentionally trades away compatibility with the broader net/http ecosystem (net/http middleware, http.Handler-based tooling like gqlgen or go-swagger) in exchange for raw throughput — a deliberate, documented limitation rather than an oversight.

What You Get

  • An App with an Express-like chainable routing API (Get, Post, Use, Group, named routes) built directly on Fasthttp for minimal allocation overhead
  • A Ctx request/response wrapper with built-in body/query/param/header binding into structs, cookie helpers, and streaming response support
  • 30+ first-party, versioned middleware packages covering CORS, CSRF, rate limiting, compression, caching, sessions, structured logging, basic/key auth, and panic recovery
  • A typed fiber.Error and configurable ErrorHandler for consistent HTTP error responses across an application
  • Built-in support for static file serving, template engines, WebSockets (via a companion package), and Server-Sent Events
  • Documented, RFC-aware routing internals with a dedicated Route/routeParser layer for path matching and parameter extraction

Common Use Cases

  • Building high-throughput REST APIs and microservices where request latency and memory allocation under load are a primary constraint
  • Migrating a team’s mental model from Express.js/Node.js to Go without relearning routing and middleware idioms from scratch
  • Assembling a production API quickly using Fiber’s first-party middleware for auth, rate limiting, CORS, and logging instead of stitching together third-party net/http packages
  • Serving static assets and server-rendered pages via Fiber’s built-in template engine integrations for small to mid-sized web apps
  • Building internal tools and gateways where request/response performance (Fasthttp’s zero-allocation model) matters more than net/http interface compatibility

Under The Hood

Architecture Fiber’s execution model centers on a single App struct (constructed in app.go via New(config ...Config)) that owns a Fasthttp server, a route stack per HTTP method, and shared configuration. Requests enter through a Fasthttp handler that Fiber wraps into a pooled Ctx (see ctx.go), which is then walked through the matching Route’s handler chain defined in router.go — routes carry a routeParser for path/parameter matching and support prefix (use), grouped (Group), and mounted (Mount) sub-routers so large applications can compose nested apps under shared middleware. Because Ctx objects are pooled and reused across requests, Fiber avoids net/http’s per-request allocation pattern; a change to the core Ctx or routing structs (both flagged with “keep in sync” comments in router.go) ripples across every middleware package in the mono-repo, since they all depend on the same Ctx API.

Tech Stack The module (github.com/gofiber/fiber/v2, Go 1.20+) sits directly on github.com/valyala/fasthttp rather than net/http, with github.com/gofiber/utils/v2-style helpers, mattn/go-colorable/go-isatty for terminal-aware logging, tinylib/msgp for MessagePack support, and google/uuid for identifiers. Middleware (CORS, CSRF, compression, sessions, rate limiting, auth, etc.) lives as separate packages under middleware/, each with its own tests, so the dependency surface of an app scales with which middleware it imports rather than pulling in the full framework’s transitive deps. CI (.github/workflows/test.yml) matrices Go 1.20 through 1.23 on Ubuntu and Windows, reflecting the project’s stated compatibility window with the Fasthttp/unsafe-based core.

Code Quality The repository is extensively tested — dozens of *_test.go files sit alongside their implementation files (app_test.go, ctx_test.go, router_test.go, and per-middleware tests), with ctx_test.go alone containing well over a hundred test functions covering binding, headers, and edge cases. Errors are handled explicitly and idiomatically, wrapped with fmt.Errorf("...: %w", err) in operations like request dumping and graceful shutdown, and surfaced to handlers via a typed fiber.Error. A strict .golangci.yml lint configuration (errcheck with blank/type-assertion checks enabled, exhaustive checks, and more) is enforced in CI alongside a dedicated vulnerability-check workflow (govulncheck), and the project’s own contributor guidance calls for parallel (t.Parallel()) tests and profiling of hot-path changes.

What Makes It Unique Fiber’s defining technical choice is building on Fasthttp instead of net/http, deliberately sacrificing compatibility with the broader net/http-based Go ecosystem (middleware, http.Handler-based tooling) in exchange for substantially lower allocation and higher throughput on hot paths — a documented trade-off rather than an accident. Combined with an Express-mirroring API surface, this makes Fiber less an incremental improvement on Go’s standard web-server patterns and more a distinct performance-first lineage with its own first-party middleware ecosystem maintained in lockstep with the core.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search