echo README

The project's README from github.com/labstack/echo. As one markdown file: README.md.

Latest release Last commit Sourcegraph GoDoc Go Report Card GitHub Workflow Status (with event) Codecov Forum Twitter License

Echo

High performance, extensible, minimalist Go web framework.

Echo is built on Go's standard net/http — and interoperates with it via echo.WrapHandler / echo.WrapMiddleware — adding the parts the standard library leaves to you: a fast radix-tree router, request binding (with a pluggable validator), a deep middleware ecosystem, and centralized error handling. Actively maintained, with v5 as the current release line (see badges above for the latest version and most recent commit).

Help and questions: Github Discussions

Feature Overview

Sponsors

encore icon Encore – the platform for building Go-based cloud backends

Click here for more information on sponsorship.

Guide

Supported Echo versions

See ROADMAP.md for where Echo is heading and the version support policy.

Installation

// go get github.com/labstack/echo/{version}
go get github.com/labstack/echo/v5

Latest version of Echo supports last four Go major releases and might work with older versions.

Example

package main

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

func main() {
  // Echo instance
  e := echo.New()

  // Middleware
  e.Use(middleware.RequestLogger()) // use the RequestLogger middleware with slog logger
  e.Use(middleware.Recover())       // recover panics as errors for proper error handling

  // Routes
  e.GET("/", hello)

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

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

Official middleware repositories

Following list of middleware is maintained by Echo team.

Repository Description
github.com/labstack/echo-jwt JWT middleware
github.com/labstack/echo-contrib casbin, gorilla/sessions, pprof) middlewares
github.com/labstack/echo-opentelemetry OpenTelemetry middleware for tracing and metrics
github.com/labstack/echo-prometheus Prometheus middleware for Echo

Third-party middleware repositories

Be careful when adding 3rd party middleware. Echo teams does not have time or manpower to guarantee safety and quality of middlewares in this list.

Repository Description
oapi-codegen/oapi-codegen Automatically generate RESTful API documentation with OpenAPI Client and Server Code Generator
github.com/swaggo/echo-swagger Automatically generate RESTful API documentation with Swagger 2.0.
github.com/ziflex/lecho Zerolog logging library wrapper for Echo logger interface.
github.com/brpaz/echozap Uber´s Zap logging library wrapper for Echo logger interface.
github.com/samber/slog-echo Go slog logging library wrapper for Echo logger interface.
github.com/darkweak/souin/plugins/echo HTTP cache system based on Souin to automatically get your endpoints cached. It supports some distributed and non-distributed storage systems depending your needs.
github.com/mikestefanello/pagoda Rapid, easy full-stack web development starter kit built with Echo.
github.com/go-woo/protoc-gen-echo ProtoBuf generate Echo server side code

Please send a PR to add your own library here.

Contribute

Use issues for everything

Credits

License

MIT

echo (labstack/echo)

Searching Database…

32.8K ·GitHub
这是什么?Echo 是一个高性能、极简的 Go Web 框架,用于构建 Web 应用、RESTful API 和微服务。
它是框架还是库?和 Go 标准库的 net/http 怎么配合?它是一个构建在 Go 标准 net/http 之上的框架,并且能与 net/http 互操作——已有的处理器和中间件可以通过 echo.WrapHandler 和 echo.WrapMiddleware 直接接入。
怎么把它加到我的项目里?像添加其他 Go 依赖一样,用 go get 把 Echo 模块加进项目,然后按照官网上的快速上手指南操作即可——不需要安装别的东西。
它支持哪些 Go 版本?最新的 Echo 版本支持最近四个 Go 大版本,更旧的版本也许也能用。
我该从 v4 还是 v5 入手?从 v5 开始——截至 2026 年 1 月,它是当前的主线版本。v4 在 2026 年 12 月 31 日之前只获得安全更新和缺陷修复,v4 到 v5 的 API 变更都列在 APICHANGESV5.md 里。
可以用在商业项目里吗?可以——Echo 采用 MIT 许可证,商业使用、修改和再分发都没问题。
它能帮我处理 HTTPS 和 HTTP/2 吗?可以。Echo 支持通过 Let's Encrypt 自动获取 TLS 证书,并且内置 HTTP/2 支持,所以不需要额外架一个代理来提供安全流量。
有没有现成的全栈应用起步套件?有——README 里列出的第三方项目 Pagoda,是一个基于 Echo 构建的快速、易用的全栈 Web 开发起步套件。
能从我的代码生成 API 文档吗?可以通过第三方中间件实现:oapi-codegen 可以生成 OpenAPI 的客户端和服务器代码,swaggo/echo-swagger 可以为 REST API 生成 Swagger 2.0 文档。
这个项目成熟吗?非常成熟——从 2015 年 3 月开始开发,在 GitHub 上有超过 32000 颗星,目前以 v5 作为当前发布主线持续积极维护,并获得了 Encore 等平台的赞助。
What are similar projects?actix-web, iris, fiber, go-zero, Slim, chi, gofr, hono
Creator
labstack
Size
6.6 MB
Stars
32.8K
Age
11y
Commits · 90 Days