Introduction
Revel is a full-stack web framework for Go that follows the MVC pattern. It draws inspiration from Play Framework and Ruby on Rails, aiming to provide a productive developer experience with hot code reload and convention-over-configuration defaults for Go web applications.
What Revel Does
- Provides a complete MVC architecture with controllers, models, and templates
- Offers automatic hot code reload during development without manual restarts
- Includes a built-in testing framework for functional and unit tests
- Ships with a routing engine that maps URLs to controller actions via a routes file
- Bundles validation, session management, caching, and job scheduling out of the box
Architecture Overview
Revel runs as a self-contained server process. Incoming HTTP requests are matched against a compiled route table, dispatched to controller actions, and rendered through Go's html/template engine. The framework intercepts source changes via a file watcher and triggers a recompile-and-restart cycle transparently, giving a scripting-language feel to compiled Go code.
Self-Hosting & Configuration
- Install via
go install github.com/revel/cmd/revel@latest - Create a new project with
revel new <app-name> - Configuration lives in
conf/app.confwith INI-style key-value pairs - Set
http.addrandhttp.portfor binding; TLS viahttp.ssl.*keys - Deploy as a compiled binary with
revel packagefor production
Key Features
- Hot code reload removes the edit-compile-run loop in development
- Convention-based project layout reduces boilerplate decisions
- Built-in interceptors (filters) for cross-cutting concerns like auth and logging
- Integrated parameter validation with struct tag annotations
- Job scheduling module for background and periodic tasks
Comparison with Similar Tools
- Gin — minimal router; Revel is a full MVC framework with more built-in modules
- Echo — focused on REST APIs; Revel adds templates, sessions, and job scheduling
- Beego — similar full-stack scope; Revel emphasizes hot reload and Play-style routing
- Buffalo — comparable productivity focus; Revel has a longer track record
- Fiber — high-performance micro framework; Revel trades raw speed for developer convenience
FAQ
Q: Does Revel support Go modules? A: Yes. Since Revel v1.0 the framework fully supports Go modules for dependency management.
Q: Is hot reload suitable for production?
A: No. Hot reload is a development feature. For production, use revel package to build a static binary.
Q: Can I use a different template engine? A: Yes. Revel's rendering layer is pluggable; you can swap in Pongo2 or any engine that satisfies the template interface.
Q: How does routing work?
A: Routes are defined in conf/routes using a simple format mapping HTTP methods and URL patterns to controller actions.