How to Host Golang Fiber Projects for Free
Emily Parker
Product Engineer · Leapcell

An Introduction to Go Fiber
Fiber is a web framework for the Go language, inspired by Express.js.
It is built on top of Fasthttp, the fastest HTTP engine for Go, and is therefore known for its excellent performance and low memory footprint. Fiber is designed to simplify the process of rapid development while maintaining zero memory allocation and high performance.
For teams looking for extreme performance and familiarity with the Express.js development model, Fiber is an excellent choice.
How to Deploy Go Fiber as a Live Service?
The traditional way to deploy a Go Fiber project online is to purchase a VPS, such as one from Digital Ocean or AWS EC2.
While this method is flexible, it incurs costs from the moment you purchase the server, regardless of whether your service receives traffic or not. It is not a very cost-effective option.
A Better Deployment Solution: Leapcell
Leapcell is a web app deployment platform. It offers a revolutionary pricing plan: you are only charged when processing requests.
This means that when your Fiber project is idle with no incoming requests, you don't pay a cent. This "pay-as-you-go" model can significantly reduce the operating costs of a Go Fiber project, as you only pay for the actual usage you see.
Below, we will show you how to easily deploy a brand new Go Fiber project to Leapcell with a simple example.
1. Creating a Fiber Project
Before you begin, please ensure you have the Go language environment installed.
Create a Project Directory and Initialize a Go Module
Open your terminal, create a new project directory, and navigate into it.
mkdir my-fiber-app cd my-fiber-app
Then, initialize your Go module using go mod init
. You can replace example.com/myfiberapp
with any name you want for your project.
go mod init example.com/myfiberapp
Install the Go Fiber Framework
Use the go get
command to install Fiber v3.
go get github.com/gofiber/fiber/v3
Create the Main Program File main.go
Create a file named main.go
in the project's root directory and paste the following code. This is the simplest Go Fiber application, with only a single root route /
that returns "Hello, Leapcell!" when accessed.
package main import ( "log" "os" "github.com/gofiber/fiber/v3" ) func main() { // Create a Fiber instance app := fiber.New() // Route => handler app.Get("/", func(c *fiber.Ctx) error { return c.SendString("Hello, Leapcell!") }) // Get the port provided by Leapcell, defaulting to 8080 for local execution port := "8080" // Start the server log.Fatal(app.Listen(":" + port)) }
Run the following command in your terminal to start your Fiber service:
go run main.go
You will see the service start on port 8080. Now open your browser or use curl
to visit http://localhost:8080
, and you should see the output "Hello, Leapcell!".
2. Pushing the Project to GitHub
Leapcell deploys your code by reading from your GitHub repository. You will need to push your project to GitHub for Leapcell to access it.
Create a GitHub Account
If you don't already have a GitHub account, please go to github.com to sign up.
After registering, please refer to the official GitHub documentation for the next steps:
Adding locally hosted code to GitHub
3. Create a Service in the Leapcell Dashboard and connect your Fiber repository.
Go to the Leapcell Dashboard and click the New Service button.
On the "New Service" page, select the Fiber repository you just created.
4. Provide the following values during creation:
Since Go is a compiled language, we will use go build
to build the Go application.
In this example, our Golang project name is app
, so it will compile to there.
Field | Value |
---|---|
Runtime | Go (Any version) |
Build Command | go build -tags netgo -ldflags '-s -w' -o app |
Start Command | ./app |
Port | 8080 |
Enter these values in the corresponding fields.
5. Access Your Go Echo App:
Once deployed, you should see a URL like foo-bar.leapcell.dev
on the Deployment page. Visit the domain shown on the service page.
Continuous Deployments
Every push to the linked branch automatically triggers a build and deploy. Failed builds are safely canceled, leaving the current version running until the next successful deploy.
Why Leapcell For Go Language Hosting
- Leapcell is the next-gen serverless platform for web hosting, allowing you to deploy entire Go language projects in the cloud.
- Leapcell only charges for actual usage, so you don't have to pay a penny when the machine is idle.
- Leapcell offers a generous free quota that resets every month. For daily usage, it's unlikely you'll exceed the quota.
Let's start deploying your Golang service in Leapcell!