Guide · Open source
How to use Fiber: install and build your first Go web server
Updated · written with AI from the project's own documentation and checked against our catalogue data
Fiber is a web framework for the Go programming language. It lets you define routes and handlers so your program can respond to web requests, and its API is modeled on Express, the Node.js framework. This guide shows you how to set up a Go module, install Fiber, and run a basic server that responds to requests in the browser.
Quick start
- 1Check your Go version. Confirm you have Go 1.26 or higher installed. Install or upgrade Go from the official download page if needed.
- 2Create a Go module. Make a project directory, move into it, and run go mod init with your own module path.
- 3Install Fiber. Run go get -u github.com/gofiber/fiber/v3 to add Fiber to your project's dependencies.
- 4Write a main.go file. Create a main function that initializes an app with fiber.New() and defines a GET route on the root path.
- 5Start the server. Call app.Listen with a port such as :3000 and run the program.
- 6Open the page. Visit http://localhost:3000 in your browser to see the response.
What you need before you install Fiber
Fiber requires Go version 1.26 or higher to run. If you need to install or upgrade Go, use the official Go download page at go.dev/dl.
Fiber is a Go library, not a standalone program, so you write Go code and build it into your own project. You will also need a project directory and a Go module.
- Go 1.26 or higher
- A terminal to run commands
- A project directory for your code
Install Fiber into a Go module project
Create a new directory for your project, move into it, and initialize it as a Go module. The README uses a placeholder module path, so replace it with your own.
Then install Fiber with the go get command. It fetches the package and adds it to your project's dependencies.
go mod init github.com/your/repo
go get -u github.com/gofiber/fiber/v3Write and run your first Fiber server
Create a Go file in your project with a main function. The example below initializes an app, defines a GET route for the root path, and starts the server on port 3000.
Run the program, then open http://localhost:3000 in your browser to see the message. The example shows the three core parts of Fiber: app initialization, route definition, and starting the server.
package main
import (
"log"
"github.com/gofiber/fiber/v3"
)
func main() {
// Initialize a new Fiber app
app := fiber.New()
// Define a route for the GET method on the root path '/'
app.Get("/", func(c fiber.Ctx) error {
// Send a string response to the client
return c.SendString("Hello, World 👋!")
})
// Start the server on port 3000
log.Fatal(app.Listen(":3000"))
}Understand the Zero Allocation rule before you write handlers
Fiber is optimized for high performance. Values returned from fiber.Ctx are not immutable by default and will be reused across requests.
As a rule of thumb, use context values only inside the handler and do not keep references to them. Once the handler returns, values obtained from the context may be reused in future requests.
- Use context values only inside the handler.
- Do not store references to context values for later use.
Migrating from Fiber v2 to v3
If you have a Fiber v2 project, the Fiber CLI can migrate it to v3. Install the CLI, then run the migrate command in your project's directory.
Review the changes and run your tests afterwards. Run fiber migrate --help to see all options, and read the migration guide for what changed in v3.
go install github.com/gofiber/cli/fiber@latest
fiber migrate --to v3Features to explore next
Fiber's README lists routing, static file serving, middleware with Next support, template engines, WebSocket support, Server-Sent Events, and a rate limiter. Each has its own page in the official docs at docs.gofiber.io.
- Routing
- Serve static files
- Middleware and Next support
- Template engines
- WebSocket support
- Server-Sent Events
- Rate limiter
What people use it for
- Building REST APIs with routes and handlers in Go
- Creating web backends that serve static files
- Adding WebSocket or Server-Sent Events endpoints to a Go service
- Moving a team from Node.js and Express to Go while keeping a familiar style
Frequently asked questions
Is Fiber free to use?
Fiber is released under the MIT licence. The source says the licence is MIT, so you can use it in your projects under those terms. Check the repository's licence file for the full text.
What do I need to install Fiber?
You need Go 1.26 or higher. Install Fiber into a Go module project with go get -u github.com/gofiber/fiber/v3.
Is Fiber the same as Express for Go?
Fiber's API is inspired by Express, so routes and handlers feel familiar to Express developers. It is a Go framework, though, and it is built on the Fasthttp HTTP engine rather than Node.js.
Does Fiber work with Go's net/http?
Not as a drop-in. Fiber is built on Fasthttp instead of net/http, so teams that need strict standard-library net/http compatibility should consider other options.
Why does my Fiber project fail to build?
The most likely cause, according to the README, is an older Go version, since Fiber requires Go 1.26 or higher. Check your version and upgrade Go if needed. If you are on Fiber v2, run the migration steps for v3.
What are the alternatives to Fiber?
The README lists Gin, Echo, Chi, and net/http as comparable projects. Pick the one whose style and HTTP engine fit your project.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Fiber suits Go developers building REST APIs or web backends, especially developers coming from Express who want a familiar style. Skip it if you are not writing Go, if you need strict net/http compatibility, or if you cannot use Go 1.26 or higher.
Install options & downloads