Favicon of Echo

Echo

Echo is a minimalist Go web framework with a fast router, middleware system, and built-in TLS support, built on net/http.

Echo website screenshot
Echo GitHub repository preview

Echo is a Go web framework for building HTTP servers and RESTful APIs. It's aimed at Go developers who want more structure than the standard net/http package offers, without the overhead of a large full-stack framework. It builds directly on net/http and stays interoperable with it through echo.WrapHandler and echo.WrapMiddleware, so existing handlers and middleware written for the standard library still work.

The core of Echo is a radix-tree router optimized for route matching speed, paired with a middleware system that can be applied at the root, group, or route level. It handles request binding for JSON, XML, and form payloads, and leaves error handling centralized so you don't scatter error logic across handlers. Template rendering works with any Go template engine, and TLS setup (including automatic certificates via Let's Encrypt) and HTTP/2 are built in rather than bolted on.

Key features

  • Fast router: a radix-tree based router that prioritizes routes for quick matching, even with many endpoints.
  • Middleware framework: apply middleware globally, per group, or per route, with an ecosystem of official and third-party packages (JWT, OpenTelemetry, Prometheus, sessions, casbin, pprof).
  • Data binding: parse JSON, XML, and form payloads into structs, with a pluggable validator.
  • Centralized error handling: handle errors from handlers in one place instead of repeating logic.
  • Flexible responses: helper functions for sending various HTTP response types.
  • Template rendering: works with any Go template engine, not tied to one.
  • Automatic TLS: built-in Let's Encrypt integration for HTTPS without manual certificate management.
  • HTTP/2 support: works out of the box for servers that need it.
  • API grouping: organize routes into groups for shared prefixes and middleware.
  • Standard library interop: wrap existing net/http handlers and middleware without rewriting them.

Ideal use cases

Echo fits projects building RESTful APIs or microservices in Go where you want routing, middleware, and binding handled for you, but don't want a framework that dictates project structure or bundles an ORM, templating engine, or CLI generator. It works well for teams that already use net/http-compatible middleware and want to add a router and structure on top without rewriting existing code.

It's also a reasonable choice for services that need TLS termination with Let's Encrypt or HTTP/2 without extra reverse-proxy configuration, and for projects that want to pull in official middleware for JWT auth, tracing (OpenTelemetry), or metrics (Prometheus) without writing that plumbing from scratch.

Echo is not the right fit if you want a framework with strong opinions on project layout, built-in ORM, or admin scaffolding, since it stays minimal by design. If your project is small enough that plain net/http with http.ServeMux covers your routing needs, adding Echo may be unnecessary overhead. Teams needing a non-Go stack obviously won't use it either, since it's Go-only.

Installation

Install the current major version with go get:

go get github.com/labstack/echo/v5

Echo supports the last four major Go releases and may work with older versions too.

A minimal server looks like this:

package main

import (
  "github.com/labstack/echo/v5"
  "github.com/labstack/echo/v5/middleware"
  "log/slog"
  "net/http"
)

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

  e.Use(middleware.RequestLogger())
  e.Use(middleware.Recover())

  e.GET("/", hello)

  if err := e.Start(":8080"); err != nil {
    slog.Error("failed to start server", "error", err)
  }
}

func hello(c *echo.Context) error {
  return c.String(http.StatusOK, "Hello, World!")
}

From there, add routes with e.GET, e.POST, and similar methods, group routes with e.Group, and attach middleware at whatever level makes sense for your app.

Frequently asked questions

Share:

Stars
32.7K
Forks
2.4K
Last commit
3 days ago
Repository age
11 years
License
MIT
Self-hosted
No
Activity score
84/100
View Repository
Built with:
Ad
Favicon

 

  
 

Similar to Echo

Favicon

 

  
 
Favicon

 

  
 
Favicon