Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 12, 2026·2 min de lecture

Fiber — Express-Inspired Web Framework Written in Go

Fiber is an Express-inspired web framework written in Go, built on top of Fasthttp — the fastest HTTP engine for Go. Familiar Express-like API, zero memory allocation routing, built-in middleware, and WebSocket support.

Introduction

Fiber is an Express-inspired web framework written in Go, built on top of Fasthttp — the fastest HTTP engine for Go. Fiber aims to ease things up for fast development with zero memory allocation and performance in mind. Familiar API for developers coming from Express.js or Koa.

What Fiber Does

  • Express-like APIapp.Get(), app.Post(), familiar method signatures
  • Zero memory allocation — routing uses no heap allocations
  • Fasthttp — fastest HTTP library for Go (not net/http)
  • Middleware — Logger, CORS, Rate Limiter, Compress, ETag, Cache, Helmet
  • Template engines — HTML, Pug, Handlebars, Mustache
  • WebSocket — built-in WebSocket support
  • File upload — multipart form handling
  • Static filesapp.Static() built in
  • Group routing — Express-style route groups
  • Hooks — OnRoute, OnName, OnGroup lifecycle hooks

Architecture

Built on Fasthttp (no net/http). Fasthttp reuses request objects and uses byte slices instead of strings to eliminate allocations. Fiber wraps this with an Express-like API. Note: Fasthttp is not fully compatible with Go stdlib middleware (requires adaptation).

Self-Hosting

go build -o server main.go
./server
# Single binary, zero deps

Key Features

  • Fastest Go web framework (Fasthttp-based)
  • Zero allocation routing
  • Express-familiar API
  • 30+ built-in middleware
  • WebSocket support
  • Template engines
  • Route groups
  • Prefork mode for multi-core
  • Graceful shutdown
  • File upload handling

Comparison

Framework HTTP Engine Allocations API Style
Fiber Fasthttp Zero Express
Gin net/http + httprouter Low Express-like
Echo net/http Low Express-like
Chi net/http Low stdlib
stdlib net/http net/http Variable Raw

FAQ

Q: Fiber vs Gin? A: Fiber is based on Fasthttp (faster but not stdlib-compatible); Gin is based on net/http (compatible with stdlib middleware). Pick Fiber for pure performance, Gin for maximum compatibility.

Q: Fasthttp limitations? A: Fasthttp does not support HTTP/2 and cannot directly use net/http middleware. You need adapters or give up part of the stdlib integration.

Q: What scenarios is it for? A: High-QPS REST APIs, microservices needing the lowest latency, and migrating from Express.js to Go.

Sources

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires