{"id":26930292,"url":"https://github.com/limitcool/starter","last_synced_at":"2025-04-02T06:18:17.597Z","repository":{"id":173271728,"uuid":"650480405","full_name":"limitcool/starter","owner":"limitcool","description":"starter 是一个 Go + gin 框架的项目脚手架,提供开箱即用的工具、库和 gin 项目配置,帮助您快速启动 gin 驱动的 API 项目开发。","archived":false,"fork":false,"pushed_at":"2024-12-16T02:48:24.000Z","size":165,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-16T03:22:56.467Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/limitcool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-07T06:54:17.000Z","updated_at":"2024-12-16T02:48:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"786b340d-7639-4c77-900e-7b0c368f369a","html_url":"https://github.com/limitcool/starter","commit_stats":null,"previous_names":["limitcool/starter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limitcool%2Fstarter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limitcool%2Fstarter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limitcool%2Fstarter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limitcool%2Fstarter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/limitcool","download_url":"https://codeload.github.com/limitcool/starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246763881,"owners_count":20829800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-02T06:18:17.116Z","updated_at":"2025-04-02T06:18:17.588Z","avatar_url":"https://github.com/limitcool.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Starter\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/limitcool/starter.svg)](https://pkg.go.dev/github.com/limitcool/starter)\n[![Go Report Card](https://goreportcard.com/badge/github.com/limitcool/starter)](https://goreportcard.com/report/github.com/limitcool/starter)\n\n## 特征\n- 提供 gin 框架项目模版\n- 集成 GORM 进行 ORM 映射和数据库操作\n  - 支持 PostgreSQL (使用 pgx 驱动)\n- 集成 Viper 进行配置管理\n- 提供常用 gin 中间件和工具\n  - 跨域中间件:处理 API 跨域请求,实现 CORS 支持\n  - jwt 解析中间件:从请求中解析并验证 JWT Token,用于 API 身份认证\n\n## 快速开始\n\n```bash\ngo install github.com/go-eagle/eagle/cmd/eagle@latest\neagle new \u003cproject name\u003e -r https://github.com/limitcool/starter -b main\n```\n\n## 环境配置\n\n通过环境变量 `APP_ENV` 来指定运行环境：\n\n- `APP_ENV=dev` 或 `APP_ENV=development` - 开发环境（默认）\n- `APP_ENV=test` 或 `APP_ENV=testing` - 测试环境\n- `APP_ENV=prod` 或 `APP_ENV=production` - 生产环境\n\n示例：\n```bash\n# 开发环境运行\nAPP_ENV=dev go run main.go\n\n# 生产环境运行\nAPP_ENV=prod ./starter\n```\n\n## 配置文件\n\n配置文件位于 `configs` 目录：\n\n- `config.yaml` - 默认配置\n- `config-dev.yaml` - 开发环境配置\n- `config-test.yaml` - 测试环境配置\n- `config-prod.yaml` - 生产环境配置\n- `config.example.yaml` - 示例配置（用于版本控制）\n\n首次使用时，请复制 `config.example.yaml` 并根据环境重命名：\n\n```bash\n# 开发环境\ncp configs/config.example.yaml configs/config-dev.yaml\n\n# 生产环境\ncp configs/config.example.yaml configs/config-prod.yaml\n```\n\n配置文件加载顺序：\n1. 加载 `config.yaml` 作为默认配置\n2. 根据 `APP_ENV` 加载对应的环境配置文件，覆盖默认配置\n\n## 日志配置\n\n项目使用 [charmbracelet/log](https://github.com/charmbracelet/log) 作为日志库，支持控制台彩色输出和文件输出。\n\n### 配置示例\n\n```yaml\nLog:\n  Level: info                 # 日志级别: debug, info, warn, error\n  Output: [console, file]     # 输出方式: console, file\n  FileConfig:\n    Path: ./logs/app.log      # 日志文件路径\n    MaxSize: 100              # 每个日志文件的最大大小（MB）\n    MaxAge: 7                 # 日志文件保留天数\n    MaxBackups: 10            # 保留的旧日志文件最大数量\n    Compress: true            # 是否压缩旧日志文件\n```\n\n### 日志级别\n\n- `debug`: 调试信息，包含详细的开发调试信息\n- `info`: 一般信息，默认级别\n- `warn`: 警告信息，需要注意的信息\n- `error`: 错误信息，影响程序正常运行的错误\n\n### 输出方式\n\n- `Console`: 输出到控制台，支持彩色输出\n- `File`: 输出到文件，支持按大小自动分割、自动清理和压缩\n\n可以同时配置多个输出方式，日志会同时输出到所有配置的目标。如果不配置 output，默认只输出到控制台。\n\n### 文件输出配置\n\n- `Path`: 日志文件路径\n- `MaxSize`: 单个日志文件的最大大小（MB），超过后会自动分割\n- `MaxAge`: 日志文件保留天数，超过后会自动删除\n- `MaxBackups`: 保留的旧日志文件数量\n- `Compress`: 是否压缩旧的日志文件","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimitcool%2Fstarter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimitcool%2Fstarter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimitcool%2Fstarter/lists"}