An enterprise-grade, modular Go framework designed for building scalable web applications.
- Modular Design: Decoupled components for HTTP, Database, Logging, Config, and CLI.
- HTTP Server: Built on Gin with custom middleware support.
- Database: Integrated Gorm with repository pattern support (MySQL, SQLite).
- Logging: Structured logging with Zap and log rotation (Lumberjack).
- Configuration: Viper-based configuration management (YAML, JSON, Env, Flags).
- CLI: Cobra-based CLI for project scaffolding and management.
go install github.com/project/go-framework/cmd/goframework@latest-
Create a new project:
goframework new my-app
-
Run the project:
cd my-app go mod tidy go run cmd/server/main.go
my-app/
├── cmd/
│ └── server/ # Main application entry point
├── configs/ # Configuration files
├── internal/
│ ├── api/ # HTTP handlers
│ ├── models/ # Database models
│ └── service/ # Business logic
├── pkg/ # Public libraries
├── go.mod
└── Makefile
The framework uses config.yaml by default. Example:
app:
name: my-app
version: 1.0.0
server:
port: 8080
mode: debug
log:
level: info
database:
driver: sqlite
source: test.dbUse the generic Repository for CRUD operations:
repo := database.NewRepository[models.User](db)
err := repo.Create(&user)
user, err := repo.FindByID(1)MIT