// the find
eddycjy/go-gin-example
An example of gin
A blog backend API built with Gin, GORM, MySQL, and Redis, written as a learning reference for Go web development patterns. It covers JWT auth, pagination, caching, file upload, Excel import/export, and QR code generation in one repo. The target audience is Go developers who want a concrete example of how these pieces fit together, not a production starting point.
The layered architecture (router → service → model) is genuinely clean for an example project — handlers stay thin and the separation makes the data flow easy to follow. Redis caching with a 1-hour TTL is wired in at the service layer rather than bolted on at the handler level, which is the right place for it. Swagger docs are generated and served in-process, so the API is self-documenting without a separate step. The custom GORM callbacks for CreatedOn/ModifiedOn/DeletedOn keep the timestamp logic out of every handler.
It uses `dgrijalva/jwt-go`, which has been archived and has a known security vulnerability (CVE-2020-26160); anyone copying this for real use needs to swap to `golang-jwt/jwt` immediately. The JWT secret in the example config is literally '233' and passed via query string token parameter rather than Authorization header — both are bad habits that would need unlearning. No tests anywhere in the repo, which undercuts its value as a reference for best practices. The vendor directory is checked in and contains Go 1.13-era dependencies; go.mod/go.sum management has moved on and this pattern will confuse people on modern toolchains.