{"id":28991290,"url":"https://github.com/chenbimo/bunpii","last_synced_at":"2025-08-16T02:16:57.111Z","repository":{"id":298984434,"uuid":"1001745987","full_name":"chenbimo/bunpii","owner":"chenbimo","description":"BunPii - 为 Bun 专属打造的 API 接口框架核心引擎，无任何依赖。","archived":false,"fork":false,"pushed_at":"2025-07-03T07:37:13.000Z","size":339,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-03T08:39:18.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://chensuiyi.me","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenbimo.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,"zenodo":null}},"created_at":"2025-06-14T00:01:11.000Z","updated_at":"2025-07-03T07:37:17.000Z","dependencies_parsed_at":"2025-07-03T08:29:26.171Z","dependency_job_id":"225d8cca-890b-4c84-afd5-7ff2a70a375d","html_url":"https://github.com/chenbimo/bunpii","commit_stats":null,"previous_names":["chenbimo/bunfly","chenbimo/bunpi","chenbimo/bucuo","chenbimo/bunpii"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chenbimo/bunpii","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenbimo%2Fbunpii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenbimo%2Fbunpii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenbimo%2Fbunpii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenbimo%2Fbunpii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenbimo","download_url":"https://codeload.github.com/chenbimo/bunpii/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenbimo%2Fbunpii/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270657715,"owners_count":24623465,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-06-25T01:14:29.052Z","updated_at":"2025-08-16T02:16:57.087Z","avatar_url":"https://github.com/chenbimo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BunPii\n\nBunPii - 为 Bun 专属打造的 API 接口框架核心引擎\n\n## 特性\n\n-   🚀 基于 Bun 运行时，性能卓越\n-   📦 零依赖设计，轻量级框架\n-   🔌 插件系统，支持自定义执行顺序\n-   🔒 内置 JWT 认证支持\n-   📁 内置文件上传功能\n-   🌐 CORS 跨域支持\n-   📝 结构化日志系统\n-   💾 Redis 缓存支持 (可回退到内存缓存)\n-   🛣️ 简洁的路由系统\n-   ⚡ ESM 模块支持\n\n## 基本用法\n\n```javascript\nimport BunPii from './main.js';\n\nconst app = new BunPii({\n    port: 3000,\n    host: 'localhost'\n});\n\n// 添加路由\napp.get('/hello', async (context) =\u003e {\n    return { message: 'Hello from BunPii Core!' };\n});\n\n// 启动服务器\nawait app.listen();\n```\n\n## 插件系统\n\n内置插件按以下顺序执行：\n\n1. **Redis 插件** (order: -1) - 缓存支持\n2. **CORS 插件** (order: 1) - 跨域处理\n3. **Logger 插件** (order: 0) - 日志记录\n4. **JWT 插件** (order: 2) - 认证支持\n5. **Upload 插件** (order: 3) - 文件上传\n\n### 创建自定义插件\n\n```javascript\nconst myPlugin = {\n    name: 'my-plugin',\n    order: 5,\n    async handler(context) {\n        // 插件逻辑\n        console.log('Processing:', context.request.url);\n    }\n};\n\napp.use(myPlugin);\n```\n\n## API 接口\n\n### 健康检查\n\n-   `GET /health` - 基础健康检查\n-   `GET /status` - 详细状态信息\n-   `GET /info` - 系统信息\n\n### 文件操作\n\n-   `POST /upload` - 文件上传\n-   `GET /files` - 文件列表\n-   `GET /files/:filename` - 文件信息\n-   `GET /download/:filename` - 文件下载\n-   `DELETE /files/:filename` - 删除文件\n\n## 配置\n\n通过构造函数配置或 `setConfig` 方法：\n\n```javascript\nconst app = new BunPii({\n    port: 3000,\n    host: 'localhost'\n});\n\n// 或者\napp.setConfig('cors.origin', '*');\napp.setConfig('upload.maxSize', 10 * 1024 * 1024);\n```\n\n## 许可证\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenbimo%2Fbunpii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenbimo%2Fbunpii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenbimo%2Fbunpii/lists"}