Before touching Gin, you need to master the basics of the Go language, the concepts of HTTP and REST, and the Go toolchain. In this episode you also set up the environment, install Gin v1.12.0, and verify your first installation.

Welcome to the Learn Gin series! This series will take you through mastering Gin — the most popular HTTP web framework for the Go language — from conceptual foundations to production readiness. There are 23 episodes in total, organized into six phases: pre-requisites, basic operational, data management, security, scaling, and production.
Before diving into Gin code, there are some fundamental skills and software you must have. Why are these pre-requisites important? Because Gin is not a magic framework: it is a thin layer on top of Go's standard net/http. You should already understand concepts such as HTTP methods, status codes, headers, and JSON bodies so you don't get confused when reading handler code.
Episode 0 is your roadmap: confirm your fundamental skills, set up the Go toolchain, install Gin v1.12.0, and perform your first verification. Once this episode is complete, the rest of the series can be followed comfortably.
Gin is written in Go and used from Go, so you must be comfortable with the core syntax: variables, functions, structs, interfaces, slices, and maps. Also understand Go's modern module system:
go.mod.json tag, which is the foundation of Gin binding.package main
import "fmt"
type User struct {
Name string `json:"name"`
Email string `json:"email"`
}
func main() {
u := User{Name: "Arman", Email: "arman@example.com"}
fmt.Printf("%s - %s\n", u.Name, u.Email)
}Struct tags like json:"name" are what Gin later reads when binding a request to a struct. Without understanding this concept, episode 5 on binding will feel confusing.
Gin is an HTTP framework, so understand at least the following:
Content-Type and Authorization.REST (Representational State Transfer) is an architectural style that maps resources to URLs. For example GET /users/1 reads the user with id 1. This concept will be used continuously from episode 3 onward.
curl -i http://example.comNote that the command curl -i http://example.com displays the status line and headers. Getting into the habit of testing APIs with curl will become a routine throughout this series.
For the data management phase (episodes 9-12), you will need basic database skills:
SELECT, INSERT, UPDATE, DELETE.Also use Git for versioning:
git --version
git config --global user.name "Your Name"
git config --global user.email "you@example.com"Make sure Go is installed with the latest stable version, at least Go 1.24:
go version
go env GOPATH GOROOTThe output of go version must show go1.24 or newer. Also run go env GOPATH to find out where your global modules live.
Once Go is ready, create a project directory, initialize the module, and install Gin v1.12.0:
mkdir belajar-gin
cd belajar-gin
go mod init belajar-gin
go get github.com/gin-gonic/gin@v1.12.0The command go get github.com/gin-gonic/gin@v1.12.0 adds Gin to go.mod and go.sum. Version v1.12.0 is the latest stable release as of the writing of this series (February 2026). After installing, verify the recorded version:
go list -m github.com/gin-gonic/ginWe recommend using VS Code with the official Go extension from golang.go. This extension provides IntelliSense, formatting, and integrated debugging. For testing your API, you can use:
All test examples in this series use curl so they can be easily copied into the terminal.
Before moving on to episode 1, create a main.go file at the project root and run it:
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "pong"})
})
r.Run(":8080")
}Run the server in one terminal, then test it from another terminal:
go run main.gocurl http://localhost:8080/pingIf the output shows {"message":"pong"}, your environment is ready. The function gin.Default() creates an engine with the built-in Logger and Recovery middleware — we'll examine the details in episode 3.
Info
If port 8080 is already in use, change the r.Run argument to r.Run(":9090") and adjust the curl command accordingly.
A recap of the pre-requisites you prepared in episode 0:
go list -m.If anything is missing, stop here and complete it before continuing. A strong foundation will make the next 22 episodes feel much lighter.
Key takeaways:
net/http: master Go and HTTP basics first.json:"name" are the foundation of Gin binding.go get github.com/gin-gonic/gin@v1.12.0.gin.Default() engine and test the /ping endpoint.In the next episode, episode 1, we will cover the history, background, and why you need Gin — from the evolution of net/http, the birth of Gin as a fork of Martini in 2014, to an early comparison with Echo, Fiber, chi, and plain net/http. Make sure your environment is ready, because the Learn Gin journey is just beginning!