Skip to content

Introduction ​

Zen is a lightweight, high-performance HTTP microframework for Go built on a custom per-method radix tree router with zero-allocation path parameter extraction, delivering performance on par with popular Go frameworks.

Philosophy ​

  • Minimal dependencies - core relies on go-playground/validator/v10; optional packages add only what you import
  • Minimal API surface - just enough abstraction to be productive without hiding net/http
  • Performance - comparable to hand-optimized handlers
  • Go standard library first - middleware and handlers receive raw net/http types

Quick Example ​

go
package main

import (
    "github.com/Pavan-Silva/go-zen"
    "github.com/Pavan-Silva/go-zen/middleware"
)

func main() {
    r := zen.New(":8080")
    r.Use(middleware.Recover)
    r.Use(middleware.Logger)

    r.GET("/hello", func(c *zen.Ctx) {
        c.String(200, "Hello, World!")
    })

    r.GET("/users/{id}", func(c *zen.Ctx) {
        id := c.Param("id")
        c.JSON(200, map[string]string{"id": id})
    })

    r.Run()
}

Released under the MIT License.