$ show tiger1103/gfast
GFast is a full-stack, modular admin panel built with GoFrame v2.10 and Vue3. It provides a RESTful API backend for managing users, roles, departments, menus, dictionaries, configuration, logs, and system monitoring. The architecture follows a layered pattern: API definitions (api/v1), controllers (internal/app/*/controller), business logic (internal/app/*/logic), data access objects (dao), and service interfaces. Authentication uses JWT (gfast-token) and authorization uses Casbin with RBAC. Caching is abstracted via gfast-cache supporting memory or Redis. The system includes a code generator, scheduled tasks, and an OpenAPI/Swagger endpoint. External dependencies include MySQL, Redis, Casbin, and ip2region for IP geolocation.
The LLM identified 4 files worth highlighting for reuse:
Provides reusable utility functions including password hashing (EncryptPassword), client IP retrieval, local IP detection, IP-to-city geolocation using ip2region, file path parsing, and directory creation. These functions are self-contained with no internal project dependencies, making them extractable for any Go project.
Implements a consistent error handling pattern with custom error codes (CodeInfo, CodeWarning, CodeError). Functions like ErrIsNil and ValueIsNil panic with gerror.NewCode, allowing centralized error management. The pattern is simple, testable (see err_test.go), and can be reused across projects to standardize error responses.
Provides a generic router auto-binding mechanism using reflection. It scans methods of a struct matching a naming convention (e.g., BindXXXController) and automatically registers them with the GoFrame router group. This pattern reduces boilerplate and can be adapted to any Go web framework that supports group routing.
Implements a Casbin Watcher using Redis Pub/Sub for distributed policy synchronization across multiple instances. It subscribes to a Redis channel and triggers policy reload on updates. The implementation is self-contained (only depends on GoFrame's Redis client) and demonstrates a clean pattern for keeping Casbin policies in sync in clustered deployments.