
Martini
A small Go web framework for building modular web apps and services; no longer maintained.
- Stars
- 11.6k
- Forks
- 1.1k
- Licence
- MIT
- Language
- Go
- Last update
- 4.6 years ago
- Type
- Library
No commits in over a year — check for forks or alternatives before adopting.
What it is
Martini is a Go package for writing web applications and services. You register handler functions for URL routes, and Martini supplies the arguments they need (such as the request or a URL parameter) through dependency injection. The README says the framework is no longer maintained, so it is best understood as a mature but frozen project.
- Define GET, POST, PUT, PATCH, DELETE and OPTIONS routes with simple handler functions
- Group routes under a shared path prefix and attach middleware to the group
- Serve static files and return plain text or a status code with a response
- Map shared services, such as a database handle, so any handler can receive them
Great for
- Go developers who want a small, simple way to define HTTP routes and handlers
- Developers reading or maintaining existing Martini codebases
- People learning how middleware and dependency injection work in a Go web framework
Not ideal for
- New production projects, because the README states the framework is no longer maintained
- Teams that need active security fixes or new Go version support, since the last push was 2022-03-29
- Developers who want a framework with a large current ecosystem of recent releases
How to get it
- 1
Install with a package manager
You'll need: Go 1.1 or greater (per the README)
Install the Martini package
go get github.com/go-martini/martiniRun the example server
go run server.go - 2
Run it
- Install Go and set up your GOPATH as described in the README
- Create a file named server.go containing the hello-world example
- Run go get github.com/go-martini/martini to install the package
- Run go run server.go and open localhost:3000
- 3
Get the most out of it
- Use martini.Classic() to get logging, panic recovery, static file serving and routing with defaults
- Use m.Group with middleware to share authentication across a set of routes
- Map services with m.Map or c.MapTo to inject shared objects like a database into handlers
- Check the martini-contrib organization for additional middleware, as linked in the README
Downloads
Strengths
- Very simple API, as shown by the short hello-world example in the README
- Handlers are plain Go functions, so it fits with the standard net/http interface
- Modular: middleware and services can be added or removed easily
Trade-offs
- The README states the framework is no longer maintained, so no future fixes are expected
- The latest release is v1.0 with no binaries, and the last push was in March 2022
- Uses reflection for handler invocation, which the README describes as a design choice with trade-offs it does not detail
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| martini (this) | 11.6k | Library | beginner | 4.6 years ago | Go developers who want a small, simple way to define HTTP routes and handlers |
| gin | 89.5k | Library | intermediate | 27 days ago | Go developers building REST APIs |
| echo | 32.8k | Library | intermediate | 7 days ago | Go developers building REST APIs or backend services |
| chi | 23k | Library | intermediate | 19 days ago | Go developers building REST API services |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.