:bullettrain_side: High-performance web server for Go.

Overview

Aero Go Logo

Godoc Report Tests Coverage Sponsor

Aero is a high-performance web server with a clean API.

Installation

go get -u github.com/aerogo/aero/...

Usage

Aero usage

Run this in an empty directory:

aero -new

Now you can build your app with go build or use the run development server.

Benchmarks

Web server performance

Features

  • Makes it easy to reach top scores in Lighthouse, PageSpeed and Mozilla Observatory
  • Optimized for low latency
  • Best practices are enabled by default
  • Has a strict content security policy
  • Calculates E-Tags out of the box
  • Saves you a lot of bandwidth using browser cache validation
  • Finishes ongoing requests on a server shutdown
  • Lets you push resources via HTTP/2
  • Supports session data with custom stores
  • Allows sending live data to the client via SSE
  • Provides a context interface for custom contexts
  • Shows response time and size for your routes
  • Can run standalone without nginx babysitting it

Links

Optional

  • http as an HTTP client with a simple and clean API
  • log for simple & performant logging
  • manifest to load and manipulate web manifests
  • markdown as an overly simplified markdown wrapper
  • nano as a fast, decentralized and git-trackable database
  • pack to compile Pixy, Scarlet and JS assets in record time
  • packet as a way to send TCP/UDP messages between nodes
  • pixy as a high-performance template engine similar to Jade/Pug
  • run which automatically restarts your server on code/template/style changes
  • scarlet as an aggressively compressing stylesheet preprocessor

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Cedric Fung Scott Rayapoullé Eduard Urbach
Cedric Fung Scott Rayapoullé Eduard Urbach

Want to see your own name here?

You might also like...
A lightweight RESTful web framework for Go
A lightweight RESTful web framework for Go

Goweb A lightweight RESTful web framework for Go. For examples and usage, please read the Goweb API Documentation Read our Articles Who uses Goweb? "U

Fast and Reliable Golang Web Framework
Fast and Reliable Golang Web Framework

Gramework The Good Framework Gramework long-term testing stand metrics screenshot made with Gramework Stats Dashboard and metrics middleware What is i

Mango is a modular web-application framework for Go, inspired by Rack, and PEP333.

Mango Mango is a modular web-application framework for Go, inspired by Rack and PEP333. Note: Not actively maintained. Overview Mango is most of all a

Classy web framework for Go

Martini NOTE: The martini framework is no longer maintained. Martini is a powerful package for quickly writing modular web applications/services in Go

A Go framework for building JSON web services inspired by Dropwizard

Tiger Tonic A Go framework for building JSON web services inspired by Dropwizard. If HTML is your game, this will hurt a little. Like the Go language

The web framework for Golang
The web framework for Golang

uAdmin the Golang Web Framework Easy to use, blazing fast and secure. Originally open source by IntegrityNet Solutions and Services For Documentation:

The easiest way to create web applications with Go

web.go web.go is the simplest way to write web applications in the Go programming language. It's ideal for writing simple, performant backend web serv

Simple web framework for go, still quite beta at this point

WFDR Framework - Beta Release New 18/Feb/2012: Updated for go 1.0, new directory layout to take advantage of the go build tool. Background There's a m

🔑A high performance Key/Value store written in Go with a predictable read/write performance and high throughput. Uses a Bitcask on-disk layout (LSM+WAL) similar to Riak.

bitcask A high performance Key/Value store written in Go with a predictable read/write performance and high throughput. Uses a Bitcask on-disk layout

the pluto is a gateway new time, high performance, high stable, high availability, easy to use

pluto the pluto is a gateway new time, high performance, high stable, high availability, easy to use Acknowledgments thanks nbio for providing low lev

Faygo is a fast and concise Go Web framework that can be used to develop high-performance web app(especially API) with fewer codes. Just define a struct handler, faygo will automatically bind/verify the request parameters and generate the online API doc. Heart 💜A high performance Lua web server with a simple, powerful API
Heart 💜A high performance Lua web server with a simple, powerful API

Heart 💜 A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal. A high performance gin middleware to cache http response. Compared to gin-contrib/cache, It has a huge performance improvement. 高性能gin缓存中间件,相比于官方版本,有明显性能提升。 go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic repair.(similar fastdfs).
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic repair.(similar fastdfs).

中文 English 愿景:为用户提供最简单、可靠、高效的分布式文件系统。 go-fastdfs是一个基于http协议的分布式文件系统,它基于大道至简的设计理念,一切从简设计,使得它的运维及扩展变得更加简单,它具有高性能、高可靠、无中心、免维护等优点。 大家担心的是这么简单的文件系统,靠不靠谱,可不

LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability.
LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability.

LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability. LinDB stores all monitoring data of ELEME Inc, there is 88TB incremental writes per day and 2.7PB total raw data.

Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.
Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.

Gin Web Framework Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks

beego is an open-source, high-performance web framework for the Go programming language.
beego is an open-source, high-performance web framework for the Go programming language.

Beego Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend services. It is inspired by To

High performance, minimalist Go web framework
High performance, minimalist Go web framework

Supported Go versions As of version 4.0.0, Echo is available as a Go module. Therefore a Go version capable of understanding /vN suffixed imports is r

Comments
  • Fallback router not work properly with router within params

    Fallback router not work properly with router within params

    Code:

    package main
    
    import "github.com/aerogo/aero"
    
    func echo(ctx aero.Context) error { return ctx.String("echo") }
    func echoWithParams(ctx aero.Context) error { return ctx.String(ctx.Get("str")) }
    func notFound(ctx aero.Context) error { return ctx.Error(404) }
    
    func main() {
        app := aero.New()
        app.Config.Ports = aero.PortConfiguration{
            HTTP: 9000,
            HTTPS: 9001,
        }
        app.Any("/echo", echo)
        app.Any("/echo/", echo)
        app.Any("/echo/:str", echoWithParams)
        app.Any("/echo/:str/", echoWithParams)
        app.Any("/*",notFound)
        app.Any("/*/",notFound)
        app.Run()
    }
    

    What I expect:

    Any other path not configure will return Not Found

    What actually happens:

    • GET /echo
    curl -v localhost:9000/echo
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 9000 (#0)
    > GET /echo HTTP/1.1
    > Host: localhost:9000
    > User-Agent: curl/7.55.1
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Date: Thu, 03 Jun 2021 04:41:13 GMT
    < Content-Length: 4
    < Content-Type: text/plain; charset=utf-8
    <
    echo* Connection #0 to host localhost left intact
    
    • GET /e (also /ec /ech)
    curl -v localhost:9000/e
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 9000 (#0)
    > GET /e HTTP/1.1
    > Host: localhost:9000
    > User-Agent: curl/7.55.1
    > Accept: */*
    >
    < HTTP/1.1 404 Not Found
    < Date: Thu, 03 Jun 2021 04:40:39 GMT
    < Content-Length: 0
    <
    * Connection #0 to host localhost left intact
    
    • GET /e/ (also /ec/ /ech/)
    curl -v localhost:9000/e/
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 9000 (#0)
    > GET /x HTTP/1.1
    > Host: localhost:9000
    > User-Agent: curl/7.55.1
    > Accept: */*
    >
    < HTTP/1.1 404 Not Found
    < Date: Thu, 03 Jun 2021 04:45:39 GMT
    < Content-Length: 9
    < Content-Type: text/plain; charset=utf-8
    <
    Not Found* Connection #0 to host localhost left intact
    
    • GET /x (also others)
    curl -v localhost:9000/x/
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 9000 (#0)
    > GET /x HTTP/1.1
    > Host: localhost:9000
    > User-Agent: curl/7.55.1
    > Accept: */*
    >
    < HTTP/1.1 404 Not Found
    < Date: Thu, 03 Jun 2021 04:45:39 GMT
    < Content-Length: 9
    < Content-Type: text/plain; charset=utf-8
    <
    Not Found* Connection #0 to host localhost left intact
    

    I don't know if is configure not properly or bug

    but when I remove the params router it works again

    package main
    
    import "github.com/aerogo/aero"
    
    func echo(ctx aero.Context) error { return ctx.String("echo") }
    - func echoWithParams(ctx aero.Context) error { return ctx.String(ctx.Get("str")) }
    func notFound(ctx aero.Context) error { return ctx.Error(404) }
    
    func main() {
        app := aero.New()
        app.Config.Ports = aero.PortConfiguration{
            HTTP: 9000,
            HTTPS: 9001,
        }
        app.Any("/echo", echo)
        app.Any("/echo/", echo)
    -   app.Any("/echo/:str", echoWithParams)
    -   app.Any("/echo/:str/", echoWithParams)
        app.Any("/*",notFound)
        app.Any("/*/",notFound)
        app.Run()
    }
    

    ...and when get /e

    curl -v localhost:9000/e
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 9000 (#0)
    > GET /e HTTP/1.1
    > Host: localhost:9000
    > User-Agent: curl/7.55.1
    > Accept: */*
    >
    < HTTP/1.1 404 Not Found
    < Date: Thu, 03 Jun 2021 04:52:37 GMT
    < Content-Length: 9
    < Content-Type: text/plain; charset=utf-8
    <
    Not Found* Connection #0 to host localhost left intact
    
    opened by sakurayang 0
  • OnError hook is not working.

    OnError hook is not working.

    I am returning an error from my route handler like this

    return errors.New("Request interrupted by the client")
    

    and I have registered a callback like this

    app.OnError(func(ctx aero.Context, err error) {
    		fmt.Printf("An Error occured.")
    	         ctx.String(err.Error())
    	})
    

    but If I visit the route, The connection is closed without sending error message and no error message is printed in the console. It seems OnError callback is not working. Am I missing something?

    bug help wanted 
    opened by ansarizafar 2
  • Static routes with trailing slash

    Static routes with trailing slash

    Trailing slash stopped working for static routes. The fix is super simple, just adding the trailing slash route in tree.go. I haven't had the time to do it yet but this should hopefully be working again, soon.

    bug help wanted 
    opened by akyoto 0
Releases(v1.3.44)
  • v1.3.44(Nov 17, 2019)

  • v1.3.42(Nov 15, 2019)

  • v1.3.41(Nov 14, 2019)

    With the performance improvements in this release, Aero performed best out of all routers in most of the benchmarks I tested.

    See the benchmarks and try to run them on your own machine, the results might differ.

    Make sure you also run the latest version of each router when benchmarking.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.40(Nov 14, 2019)

  • v1.3.38(Nov 13, 2019)

    This releases focuses on reducing the router tree memory usage.

    The router tree memory usage in the GitHub benchmark went down from 800 KB to 135 KB, effectively reducing the required memory by 83%.

    As a side effect, this also improved the lookup performance by another 5-10%.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.37(Nov 13, 2019)

    Improved routing performance by ~15%.

    The biggest impact came from eliminating an unnecessary jump in the tree.find() function which slightly slowed down route lookup.

    Upgrade for a free performance boost.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Jun 1, 2019)

    With this release comes an apology to the community.

    Due to differences in opinions regarding the semver implementation in Go modules, this release will come as minor number upgrade even though it was intended to be a major version upgrade. I highly apologize for the troubles this causes, but I will try my best to make the upgrade process as painless as possible.

    Upgrade

    If you have an existing Aero project, you can perform 99% of the upgrades automatically via Search & Replace.

    Open your project files and replace everything listed here by the upcoming line:

    *aero.Context
    aero.Context
    
    *aero.RewriteContext
    aero.RewriteContext
    
    aero.Context) string {
    aero.Context) error {
    
    aero.Handle
    aero.Handler
    
    ctx.Request().Header().Get(
    ctx.Request().Header(
    
    ctx.Response().Header().Set(
    ctx.Response().SetHeader(
    
    ctx.URI()
    ctx.Path()
    
    ctx.SetURI(
    ctx.SetPath(
    
    app.Handler().ServeHTTP(
    app.ServeHTTP(
    
    ctx.StatusCode
    ctx.Status()
    
    ctx.RealIP()
    ctx.IP()
    

    Example: Search for *aero.Context and replace it with aero.Context in all .go files. The same applies to the rest.

    This should take care of all the necessary API changes.

    Benefits

    API

    Aero now has a much cleaner API compared to before. Several barely used functions have been removed in favor of delivering a cleaner interface.

    Performance

    Aero has become an extremely fast server package, outperforming both echo and gin:

    BenchmarkAeroStatic-12        100000         16643 ns/op          700 B/op         0 allocs/op
    BenchmarkAeroGitHubAPI-12      50000         27487 ns/op         1409 B/op         0 allocs/op
    BenchmarkAeroGplusAPI-12     1000000          1390 ns/op           69 B/op         0 allocs/op
    BenchmarkAeroParseAPI-12      500000          2558 ns/op          138 B/op         0 allocs/op
    
    BenchmarkEchoStatic-12         50000         30702 ns/op         1950 B/op       157 allocs/op
    BenchmarkEchoGitHubAPI-12      30000         45431 ns/op         2782 B/op       203 allocs/op
    BenchmarkEchoGplusAPI-12      500000          2500 ns/op          173 B/op        13 allocs/op
    BenchmarkEchoParseAPI-12      300000          4234 ns/op          323 B/op        26 allocs/op
    
    BenchmarkGinStatic-12          50000         37885 ns/op         8231 B/op       157 allocs/op
    BenchmarkGinGitHubAPI-12       30000         55092 ns/op        10903 B/op       203 allocs/op
    BenchmarkGinGplusAPI-12       500000          3059 ns/op          693 B/op        13 allocs/op
    BenchmarkGinParseAPI-12       300000          5687 ns/op         1363 B/op        26 allocs/op
    

    What if I'm not ready to upgrade?

    If you are not ready to upgrade yet, you can use exclude statements in your go.mod file:

    exclude github.com/aerogo/aero v1.3.0
    
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(May 22, 2019)

    The web manifest is no longer included in the Aero configuration as it has nothing to do with the web server functionalities and has now been separated to a different package: aerogo/manifest

    This means that if you relied on loading the web manifest data from config.json, you should now create a separate manifest.json and load it via manifest.FromFile("manifest.json").

    This change is required as not every web server absolutely needs to have a web manifest file. For those who need it, please see the linked package above.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.17(May 21, 2019)

    The command to create a new app has changed from aero -newapp to aero -new.

    Additionally, the run and pack tools have been updated to provide a smoother developer experience with the newest version of Aero.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Apr 26, 2019)

    This release includes a 10x performance improvement for most gzip based responses. It also nearly halves the amount of allocations and considerably lowers the total memory usage. This is possible thanks to the re-use of gzip writers via sync.Pool in version 1.1.0.

    Benchmark comparison using ~10 KB responses:

    Aero 1.0.6:

    BenchmarkBigResponse-12           20000         71625 ns/op      815383 B/op          38 allocs/op
    

    Aero 1.1.0:

    BenchmarkBigResponse-12          200000          7228 ns/op        1834 B/op          21 allocs/op
    
    Source code(tar.gz)
    Source code(zip)
  • v1.0.5(Apr 23, 2019)

  • v1.0.3(Apr 21, 2019)

  • v1.0.1(Mar 30, 2019)

  • v1.0.0(Mar 29, 2019)

Owner
Aero
A collection of web libraries for Go.
Aero
A high performance HTTP request router that scales well

HttpRouter HttpRouter is a lightweight high performance HTTP request router (also called multiplexer or just mux for short) for Go. In contrast to the

Julien Schmidt 14.8k Dec 29, 2022
Goal is a toolkit for high productivity web development in Go language in the spirit of Revel Framework that is built around the concept of code generation.

Goal Goal is a set of tools for high productivity web development in Go language. Goal, being mostly inspired by Revel Framework and its discussions,

null 88 Sep 27, 2021
A high level web-framework for Go

go-start is a high level web-framework for Go, like Django for Python or Rails for Ruby. Installation: go get github.com/ungerik/go-start Documentatio

Erik Unger 268 Dec 24, 2022
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Flamingo 343 Jan 5, 2023
Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

golanger 298 Nov 14, 2022
An ideally refined web framework for Go.

Air An ideally refined web framework for Go. High-performance? Fastest? Almost all web frameworks are using these words to tell people that they are t

Aofei Sheng 421 Dec 15, 2022
Web framework for creating apps using Go in Google AppEngine

Welcome to app.go v3.0 app.go is a simple web framework for use in Google AppEngine. Just copy the app folder to your working folder and import it fro

George Nava 46 Mar 21, 2021
Eudore is the core of a golang lightweight web framework.

Eudore eudore是一个golang轻量级web框架核心,可以轻松扩展成一个技术栈专用框架,具有完整框架设计体系。 反馈和交流请加群组:QQ群373278915。 Features 易扩展:主要设计目标、核心全部解耦,接口即为逻辑。 简单:对象语义明确,框架代码量少复杂度低,无依赖库。 易用

null 73 Nov 7, 2022
a golang web mvc framework, like asp.net mvc.

goku goku is a Web Mvc Framework for golang, mostly like ASP.NET MVC. doc & api Installation To install goku, simply run go get github.com/QLeelulu/go

QLeelulu 274 Dec 7, 2022
package for building REST-style Web Services using Go

go-restful package for building REST-style Web Services using Google Go Code examples using v3 REST asks developers to use HTTP methods explicitly and

Ernest Micklei 4.7k Jan 1, 2023