Introduction
Welcome to Mach - A lightweight, minimalist web framework for Go
Mach
Mach is a minimalist web framework for Go, inspired by Python's Bottle and designed for developers who value simplicity and performance. It is built directly on top of the Go standard library's net/http package, leveraging the powerful new routing capabilities introduced in Go 1.22.
Built on Go 1.22's enhanced net/http router with zero external
dependencies. This ensures future-proof compatibility and stability.
Why Mach?
- 🚀 Go 1.22+ Routing: Leverages stdlib pattern matching for path parameters and wildcards.
- ⚡ Context Pooling: Minimal allocations in hot paths using
sync.Poolfor optimal performance. - 🎯 Standard Patterns: No magic, just clean and idiomatic Go code.
- 📦 Zero Dependencies: Core framework uses only the Go standard library.
- 🔧 Middleware Ready: Built-in Logger, Recovery, and CORS middleware.
- 🛡️ Production Ready: Graceful shutdown, timeouts, and TLS support out of the box.
Philosophy
Mach embraces minimalism without sacrificing functionality. It provides the essential building blocks for web applications while staying out of your way. You get:
- Clean, predictable APIs.
- Familiar HTTP semantics.
- Easy-to-understand middleware patterns.
- Performance-focused design.
Features
- Routing: Support for all standard HTTP methods (
GET,POST,PUT,DELETE, etc.) with group support. - Context: A powerful
Contextobject for handling requests and responses efficiently. - Middleware: Easy-to-use middleware system with built-in options.
- Data Binding: Helpers for JSON and XML binding.
- Response Helpers: Simple methods for sending JSON, XML, HTML, and text responses.
- Static Files: Serve static files with ease.