{"id":26047579,"url":"https://github.com/lucky845/github-profile-statistics-card","last_synced_at":"2026-04-11T02:44:37.321Z","repository":{"id":280387038,"uuid":"941817651","full_name":"lucky845/github-profile-statistics-card","owner":"lucky845","description":"一个优雅的个人统计数据展示卡片生成服务，支持多个平台的数据统计展示，可以轻松集成到你的GitHub个人资料页面。","archived":false,"fork":false,"pushed_at":"2025-03-06T05:19:37.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T05:22:49.936Z","etag":null,"topics":["ajax","express","github","leetcode","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://github-profile-views-plum.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucky845.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2025-03-03T05:18:16.000Z","updated_at":"2025-03-06T05:19:41.000Z","dependencies_parsed_at":"2025-03-03T06:37:05.277Z","dependency_job_id":null,"html_url":"https://github.com/lucky845/github-profile-statistics-card","commit_stats":null,"previous_names":["lucky845/github-profile-views","lucky845/github-profile-statistics-card"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucky845%2Fgithub-profile-statistics-card","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucky845%2Fgithub-profile-statistics-card/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucky845%2Fgithub-profile-statistics-card/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucky845%2Fgithub-profile-statistics-card/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucky845","download_url":"https://codeload.github.com/lucky845/github-profile-statistics-card/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242473056,"owners_count":20134020,"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":["ajax","express","github","leetcode","nodejs","typescript"],"created_at":"2025-03-07T23:11:54.533Z","updated_at":"2025-12-24T03:41:22.582Z","avatar_url":"https://github.com/lucky845.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Profile Statistics Card\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/lucky845/github-profile-statistics-card?style=for-the-badge\" alt=\"License\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/issues/lucky845/github-profile-statistics-card?style=for-the-badge\" alt=\"Issues\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/forks/lucky845/github-profile-statistics-card?style=for-the-badge\" alt=\"Forks\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/stars/lucky845/github-profile-statistics-card?style=for-the-badge\" alt=\"Stars\"\u003e\n\u003c/div\u003e\n\n## 🚀 项目简介\n\nGitHub Profile Statistics Card 是一个功能强大的开源工具，用于生成个人统计数据的SVG卡片。支持多种平台的数据展示，可直接嵌入到GitHub个人资料页或任何支持图片的位置。\n\n### 🔥 核心功能\n\n- **多平台支持**：GitHub、LeetCode、CSDN、掘金、B站数据统计\n- **可定制主题**：多种精美主题可选，支持亮色/暗色模式\n- **高度优化**：多级缓存策略，基于Redis的高性能缓存系统，确保快速响应\n  - GitHub服务实现5分钟缓存，显著减少重复请求的响应时间\n  - Redis连接池优化，最大连接数限制为10，避免\"ERR max number of clients reached\"错误\n- **安全可靠**：内置SVG内容过滤，防止XSS攻击\n- **实时监控**：集成Prometheus，全面的性能监控\n- **完整测试**：全面的单元测试和边界情况覆盖\n\n## 🌟 特性\n\n- 支持多个平台数据统计\n  - GitHub 统计数据\n  - LeetCode 刷题数据\n  - CSDN 博客数据\n  - 掘金\n  - 哔哩哔哩\n  - 更多平台持续添加中...\n- 自定义主题支持\n  - 明亮主题\n  - 暗黑主题\n- 实时数据更新\n- 简单易用的API\n- 响应式设计\n- 基于Redis的高性能缓存优化\n\n## 🚀 使用方法\n\n### GitHub 统计卡片\n\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/github/username?theme=light)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/github/lucky845?theme=light)\n\n### LeetCode 统计卡片\n\n```markdown\n![LeetCode Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=light)\n```\n![LeetCode Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=light\u0026cn=true)\n\n支持参数：\n- `username`: LeetCode 用户名\n- `theme`: 主题选择（可选，默认为 light）\n- `cn`: 是否获取中国区数据（可选，默认为 false）\n  - `cn=true`: 获取 leetcode-cn.com 的数据\n  - 不携带该参数: 获取 leetcode.com 的数据\n- `cacheSeconds`: 配置缓存的秒数(默认120秒)\n\n示例：\n```markdown\n# 获取 LeetCode 中国区数据\n![LeetCode CN Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=dark\u0026cn=true)\n\n# 获取 LeetCode 美国区数据\n![LeetCode Stats](https://github-profile-views-plum.vercel.app/api/leetcode/username?theme=dark)\n```\n\n### CSDN 统计卡片\n\n```markdown\n![CSDN Stats](https://github-profile-views-plum.vercel.app/csdn/userId?theme=light)\n```\n![CSDN Stats](https://github-profile-views-plum.vercel.app/csdn/weixin_46427785?theme=light)\n\nCSDN 统计卡片包含以下数据：\n- 文章数量\n- 粉丝数\n- 点赞数\n- 浏览量\n- 评论数\n- 积分\n- ...\n\n### 掘金统计卡片\n\n```markdown\n![掘金统计](https://github-profile-views-plum.vercel.app/juejin/userId?theme=light)\n```\n![掘金统计](https://github-profile-views-plum.vercel.app/juejin/2564503943252237?theme=light)\n\n掘金统计卡片包含以下数据：\n- 文章数量\n- 关注者数量\n- 点赞数\n- 浏览量\n- 个人简介\n- ...\n\n支持参数：\n- `userId`: 掘金用户ID\n- `theme`: 主题选择（可选，默认为 light）\n- `cacheSeconds`: 配置缓存的秒数(默认120秒)\n\n示例：\n```markdown\n# 使用暗黑主题\n![掘金统计](https://github-profile-views-plum.vercel.app/juejin/userId?theme=dark)\n```\n\n### 哔哩哔哩统计卡片\n\n```markdown\n![哔哩哔哩统计](https://github-profile-views-plum.vercel.app/bilibili/uid?theme=light)\n```\n![哔哩哔哩统计](https://github-profile-views-plum.vercel.app/bilibili/89389361?theme=light)\n\n哔哩哔哩统计卡片包含以下数据：\n- 用户名称\n- 粉丝数\n- 关注数\n- 获赞数\n- 播放量\n- 个人签名\n- ...\n\n支持参数：\n- `uid`: 哔哩哔哩用户ID\n- `theme`: 主题选择（可选，默认为 light）\n- `cacheSeconds`: 配置缓存的秒数(默认120秒)\n\n示例：\n```markdown\n# 使用暗黑主题\n![哔哩哔哩统计](https://github-profile-views-plum.vercel.app/bilibili/uid?theme=dark)\n```\n\n⚠️ 已知问题：\n- 由于哔哩哔哩的等级是svg图片，用户等级信息可能无法正常获取\n- 部分用户数据可能因为隐私设置而无法显示\n\n## 🎨 主题配置\n\n支持以下主题参数：\n- `cacheSeconds`: 配置缓存的秒数(默认120秒)\n- `theme=light` - 明亮主题（默认）\n- `theme=dark` - 暗黑主题\n- `theme=merko` - Merko 主题\n- `theme=gruvbox` - Gruvbox 主题\n- `theme=gruvbox_light` - Gruvbox Light 主题\n- `theme=tokyonight` - Tokyo Night 主题\n- `theme=onedark` - One Dark 主题\n\n主题预览：\n\n### Light（默认）\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=light)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=light\u0026cn=true)\n\n### Dark\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=dark)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=dark\u0026cn=true)\n\n### Merko\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=merko)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=merko\u0026cn=true)\n\n### Gruvbox\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=gruvbox)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=gruvbox\u0026cn=true)\n\n### Gruvbox Light\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=gruvbox_light\u0026cn=true)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=gruvbox_light\u0026cn=true)\n\n### Tokyo Night\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=tokyonight)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=tokyonight\u0026cn=true)\n\n### One Dark\n```markdown\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/username?theme=onedark)\n```\n![GitHub Stats](https://github-profile-views-plum.vercel.app/leetcode/lucky845?theme=onedark\u0026cn=true)\n\n## 🔜 即将支持的平台\n\n- 知乎\n- 微博\n- ...更多平台开发中\n\n## 🛠️ 技术栈\n\n- Node.js\n- Express\n- TypeScript\n- MongoDB\n- Redis\n- EJS 模板引擎\n\n## 📝 开源协议\n\n[Apache 2.0 许可证](LICENSE)\n\n## 🚀 部署指南\n\n### 准备工作\n\n1. Fork 本项目到你的 GitHub 账户\n2. 注册 [MongoDB Atlas](https://cloud.mongodb.com/) 账户\n3. 注册 [Vercel](https://vercel.com/) 账户\n\n### MongoDB Atlas 配置\n\n1. 登录 MongoDB Atlas\n2. 创建新的数据库集群（可以选择免费的共享集群）\n3. 在 \"Database Access\" 中创建数据库用户\n4. 在 \"Network Access\" 中添加 IP 访问权限（可以设置为允许所有 IP：0.0.0.0/0）\n5. 获取数据库连接字符串（格式如：`mongodb+srv://\u003cusername\u003e:\u003cpassword\u003e@cluster0.xxxxx.mongodb.net/`)\n\n### Redis Cloud 配置\n\n为了提升应用性能和响应速度，本项目使用Redis作为主要缓存系统。推荐使用Redis Cloud服务，它提供了简单易用的云托管Redis解决方案。\n\n1. 注册 [Redis Cloud](https://redis.com/try-free/) 账户（提供30天免费试用）\n2. 创建新的Redis数据库实例\n3. 获取连接信息：\n   - Redis主机地址（Endpoint）\n   - Redis端口（Port）\n   - Redis密码（Password）\n4. 将这些信息配置到环境变量中\n\nRedis Cloud的优势：\n- 无需自行维护Redis服务器\n- 自动备份和故障恢复\n- 可视化监控面板\n- 多区域部署支持\n- 自动扩缩容能力\n\n### Redis 连接池配置\n\n为了有效管理Redis连接并避免连接数过多导致的问题，本项目实现了Redis连接池机制：\n\n- **最大连接数限制**：连接池最大连接数设置为10，适合免费Redis服务的连接数限制\n- **连接复用**：通过连接池复用连接，减少连接建立和关闭的开销\n- **自动重连**：连接断开时自动重新连接\n- **超时控制**：设置获取连接的超时时间为5秒，避免长时间等待\n\n连接池配置参数：\n- `minimum`: 最小连接数（默认1）\n- `maximum`: 最大连接数（默认10）\n- `acquireTimeout`: 获取连接超时时间（默认5000ms）\n- `cleanupDelay`: 清理延迟时间（默认3000ms）\n\n### Vercel 部署\n\n1. 在 Vercel 中导入你 fork 的项目\n2. 配置环境变量：\n   - `MONGODB_URI`: MongoDB Atlas 的连接字符串\n   - `BILIBILI_SESSDATA`: 哔哩哔哩登录后获取的cookie里面的`SESSDATA`值\n   - `USE_MEMORY_CACHE`: 本地开发时设置为true使用内存缓存（可选，线上环境未配置时默认使用MongoDB）\n   - `REDIS_HOST`: Redis服务器主机地址（使用Redis Cloud时为云端提供的主机地址）\n   - `REDIS_PORT`: Redis服务器端口（使用Redis Cloud时为云端提供的端口）\n   - `REDIS_PASSWORD`: Redis访问密码（使用Redis Cloud时为云端提供的密码）\n   - `REDIS_USERNAME`: Redis用户名（使用Redis Cloud时通常为'default'）\n3. 点击 \"Deploy\" 开始部署\n\n部署完成后，你可以通过 Vercel 分配的域名访问服务，格式如：\n```markdown\n![GitHub Stats](https://your-vercel-domain.vercel.app/api/github?username=your-username\u0026theme=light)\n```\n\n## 🤝 参与贡献\n\n我们非常欢迎各种形式的贡献！以下是一些参与项目的方式：\n\n### 贡献步骤\n\n1. Fork 本项目\n2. 创建你的特性分支 (`git checkout -b feature/AmazingFeature`)\n3. 提交你的改动 (`git commit -m 'Add some AmazingFeature'`)\n4. 推送到分支 (`git push origin feature/AmazingFeature`)\n5. 发起 Pull Request\n\n### 贡献类型\n\n- 🐛 提交 bug 修复\n- ✨ 添加新功能\n- 📝 改进文档\n- 🎨 优化界面\n- 🔧 改进配置\n- 🌐 添加新的平台支持\n\n### 开发指南\n\n1. 克隆项目到本地：\n```bash\ngit clone https://github.com/your-username/github-profile-statistics-card.git\ncd github-profile-statistics-card\n```\n\n2. 安装依赖：\n```bash\nnpm install\n```\n\n3. 创建 `.env` 文件并设置环境变量：\n```\nMONGODB_URI=your_mongodb_uri\n```\n\n4. 启动开发服务器：\n```bash\nnpm run dev\n```\n\n5. 构建项目：\n```bash\nnpm run build\n```\n\n6. 运行生产版本：\n```bash\nnpm start\n```\n\n\u003e 说明：本项目使用TypeScript开发，已优化编译配置，构建输出文件将存放在`dist`目录中，确保源代码与编译产物分离，提高项目结构清晰度。项目使用`tsc-alias`处理路径别名，确保编译后的代码能够正确解析模块引用。\n\n### 提交规范\n\n提交信息请遵循以下格式：\n- `feat`: 新功能\n- `fix`: 修复问题\n- `docs`: 文档修改\n- `style`: 代码格式修改\n- `refactor`: 代码重构\n- `test`: 测试用例修改\n- `chore`: 其他修改\n\n例如：`feat: 添加 bilibili 数据统计支持`\n\n## 📬 联系方式\n\n如有问题或建议，欢迎通过以下方式联系：\n\n- 提交 Issue\n- 发送邮件至：[1447545564@qq.com]\n\n---\n\n如果这个项目对你有帮助，请给个 Star ⭐️ \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucky845%2Fgithub-profile-statistics-card","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucky845%2Fgithub-profile-statistics-card","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucky845%2Fgithub-profile-statistics-card/lists"}