E

Echo

High-performance, extensible Go web framework — minimalist API with automatic TLS, WebSocket support, and data binding.

Go free Open Source web since 2015

Echo sits between Gin’s popularity and Fiber’s performance — a clean, extensible API with auto TLS via Let’s Encrypt, WebSocket support, and a straightforward middleware system. Its context-based API and data binding via struct tags make building REST APIs idiomatic in Go. Echo’s automatic TLS feature is particularly convenient for small services that need HTTPS without managing certificates manually.

Quick start

go mod init my-api
go get github.com/labstack/echo/v4
// main.go
package main

import (
	"net/http"

	"github.com/labstack/echo/v4"
	"github.com/labstack/echo/v4/middleware"
)

type Post struct {
	ID    int    `json:"id"`
	Title string `json:"title" form:"title"`
	Body  string `json:"body"  form:"body"`
}

func main() {
	e := echo.New()

	e.Use(middleware.Logger())
	e.Use(middleware.Recover())
	e.Use(middleware.CORS())

	posts := []Post{}

	e.GET("/posts", func(c echo.Context) error {
		return c.JSON(http.StatusOK, posts)
	})

	e.POST("/posts", func(c echo.Context) error {
		var p Post
		if err := c.Bind(&p); err != nil {
			return err
		}
		p.ID = len(posts) + 1
		posts = append(posts, p)
		return c.JSON(http.StatusCreated, p)
	})

	e.GET("/posts/:id", func(c echo.Context) error {
		id := c.Param("id")
		return c.JSON(http.StatusOK, map[string]string{"id": id})
	})

	e.Logger.Fatal(e.Start(":8080"))
}

When to use

Echo is a solid Go web framework choice that balances ergonomics and performance. Its built-in automatic TLS, WebSocket, and comprehensive middleware make it convenient without being heavy. Gin is more popular with a larger ecosystem; Fiber is faster but not net/http compatible. Chi is the option when you want the closest to stdlib possible. Echo is a strong default when you want more than Gin’s basic binder but don’t need Fiber’s extreme throughput.

// features

  • Extensible middleware — built-in Logger, Recover, CORS, JWT, rate-limiter
  • Automatic TLS via Let's Encrypt with `e.StartAutoTLS()`
  • Data binding via struct tags — JSON, XML, form, query params
  • WebSocket support built in
  • Route grouping with shared middleware
  • Custom context for adding request-scoped data
  • Sub-routers for modular application structure
  • Binder and validator interfaces for custom request processing

// installation

go go get github.com/labstack/echo/v4

// tags

backendgoapirestwebsocketminimalistmiddleware
Something wrong? Edit this entry on GitHub.
✏ Edit on GitHub