Scripts2026年5月25日·1 分钟阅读

GoFrame — Modular Full-Stack Web Framework for Go

GoFrame is a batteries-included Go framework providing HTTP server, ORM, caching, logging, configuration, and CLI scaffolding in one cohesive package.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
GoFrame Overview
通用 CLI 安装命令
npx tokrepo install 39e191a5-5837-11f1-9bc6-00163e2b0d79

Introduction

GoFrame (GF) is a comprehensive Go application framework that bundles an HTTP server, database ORM, caching, configuration management, and a development CLI. It targets teams building production web services who want convention over configuration without stitching together separate libraries.

What GoFrame Does

  • Provides a high-performance HTTP server with middleware and routing groups
  • Includes a full ORM with model generation, transactions, and soft deletes
  • Manages configuration from files, environment variables, and remote sources
  • Ships a CLI tool for project scaffolding, code generation, and database migration
  • Offers built-in modules for logging, validation, i18n, and scheduled tasks

Architecture Overview

GoFrame follows a modular monolith design where each subsystem (HTTP, ORM, cache, config, log) is an independent module behind a unified API. The core container provides dependency injection, and modules communicate through well-defined interfaces. The ORM uses a chainable query builder on top of database/sql with driver adapters for MySQL, PostgreSQL, SQLite, and others.

Self-Hosting & Configuration

  • Install the CLI: go install github.com/gogf/gf/cmd/gf/v2@latest
  • Scaffold a project: gf init projectname
  • Configure via manifest/config/config.yaml for server, database, and logging
  • Generate model and DAO code from database tables: gf gen dao
  • Deploy as a single binary; use gf build for cross-platform compilation

Key Features

  • Unified framework reduces dependency management overhead
  • Code generation accelerates CRUD development with type-safe models
  • Context-aware logging and tracing integrate with OpenTelemetry
  • Modular design allows using individual components without the full framework
  • Active Chinese and English documentation with growing community

Comparison with Similar Tools

  • Gin — Lightweight HTTP router only; GoFrame provides ORM, config, and CLI on top
  • Beego — Similar full-stack approach but GoFrame has a more modern API and active maintenance
  • Echo — Focused on HTTP middleware; lacks built-in ORM and code generation
  • Kratos — Microservices-oriented with gRPC focus; GoFrame targets monolithic and modular apps

FAQ

Q: Is GoFrame suitable for microservices? A: Yes. Its modular design lets you use only the HTTP and gRPC components for lightweight services.

Q: How does the ORM compare to GORM? A: GoFrame ORM is tightly integrated with the framework and offers code generation. GORM is standalone and more widely adopted outside GoFrame projects.

Q: Can I use GoFrame with an existing Go project? A: Yes. Individual modules like the HTTP server or ORM can be imported independently.

Q: What databases does GoFrame support? A: MySQL, PostgreSQL, SQLite, Oracle, SQL Server, and ClickHouse via community drivers.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产