How to Host Golang Echo Projects for Free
Grace Collins
Solutions Engineer · Leapcell

Introduction to Go Echo
Echo is a high-performance, extensible, and minimalist web framework designed for the Go language. It is known for its high speed, small memory footprint, and excellent support for HTTP/2.
The core design philosophy of Echo is "less is more." It provides a concise yet powerful API that allows developers to quickly build robust RESTful APIs and web applications.
Due to its outstanding performance and simple design, Echo has become one of the top choices for many Go developers building web services.
How to Deploy Go Echo as an Online Service?
The traditional way to deploy a Go Echo project online is to purchase a Virtual Private Server (VPS), such as from DigitalOcean or AWS EC2.
While this method offers flexibility, it incurs costs from the moment you purchase the server, regardless of whether your service receives any traffic. 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 model: you are only billed when your service is processing requests.
This means that when your Echo project is idle and not receiving any requests, you don't pay a cent. This "pay-as-you-go" model can significantly reduce the operating costs of your Go Echo project, ensuring you only pay for the actual usage you see.
Below, we will walk you through a simple example of how to easily deploy a brand new Go Echo project to Leapcell.
1. Creating an Echo Project
Before you begin, please ensure that 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-echo-app cd my-echo-app
Next, initialize your Go module using go mod init
. You can replace example.com/myechoapp
with any name you'd like for your project.
go mod init example.com/myechoapp
Install the Go Echo Framework
Use the go get
command to install Echo version 4.
go get github.com/labstack/echo/v4
Create the Main Program File: main.go
Create a file named main.go
in the root of your project directory and paste the following code into it. This is a minimal Go Echo application with a single root route /
that returns "Hello, Leapcell!" when accessed.
package main import ( "net/http" "os" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" ) func main() { // Create an Echo instance e := echo.New() // Middleware e.Use(middleware.Logger()) e.Use(middleware.Recover()) // Route => handler e.GET("/", func(c echo.Context) error { return c.String(http.StatusOK, "Hello, Leapcell!") }) // Get the port provided by Leapcell, defaulting to 8080 for local execution port := "8080" // Start the server e.Logger.Fatal(e.Start(":" + port)) }
Run the following command in your terminal to start your Echo service:
go run main.go
You will see the service starting 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 Echo repository.
Go to the Leapcell Dashboard and click the New Service button.
On the "New Service" page, select the Echo 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!