• Stars
    star
    3,474
  • Rank 12,247 (Top 0.3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated 24 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

session

Package session is a middleware that provides the session management of Macaron.
Go
27
star
2

binding

Package binding is a middleware that provides request data binding and validation for Macaron.
Go
23
star
3

captcha

Package captcha is a middleware that provides captcha service for Macaron.
Go
19
star
4

toolbox

Package toolbox is a middleware that provides health check, pprof, profile and statistic services for Macaron.
Go
19
star
5

cache

Package cache is a middleware that provides the cache management of Macaron.
Go
18
star
6

oauth2

Package oauth2 is a middleware that provides support of user login via an OAuth 2.0 backend for Macaron.
Go
15
star
7

docs

An open source project for Macaron documentation.
14
star
8

pongo2

Package pongo2 is a middleware that provides pongo2 template engine support for Macaron.
Go
13
star
9

inject

Package inject provides utilities for mapping and injecting dependencies in various ways.
Go
13
star
10

i18n

Package i18n provides an Internationalization and Localization middleware for Macaron applications
Go
12
star
11

authz

Go
11
star
12

renders

Package renders is a middleware, that provides template render for Macaron.
Go
11
star
13

examples

Simple examples for Macaron + X.
Go
10
star
14

auth

Go
10
star
15

csrf

Package csrf is a middleware that generates and validates CSRF tokens for Macaron.
Go
8
star
16

bindata

Package bindata is a helper module that allows to use in-memory static and template files for Macaron.
Go
8
star
17

cors

Go
3
star
18

macaron.peach

This is a repository of Macaron documentation for Peach configuration.
HTML
3
star
19

gzip

Package gzip is a middleware that provides Gzip compress to responses for Macaron.
Go
3
star
20

jade

Package jade is a middleware that provides jade template engine support for Macaron.
Go
2
star
21

switcher

Package switcher is a helper module that provides host switch functionality for Macaron.
Go
1
star