Introduction
Buffalo is an opinionated Go web framework that bundles everything needed to build modern web applications: routing, templating, database migrations, background jobs, and an asset pipeline. It follows the convention-over-configuration philosophy familiar to Rails and Django developers, adapted for the Go ecosystem.
What Buffalo Does
- Scaffolds full Go web projects with a single CLI command
- Provides a Gorilla Mux-based router with middleware support
- Integrates Pop ORM for database operations and migrations
- Compiles frontend assets with Webpack and serves them alongside Go templates
- Includes a code generator for models, actions, and resources
Architecture Overview
Buffalo wraps several established Go libraries into a cohesive stack. The HTTP layer uses Gorilla Mux for routing and the standard net/http server. Pop handles database connections, migrations, and query building for PostgreSQL, MySQL, SQLite, and CockroachDB. Plush serves as the template engine with helpers for forms and pagination. The CLI orchestrates code generation, migrations, and the development server with hot reload.
Self-Hosting & Configuration
- Install the CLI with
go install github.com/gobuffalo/cli/cmd/buffalo@latest - Generate a new project with
buffalo new myapp --db-type postgres - Configure database connections in
database.ymlper environment - Run migrations with
buffalo pop migrateto apply schema changes - Build a static binary with
buffalo buildfor deployment without a Go toolchain
Key Features
- Full-stack scaffolding that generates models, handlers, views, and tests
- Hot reload during development via
buffalo dev - Pop ORM with Fizz DSL for database-agnostic migrations
- Background job processing with built-in worker support
- Plugin system for extending the CLI and framework
Comparison with Similar Tools
- Gin — minimal router and middleware only, no ORM, templates, or scaffolding
- Echo — lightweight HTTP framework, requires assembling your own database and asset tooling
- Fiber — fasthttp-based, high performance but no built-in full-stack workflow
- Ruby on Rails — same philosophy but for Ruby; Buffalo is the closest Go equivalent
FAQ
Q: Is Buffalo suitable for APIs without a frontend?
A: Yes. Use buffalo new myapp --api to generate an API-only project without Webpack or templates.
Q: What databases does Buffalo support? A: PostgreSQL, MySQL, SQLite, and CockroachDB via the Pop ORM library.
Q: Does Buffalo support WebSockets? A: Not out of the box. You can add WebSocket handling with the Gorilla WebSocket library alongside Buffalo routes.
Q: How does Buffalo compare to Spring Boot for productivity? A: Both offer scaffolding and convention-over-configuration. Buffalo produces a single binary with fast startup, while Spring Boot provides a larger ecosystem of enterprise integrations.