Macaron

Go的高生产力和模块化网络框架。(A high productive and modular web framework in Go.)

Github stars Tracking Chart

Macaron 是一个具有高生产力和模块化设计的 Go Web 框架。框架秉承了 Martini 的基本思想,并在此基础上做出高级扩展。

Macaron 主要特性
  • 支持子路由的强大路由设计
  • 支持灵活多变的路由组合
  • 支持无限路由组的无限嵌套
  • 支持直接集成现有的服务
  • 支持运行时动态设置需要渲染的模板集
  • 支持使用内存文件作为静态资源和模板文件
  • 支持对模块的轻松接入与解除
  • 采用 inject 提供的便利的依赖注入
  • 采用更好的路由层和更少的反射来提升执行速度

Main metrics

Overview
Name With Ownergo-macaron/macaron
Primary LanguageGo
Program languageGo (Language Count: 2)
Platform
License:Apache License 2.0
所有者活动
Created At2014-07-10 03:13:30
Pushed At2025-04-19 20:12:31
Last Commit At
Release Count31
Last Release Namev1.5.0 (Posted on )
First Release Namev1 (Posted on )
用户参与
Stargazers Count3.5k
Watchers Count140
Fork Count286
Commits Count288
Has Issues Enabled
Issues Count167
Issue Open Count7
Pull Requests Count71
Pull Requests Open Count1
Pull Requests Close Count17
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Macaron Build Status

Macaron Logo

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

Getting Started

The minimum requirement of Go is 1.6.

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.