# Gin单体框架 **Repository Path**: trident-framework/single-gin-framework ## Basic Information - **Project Name**: Gin单体框架 - **Description**: 三叉戟gin单体框架 可运行golang版本【v1.18、v1.19、v1.20、v1.21、v1.22、1.23】 - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-03 - **Last Updated**: 2026-01-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Single Gin Framework This is a project template based on the Gin framework, integrating various commonly used middleware and tools, suitable for quickly building microservice applications. ## Features - Supports multiple databases and middleware (MySQL, MongoDB, Redis, RabbitMQ, ElasticSearch) - Integrated configuration center (Nacos, Consul, Etcd) - Provides JWT authentication and verification code functionality - Includes features such as logging, rate limiting, and circuit breaking - Supports Docker deployment ## Directory Structure - `config/` Configuration file directory - `controllers/` Controller directory - `models/` Data model directory - `routers/` Routing directory - `middlewares/` Middleware directory - `utils/` Utility function directory - `Dockerfile` Docker configuration file - `docker-compose.yaml` Docker Compose configuration file - `go.mod` Go module configuration file ## Installation 1. Install dependencies ```bash go mod download ``` 2. Configure environment variables ```bash export RUNENV=dev export PORT=9501 ``` 3. Build and run the project ```bash go build -o single-gin ./single-gin --env $RUNENV ``` ## Usage ### Starting the Service ```bash ./single-gin --env dev ``` ### Docker Deployment ```bash docker build -t single-gin . docker run -d -p 9501:9501 -e RUNENV=dev single-gin ``` ## Routes - `/api/v1/index` Home page - `/api/v1/user/login` User login - `/api/v1/user/mobile-login` Mobile login - `/api/v1/user/login-send-code` Send login verification code - `/api/v1/user/register` User registration - `/api/v1/user/edit` Edit user information - `/api/v1/user/detail` Get user details ## Configuration - `config/app.yml` Application configuration - `config/database.yml` Database configuration - `config/redis.yml` Redis configuration - `config/rabbit.yml` RabbitMQ configuration - `config/es.yml` ElasticSearch configuration - `config/nacos.yml` Nacos configuration ## Middleware - `CorsMiddleware` Cross-Origin middleware - `FrontendAuthMiddleware` Frontend authentication middleware - `MgrAuthMiddleware` Admin authentication middleware - `RecoveryMiddleware` Exception recovery middleware - `ZapLoggerMiddleware` Logging middleware ## Utilities - `utils/helpers.go` Common utility functions - `utils/token.go` JWT authentication tools - `utils/captcha.go` Verification code generation tools - `utils/zapLogger.go` Logging tools ## Contribution Pull Requests and Issues are welcome. Please follow the project's code style and submission guidelines. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.