Go Web Frame¶
An integrated Go backend toolkit — zero-boilerplate CRUD, declarative route metadata, explicit dependency injection, and seamless reuse of the Gin ecosystem.
Quick Start Installation Source
Features¶
- Zero-Boilerplate CRUD —
Model[T]/EntryModel[T, PK]eliminate CRUD boilerplate with full type safety from database to handler — no code generation. - Declarative Route Metadata — Tag routes with
.WithMeta()and handle auth, permissions, and rate limiting in one global filter. - Explicit Dependency Injection — Register components through a fluent Builder — initialization order is fully transparent and controllable.
- Gin Ecosystem Compatible — Wraps HTTP requests/responses while exposing
req.GinContext()— CORS, Gzip, and other middlewares work out of the box. - GORM Ecosystem Compatible —
db.GetGorm()exposes the underlying*gorm.DB— any GORM driver, plugin, callback, or tag works natively. - Built-in Components — Rate limiting, caching, captcha, cron scheduling, authentication, CORS — all pre-integrated and ready to use.
- Production Ready — Let's Encrypt auto HTTPS, graceful shutdown, connection pooling, structured logging — deploy to production with confidence.
30-Second Hello World¶
package main
import (
"context"
wf "github.com/chuccp/go-web-frame"
"github.com/chuccp/go-web-frame/config"
"github.com/chuccp/go-web-frame/web"
)
func main() {
cfg, _ := config.LoadSingleFileConfig("application.yml")
builder := wf.NewBuilder(cfg)
builder.Get("/", func(c *web.Request) (any, error) {
return "Hello, World!", nil
})
builder.Build().Run(context.Background())
}
Quick Navigation¶
| Installation | Quick Start | Routing |
| Controller | Model | Service |
| Filter | Converter | Error Code |
| Configuration | Logging | Runner |
| Components | WebSocket & SSE | Database |
| Deployment |
Tech Stack¶
| Layer | Library | Role |
|---|---|---|
| HTTP | Gin | Router, middleware chain, parameter binding |
| ORM | GORM | Underlying SQL driver, migrations, joins/preload |
| Config | Viper | Multi-format, multi-path loading |
| Logging | Zap | Structured, leveled, rotated logging |
| JSON | Sonic | High-performance marshal/unmarshal |
| Cache | Otter | Local in-memory cache |
| Redis | go-redis | Pub/sub, caching |
| SQLite | modernc/sqlite | Pure Go, zero CGO |
| Validation | go-playground/validator | Struct tag validation |
| WebSocket | coder/websocket | Upgrade, read/write |
| Cron | robfig/cron | Expression-based scheduling |