How to Host Golang Projects for Free (Gin Example)
Daniel Hayes
Full-Stack Engineer · Leapcell

Gin is a fast, lightweight, and flexible web framework for the Go programming language. It is designed to simplify the development of high-performance web applications and APIs, offering a minimalistic yet powerful feature set.
In this post, We'll take Gin as an example to show you how easy it is to deploy Golang services on Leapcell .
1. Fork the Gin example on GitHub.
Repo: Gin example
Here’s the main.go
file from that repo, which is borrowed from the official gin docs:
package main import "github.com/gin-gonic/gin" func main() { r := gin.Default() r.GET("/ping", func(c *gin.Context) { c.JSON(200, gin.H{ "message": "hello leapcell", }) }) r.Run() // listen and serve on 0.0.0.0:8080 }
2. Create a Service in the Leapcell Dashboard and connect your Gin repository.
Go to the Leapcell Dashboard and click the New Service button.
On the "New Service" page, select the Gin repository you just forked.
To access your repositories, you’ll need to connect Leapcell to your GitHub account.
Follow these instructions to connect to GitHub.
Once connected, your repositories will appear in the list.
3. 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.
4. Access Your Gin 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!