---
title: "Deploying a Simple Go/Gin Application on Heroku"
description: "Deploying a Go/Gin application can be simple locally but requires explicit preparation for cloud deployment, including dependency management, environment configuration, and a process definition. The guide initializes a Go module, adds Gin with go get, runs main.go locally, and verifies the API with curl, using Go 1.24.0 in its example. It then creates a Heroku app, adds a Procfile with web: go run main.go, runs go mod tidy, commits the project, and pushes the main branch to the Heroku remote. Heroku detects the Go app through go.mod, installs Go 1.24.0 and dependencies, builds ./bin/go-gin, and launches the web process; the deployed /quote endpoint returns JSON, while heroku logs --tail confirms a successful request."
---

# Deploying a Simple Go/Gin Application on Heroku

[Heroku](https://yomu.fyi/company/heroku) · Ken W. Alger · May 22, 2025

**Type:** Tutorial

## Summary

Deploying a Go/Gin application can be simple locally but requires explicit preparation for cloud deployment, including dependency management, environment configuration, and a process definition. The guide initializes a Go module, adds Gin with go get, runs main.go locally, and verifies the API with curl, using Go 1.24.0 in its example. It then creates a Heroku app, adds a Procfile with web: go run main.go, runs go mod tidy, commits the project, and pushes the main branch to the Heroku remote. Heroku detects the Go app through go.mod, installs Go 1.24.0 and dependencies, builds ./bin/go-gin, and launches the web process; the deployed /quote endpoint returns JSON, while heroku logs --tail confirms a successful request.

## Context

Developers unfamiliar with cloud deployment may struggle with configuring environment variables, managing dependencies, and ensuring a Go/Gin application runs correctly on a hosting platform.

## Approach / What changed

The guide sets up a Go module and Gin locally, tests the server and endpoints, creates a Heroku app, defines its web process in a Procfile, tidies and commits dependencies, pushes the main branch to Heroku, and verifies the deployed endpoint and live logs.

## Takeaways

- The example uses Go 1.24.0, initializes dependencies with go.mod, adds Gin with go get, and uses go mod tidy before deployment.
- A Procfile containing web: go run main.go defines Heroku's web process; if reaching the service causes errors, the guide suggests running the built ./bin/go-gin binary directly.
- Heroku detects the Go application, installs Go 1.24.0 and github.com/gin-gonic/gin v1.10.0, builds ./bin/go-gin, and the deployed /quote request returns HTTP 200 in the shown logs.

**Tags:** [Gin](https://yomu.fyi/topic/gin), [Go](https://yomu.fyi/topic/go), [Heroku](https://yomu.fyi/topic/heroku)

- Source: [Heroku](https://www.heroku.com/blog/deploying-simple-go-gin-application-on-heroku)
- Source URL: https://www.heroku.com/blog/deploying-simple-go-gin-application-on-heroku
- Ingested by Yomu: 2026-09-10T04:02:48.408Z

[Read original post](https://www.heroku.com/blog/deploying-simple-go-gin-application-on-heroku)
