Skip to content

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

License

Notifications You must be signed in to change notification settings

go-macaron/macaron

Folders and files

NameName
Last commit message
Last commit date
Feb 24, 2025
Nov 13, 2020
Mar 12, 2016
Dec 20, 2021
Jul 15, 2016
Feb 25, 2023
Oct 17, 2017
Feb 25, 2023
Mar 29, 2020
Sep 9, 2024
Sep 9, 2024
Mar 11, 2025
Mar 11, 2025
Dec 20, 2021
Aug 4, 2019
Dec 20, 2021
Mar 28, 2020
Oct 13, 2014
Sep 9, 2024
Mar 28, 2020
Sep 9, 2024
Mar 28, 2020
Mar 28, 2020
Mar 28, 2020
Mar 28, 2020
Jan 28, 2017
Feb 25, 2023
Mar 28, 2020
Aug 17, 2020
Sep 9, 2024
Dec 20, 2021
Dec 20, 2021

Repository files navigation

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.