MCPcopy Index your code
hub / github.com/go-macaron/macaron

github.com/go-macaron/macaron @v1.5.1

repository ↗ · DeepWiki ↗ · release v1.5.1 ↗ · + Follow
354 symbols 1,362 edges 21 files 146 documented · 41% updated 4mo agov1.5.1 · 2025-07-15★ 3,5467 open issues
README

Macaron

GitHub Workflow Status codecov GoDoc Sourcegraph

Macaron Logo

Package macaron is a high productive and modular web framework in Go.

📣 Announcement

  • If you're considering using Macaron, you may want to take a look at Flamego first, which is the successor of the Macaron.
  • That means Macaron is officially in the maintenance mode, and no major features will be added to Macaron.

Getting Started

The minimum requirement of Go is 1.18.

To install Macaron:

go get gopkg.in/macaron.v1

The very basic usage of Macaron:

package main

import "gopkg.in/macaron.v1"

func main() {
    m := macaron.Classic()
    m.Get("/", func() string {
        return "Hello world!"
    })
    m.Run()
}

Features

  • Powerful routing with suburl.
  • Flexible routes combinations.
  • Unlimited nested group routers.
  • Directly integrate with existing services.
  • Dynamically change template files at runtime.
  • Allow to use in-memory template and static files.
  • Easy to plugin/unplugin features with modular design.
  • Handy dependency injection powered by inject.
  • Better router layer and less reflection make faster speed.

Middlewares

Middlewares allow you easily plugin/unplugin features for your Macaron applications.

There are already many middlewares to simplify your work:

  • render - Go template engine
  • static - Serves static files
  • gzip - Gzip compression to all responses
  • binding - Request data binding and validation
  • i18n - Internationalization and Localization
  • cache - Cache manager
  • session - Session manager
  • csrf - Generates and validates csrf tokens
  • captcha - Captcha service
  • pongo2 - Pongo2 template engine support
  • sockets - WebSockets channels binding
  • bindata - Embed binary data as static and template files
  • toolbox - Health check, pprof, profile and statistic services
  • oauth2 - OAuth 2.0 backend
  • authz - ACL/RBAC/ABAC authorization based on Casbin
  • switcher - Multiple-site support
  • method - HTTP method override
  • permissions2 - Cookies, users and permissions
  • renders - Beego-like render engine(Macaron has built-in template engine, this is another option)
  • piwik - Server-side piwik analytics

Use Cases

  • Gogs: A painless self-hosted Git Service
  • Grafana: The open platform for beautiful analytics and monitoring
  • Peach: A modern web documentation server
  • Go Walker: Go online API documentation
  • Critical Stack Intel: A 100% free intel marketplace from Critical Stack, Inc.

Getting Help

Credits

License

This project is under the Apache License, Version 2.0. See the LICENSE file for the full license text.

Extension points exported contracts — how you extend this code

TemplateFile (Interface)
TemplateFile represents a interface of template file that has name and can be read. [1 implementers]
render.go
ResponseWriter (Interface)
ResponseWriter is a wrapper around http.ResponseWriter that provides extra information about the response. It is recomme [1 …
response_writer.go
Handle (FuncType)
Handle is a function that can be registered to a route to handle HTTP requests. Like http.HandlerFunc, but has a third p
router.go
Handler (Interface)
Handler can be any callable function. Macaron attempts to inject services into the handler's argument list, and panics i
macaron.go
LoggerInvoker (FuncType)
LoggerInvoker is an inject.FastInvoker wrapper of func(ctx *Context, log *log.Logger).
logger.go
Locale (Interface)
Locale reprents a localization interface.
context.go
ReturnHandler (FuncType)
ReturnHandler is a service that Martini provides that is called when a route handler returns something. The ReturnHandle
return_handler.go
TemplateFileSystem (Interface)
TemplateFileSystem represents a interface of template file system that able to list all files. [1 implementers]
render.go

Core symbols most depended-on inside this repo

Get
called by 142
render.go
ServeHTTP
called by 106
router.go
String
called by 84
context.go
Use
called by 61
macaron.go
New
called by 45
macaron.go
Match
called by 34
tree.go
Classic
called by 30
macaron.go
Add
called by 27
tree.go

Shape

Method 197
Function 111
Struct 28
FuncType 10
Interface 6
TypeAlias 2

Languages

Go100%

Modules by API surface

render.go90 symbols
context.go55 symbols
router.go41 symbols
macaron.go27 symbols
tree.go21 symbols
response_writer.go19 symbols
render_test.go17 symbols
static.go14 symbols
response_writer_test.go12 symbols
router_test.go11 symbols
macaron_test.go10 symbols
cookie/helper.go8 symbols

Dependencies from manifests, versioned

github.com/go-macaron/injectv0.0.0-2016062717001 · 1×
github.com/jtolds/glsv4.20.0+incompatible · 1×
github.com/smarty/assertionsv1.15.0 · 1×
github.com/unknwon/comv0.0.0-2019080404291 · 1×
golang.org/x/cryptov0.40.0 · 1×
gopkg.in/ini.v1v1.66.6 · 1×

For agents

$ claude mcp add macaron \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact