Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 11, 2026·3 min de lectura

Beego — Full-Featured Go Web Framework with MVC and ORM

Beego is a batteries-included web framework for Go that ships with an MVC architecture, built-in ORM, session handling, caching, and a live-reload dev server.

Introduction

Beego is an open-source, high-performance web framework for Go that follows the MVC pattern. It provides a comprehensive toolkit including an ORM, HTTP router, session manager, config parser, and a CLI tool called Bee that automates project scaffolding and live reload during development.

What Beego Does

  • Provides a full MVC architecture with controllers, models, views, and routers
  • Includes a built-in ORM supporting MySQL, PostgreSQL, SQLite, and Oracle
  • Ships with session management, caching, logging, and config modules
  • Offers the Bee CLI for scaffolding, live reload, code generation, and database migrations
  • Supports RESTful API design with automatic API documentation via Swagger

Architecture Overview

Beego's architecture is modular: the core HTTP server handles routing via a tree-based router, dispatching requests to controller methods. The ORM layer uses reflection-based model registration and supports raw SQL, QuerySets, and transactions. Middleware (called filters) hook into the request lifecycle at configurable stages. The Bee CLI watches file changes and rebuilds the binary on save.

Self-Hosting & Configuration

  • Install via go get github.com/beego/beego/v2 and go install github.com/beego/bee/v2@latest
  • Configure through conf/app.conf using INI-style key-value pairs
  • Set runmode = prod for production, dev for development with auto-reload
  • Enable HTTPS by setting EnableHTTPS = true with cert/key paths
  • Use environment variable overrides with ${ENV_VAR} syntax in config files

Key Features

  • Bee CLI provides scaffolding, live reload, migration, and Swagger doc generation
  • Built-in ORM supports CRUD, raw SQL, transactions, and query builder
  • Namespace-based routing groups endpoints cleanly for versioned APIs
  • Annotation-based router can parse comments on controller methods
  • Task module provides cron-like scheduled job execution within the app

Comparison with Similar Tools

  • Gin — Lighter and faster for pure APIs, but lacks ORM, session, and scaffolding tools
  • Echo — Minimal and performant; Beego offers more built-in modules out of the box
  • Fiber — Fasthttp-based and very fast; Beego uses net/http and provides broader batteries
  • Revel — Also full-stack Go framework but less actively maintained than Beego
  • Buffalo — Similar batteries-included approach but smaller community and fewer built-in modules

FAQ

Q: Is Beego still actively maintained? A: Yes. Beego v2 is under active development with regular releases and community contributions.

Q: Can I use Beego just for APIs without the view layer? A: Yes. You can use Beego as a pure REST API framework and skip the template engine entirely.

Q: How does Beego's ORM compare to GORM? A: Beego's ORM is simpler and tightly integrated with the framework. GORM is more feature-rich as a standalone library with broader community plugins.

Q: Does Beego support middleware? A: Yes. Beego calls them filters, and they can be registered at multiple stages of the request lifecycle.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados