Skip to content

Marten

Marten

The framework you reach for when you want nothing in the way.

Fast. Simple. Elegant. Zero dependencies.

  • Quick to Start


    Get up and running in seconds with a minimal, intuitive API that feels like writing pure Go.

    Getting started

  • Blazing Fast


    Radix tree router, context pooling, and zero allocations where it matters. Built for performance.

    Benchmarks

  • Middleware Ready


    13 built-in middleware for logging, auth, CORS, rate limiting, compression, and more.

    Middleware

  • Zero Dependencies


    Only Go's standard library. No external dependencies means no supply chain risks.

    Philosophy

Quick Example

package main

import "github.com/gomarten/marten"

func main() {
    app := marten.New()

    app.GET("/", func(c *marten.Ctx) error {
        return c.OK(marten.M{"message": "Hello, Marten!"})
    })

    app.Run(":3000")
}

That's it. No boilerplate. No configuration files. Just code.

Features

// Static routes
app.GET("/users", listUsers)

// Path parameters
app.GET("/users/:id", getUser)

// Wildcard routes
app.GET("/files/*filepath", serveFiles)

// Route groups
api := app.Group("/api/v1")
api.GET("/posts", listPosts)
func handler(c *marten.Ctx) error {
    // Path params
    id := c.ParamInt("id")

    // Query params
    page := c.QueryInt("page")

    // JSON binding
    var user User
    c.Bind(&user)

    // Response helpers
    return c.OK(user)
}
app.Use(
    middleware.Logger,
    middleware.Recover,
    middleware.CORS(middleware.DefaultCORSConfig()),
    middleware.RateLimit(middleware.RateLimitConfig{
        Requests: 100,
        Window:   time.Minute,
    }),
)
// API versioning
v1 := app.Group("/api/v1")
v1.GET("/users", listUsersV1)

// Protected routes
admin := app.Group("/admin")
admin.Use(authMiddleware)
admin.GET("/dashboard", dashboard)

Performance

Marten performs on par with Gin and Echo while maintaining zero dependencies.

Benchmark Marten Gin Echo Chi
Static Route 1464 ns/op 1336 ns/op 1436 ns/op 2202 ns/op
Param Route 1564 ns/op 1418 ns/op 1472 ns/op 2559 ns/op
JSON Response 1755 ns/op 2050 ns/op 1835 ns/op 1868 ns/op

Benchmarks run on Intel Xeon Platinum 8259CL @ 2.50GHz, Go 1.24

Full benchmark results

Context Pooling

Marten uses sync.Pool to reuse context objects, minimizing garbage collection pressure under high load.

Installation

go get github.com/gomarten/marten

Requires Go 1.22 or later.

Why Marten?

Most Go web frameworks grow until they become the problem they set out to solve. Marten stays small on purpose.

  • Minimal


    ~1000 lines of code. Easy to read, understand, and contribute to.

  • Explicit


    No magic. No reflection. No struct tags for routing. What you see is what you get.

  • Composable


    Middleware, groups, and handlers compose naturally. Build complex apps from simple pieces.

  • Idiomatic


    Feels like writing Go, not fighting it. Uses standard library patterns throughout.

What Marten Does Not Do

These are intentional omissions:

  • ❌ No ORM
  • ❌ No template engine
  • ❌ No CLI tools
  • ❌ No code generation
  • ❌ No reflection magic
  • ❌ No struct tags for routing
  • ❌ No global state
  • ❌ No opinionated project structure

If you need these features, there are excellent libraries that do them well. Marten focuses on being the best routing and middleware layer.

Next Steps

License

MIT License. Use it however you want.