{"_id":"@bytedocs/fastify","_rev":"4-51a638038c98c1e5e43a6fa3edf08ca9","name":"@bytedocs/fastify","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@bytedocs/fastify","version":"1.0.0","keywords":["fastify","documentation","api","swagger","openapi","bytedocs","auto-documentation","api-doc","rest-api","nodejs","typescript","openai","ai-assistant","fastify-plugin"],"author":{"name":"ByteDocs Contributors"},"license":"MIT","_id":"@bytedocs/fastify@1.0.0","maintainers":[{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"}],"homepage":"https://github.com/idnexacloud/bytedocs-fastify#readme","bugs":{"url":"https://github.com/idnexacloud/bytedocs-fastify/issues"},"dist":{"shasum":"56be3897a84b52a3c7fd9d1e6a719afedfb969c0","tarball":"https://registry.npmjs.org/@bytedocs/fastify/-/fastify-1.0.0.tgz","fileCount":31,"integrity":"sha512-80hisk4Bh16Z/sjxHMjQJT5BL+2PtQ2vEY2/12yq5tab94k4lYevive5QyYS/bNRLZdw7kvea8cQLpFWppdlBw==","signatures":[{"sig":"MEQCIHwwxHgwccpbr+Q5Jkq1ameulpWEEWvAIRMGxxxnUiRRAiAH4Jn+Z4Uy0NcWFCR+EMIMvyVKF6cZkbV/UcjC1NKFWg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":500159},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"3afc1f77b2a7861fdc5fe9d5bb35dddee281de69","scripts":{"dev":"tsc --watch","test":"jest","build":"tsc && npm run copy-templates","example":"ts-node examples/basic/index.ts","copy-templates":"cp -r src/ui/templates dist/ui/","prepublishOnly":"npm run build"},"_npmUser":{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"},"repository":{"url":"git+https://github.com/idnexacloud/bytedocs-fastify.git","type":"git"},"_npmVersion":"10.7.0","description":"Alternative to Swagger with better design, auto-detection, and AI integration","directories":{},"_nodeVersion":"20.15.1","dependencies":{"dotenv":"^16.4.5","js-yaml":"^4.1.0","@babel/types":"^7.23.6","@babel/parser":"^7.23.6","fastify-plugin":"^5.0.0","@babel/traverse":"^7.23.6","@fastify/cookie":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^4.28.0","ts-node":"^10.9.2","typescript":"^5.3.3","@types/node":"^20.10.0","@types/js-yaml":"^4.0.9"},"peerDependencies":{"fastify":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fastify_1.0.0_1762278434474_0.11849624749068521","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bytedocs/fastify","version":"1.0.1","keywords":["fastify","documentation","api","swagger","openapi","bytedocs","auto-documentation","api-doc","rest-api","nodejs","typescript","openai","ai-assistant","fastify-plugin"],"author":{"name":"ByteDocs Contributors"},"license":"MIT","_id":"@bytedocs/fastify@1.0.1","maintainers":[{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"}],"homepage":"https://github.com/idnexacloud/bytedocs-fastify#readme","bugs":{"url":"https://github.com/idnexacloud/bytedocs-fastify/issues"},"dist":{"shasum":"f605267a22ed4aeeac2c0c4e40af155300f58ca7","tarball":"https://registry.npmjs.org/@bytedocs/fastify/-/fastify-1.0.1.tgz","fileCount":31,"integrity":"sha512-h11tstYMDVXNrr2dj2IEC6efNkEOwv2DPdzgrhH2vSlCbp9/m9VBiF/IuZ0QAyv0n8ZToYsVB9JHycC1/Gl/Zw==","signatures":[{"sig":"MEQCIFFwWLNE44JiSj9kdGlFo6/4AYVMxSrAzBYJWEBkPhmkAiAOI9ZMfcAv6XVaVAkKFzsyGdwXmNWHzIBc3cwqYkcb4A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":500161},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"2543f4e742ed2dd7bf45adf33386edd8f71b0b27","scripts":{"dev":"tsc --watch","test":"jest","build":"tsc && npm run copy-templates","example":"ts-node examples/basic/index.ts","copy-templates":"cp -r src/ui/templates dist/ui/","prepublishOnly":"npm run build"},"_npmUser":{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"},"repository":{"url":"git+https://github.com/idnexacloud/bytedocs-fastify.git","type":"git"},"_npmVersion":"10.7.0","description":"Alternative to Swagger with better design, auto-detection, and AI integration","directories":{},"_nodeVersion":"20.15.1","dependencies":{"dotenv":"^16.4.5","js-yaml":"^4.1.0","@babel/types":"^7.23.6","@babel/parser":"^7.23.6","fastify-plugin":"^5.0.0","@babel/traverse":"^7.23.6","@fastify/cookie":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^4.28.0","ts-node":"^10.9.2","typescript":"^5.3.3","@types/node":"^20.10.0","@types/js-yaml":"^4.0.9"},"peerDependencies":{"fastify":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fastify_1.0.1_1762279165836_0.14717365082197542","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bytedocs/fastify","version":"1.0.2","keywords":["fastify","documentation","api","swagger","openapi","bytedocs","auto-documentation","api-doc","rest-api","nodejs","typescript","openai","ai-assistant","fastify-plugin"],"author":{"name":"ByteDocs Contributors"},"license":"MIT","_id":"@bytedocs/fastify@1.0.2","maintainers":[{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"}],"homepage":"https://github.com/idnexacloud/bytedocs-fastify#readme","bugs":{"url":"https://github.com/idnexacloud/bytedocs-fastify/issues"},"dist":{"shasum":"b7f974db8c9f0a4d44fb47d0a55de1b6054377fc","tarball":"https://registry.npmjs.org/@bytedocs/fastify/-/fastify-1.0.2.tgz","fileCount":31,"integrity":"sha512-6Mei9LSxn2wTnegCXd9ZnGHc2BzRVVYxp+Fnkrrh3mF89dCJMAQS2PmAZYMReH6YIDwZ6oEO2FJPDyQ/eM1ckg==","signatures":[{"sig":"MEQCIG8Wt4nHfh+iKEdEGO6CpBPEyZBhDhR5FZCc29VD4XinAiAsgchNYZlM/dU4aELzsW2fhtunYRtloJShuv4NchN+0A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":499653},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"e79307fb2e29fd0cc02f20ce6681fd8eafdcd896","scripts":{"dev":"tsc --watch","test":"jest","build":"tsc && npm run copy-templates","example":"ts-node examples/basic/index.ts","copy-templates":"cp -r src/ui/templates dist/ui/","prepublishOnly":"npm run build"},"_npmUser":{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"},"repository":{"url":"git+https://github.com/idnexacloud/bytedocs-fastify.git","type":"git"},"_npmVersion":"10.7.0","description":"Alternative to Swagger with better design, auto-detection, and AI integration","directories":{},"_nodeVersion":"20.15.1","dependencies":{"dotenv":"^16.4.5","js-yaml":"^4.1.0","@babel/types":"^7.23.6","@babel/parser":"^7.23.6","fastify-plugin":"^5.0.0","@babel/traverse":"^7.23.6","@fastify/cookie":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"^4.28.0","ts-node":"^10.9.2","typescript":"^5.3.3","@types/node":"^20.10.0","@types/js-yaml":"^4.0.9"},"peerDependencies":{"fastify":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fastify_1.0.2_1762875575962_0.8015503333600356","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bytedocs/fastify","version":"1.0.3","description":"Alternative to Swagger with better design, auto-detection, and AI integration","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc && npm run copy-templates","copy-templates":"cp -r src/ui/templates dist/ui/","dev":"tsc --watch","test":"jest","prepublishOnly":"npm run build","example":"ts-node examples/basic/index.ts"},"keywords":["fastify","documentation","api","swagger","openapi","bytedocs","auto-documentation","api-doc","rest-api","nodejs","typescript","openai","ai-assistant","fastify-plugin"],"author":{"name":"ByteDocs Contributors"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/idnexacloud/bytedocs-fastify.git"},"homepage":"https://github.com/idnexacloud/bytedocs-fastify#readme","bugs":{"url":"https://github.com/idnexacloud/bytedocs-fastify/issues"},"peerDependencies":{"fastify":"^4.0.0 || ^5.0.0"},"dependencies":{"@babel/parser":"^7.23.6","@babel/traverse":"^7.23.6","@babel/types":"^7.23.6","@fastify/cookie":"^9.0.0","dotenv":"^16.4.5","fastify-plugin":"^5.0.0","js-yaml":"^4.1.0"},"devDependencies":{"@types/js-yaml":"^4.0.9","@types/node":"^20.10.0","fastify":"^4.28.0","ts-node":"^10.9.2","typescript":"^5.3.3"},"engines":{"node":">=16.0.0"},"_id":"@bytedocs/fastify@1.0.3","gitHead":"23441dca8ee522c6267926cf64c7412918ec589b","_nodeVersion":"20.15.1","_npmVersion":"10.7.0","dist":{"integrity":"sha512-4wTBk5Fc22/+PtJzQRS+zz/XWK3ryKaE0igcXhPq8j7cn0+1bwDfaa4/9J182A9LPw1o71Ic2fm4KKZh6gcupw==","shasum":"2c07e3618850b8877c398f12cbe6e59713ddfe08","tarball":"https://registry.npmjs.org/@bytedocs/fastify/-/fastify-1.0.3.tgz","fileCount":31,"unpackedSize":499751,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHe0fkQEFLDgA+tXwTriCDeglL/azPRe0Km2XtYtPtdwAiEAmTG+HJ74swN1SylMQixxP3+dKY8oaZFhKaPJWZ+yOUM="}]},"_npmUser":{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"},"directories":{},"maintainers":[{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fastify_1.0.3_1762876220143_0.3050788791727863"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-04T17:47:14.394Z","modified":"2025-11-11T15:50:20.536Z","1.0.0":"2025-11-04T17:47:14.695Z","1.0.1":"2025-11-04T17:59:26.053Z","1.0.2":"2025-11-11T15:39:36.194Z","1.0.3":"2025-11-11T15:50:20.348Z"},"bugs":{"url":"https://github.com/idnexacloud/bytedocs-fastify/issues"},"author":{"name":"ByteDocs Contributors"},"license":"MIT","homepage":"https://github.com/idnexacloud/bytedocs-fastify#readme","keywords":["fastify","documentation","api","swagger","openapi","bytedocs","auto-documentation","api-doc","rest-api","nodejs","typescript","openai","ai-assistant","fastify-plugin"],"repository":{"type":"git","url":"git+https://github.com/idnexacloud/bytedocs-fastify.git"},"description":"Alternative to Swagger with better design, auto-detection, and AI integration","maintainers":[{"name":"aibnuhibban","email":"abd.ibnuhibban@gmail.com"}],"readme":"# ByteDocs Fastify\n\n[![npm version](https://img.shields.io/badge/npm-%3E%3D18-blue.svg)](https://nodejs.org/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![Documentation](https://img.shields.io/badge/docs-bytedocs-blue.svg)](https://github.com/aibnuhibban/bytedocs)\n\n**ByteDocs** is a modern alternative to Swagger with better design, auto-detection, and AI integration for Hono applications. It automatically generates beautiful API documentation from your routes with zero configuration required.\n\n## Features\n\n- 🔍 **Auto-Discovery**: Automatically detects all your Fastify routes and schemas\n- 📝 **Smart Analysis**: Analyzes handler functions using AST to extract response structures\n- 🎨 **Beautiful UI**: Modern, responsive documentation interface\n- 🔐 **Multiple Auth Methods**: Support for Basic, API Key, Bearer Token, and Session authentication\n- 🤖 **AI-Powered**: Optional AI assistant integration (OpenAI, Claude, OpenRouter)\n- 📊 **OpenAPI 3.0**: Export full OpenAPI specification in JSON or YAML\n- 🎯 **TypeScript**: Full TypeScript support with type definitions\n- ⚡ **Zero Config**: Works out of the box with sensible defaults\n- 🔌 **Fastify Plugin**: Easy integration as a standard Fastify plugin\n\n## 📦 Installation\n\n```bash\nnpm install @bytedocs/fastify\n# or\nyarn add @bytedocs/fastify\n```\n\n## 🚀 Quick Start\n\n```typescript\nimport Fastify from 'fastify';\nimport byteDocsPlugin from '@bytedocs/fastify';\n\nconst fastify = Fastify();\n\n// Register ByteDocs plugin\nawait fastify.register(byteDocsPlugin, {\n  title: 'My API',\n  version: '1.0.0',\n  description: 'API Documentation',\n  baseURL: 'http://localhost:3000',\n});\n\n// Define your routes\nfastify.get('/api/users', async (request, reply) => {\n  return reply.send({\n    success: true,\n    data: [\n      { id: 1, name: 'John Doe' },\n      { id: 2, name: 'Jane Smith' },\n    ],\n  });\n});\n\nawait fastify.listen({ port: 3000 });\n// Documentation available at http://localhost:3000/docs\n```\n\n## ⚙️ Configuration\n\n### Programmatic Configuration\n\n```typescript\nawait fastify.register(byteDocsPlugin, {\n  // Core settings\n  title: 'My API Documentation',\n  version: '1.0.0',\n  description: 'API for my application',\n  docsPath: '/docs',\n  autoDetect: true,\n\n  // Multiple base URLs (environments)\n  baseURLs: [\n    { name: 'Production', url: 'https://api.example.com' },\n    { name: 'Staging', url: 'https://staging-api.example.com' },\n    { name: 'Development', url: 'http://localhost:3000' },\n  ],\n\n  // Authentication\n  authConfig: {\n    enabled: true,\n    type: 'session', // 'basic' | 'api_key' | 'bearer' | 'session'\n    password: 'your-secure-password',\n  },\n\n  // UI Configuration\n  uiConfig: {\n    theme: 'blue', // 'green' | 'blue' | 'purple' | 'red' | 'orange' | 'teal' | 'pink'\n    darkMode: false,\n  },\n\n  // AI Configuration (optional)\n  aiConfig: {\n    enabled: true,\n    provider: 'openai', // 'openai' | 'claude' | 'openrouter'\n    apiKey: process.env.OPENAI_API_KEY,\n    features: {\n      chatEnabled: true,\n      model: 'gpt-4o-mini',\n    },\n  },\n});\n```\n\n### Environment Variables\n\nCreate a `.env` file:\n\n```env\n# Core Configuration\nBYTEDOCS_TITLE=My API Documentation\nBYTEDOCS_VERSION=1.0.0\nBYTEDOCS_DESCRIPTION=API for my application\nBYTEDOCS_DOCS_PATH=/docs\nBYTEDOCS_AUTO_DETECT=true\n\n# Base URLs (Multiple Environments)\nBYTEDOCS_PRODUCTION_URL=https://api.example.com\nBYTEDOCS_STAGING_URL=https://staging-api.example.com\nBYTEDOCS_DEVELOPMENT_URL=http://localhost:3000\n\n# Authentication\nBYTEDOCS_AUTH_ENABLED=true\nBYTEDOCS_AUTH_TYPE=session\nBYTEDOCS_AUTH_PASSWORD=your-secure-password\n\n# UI Configuration\nBYTEDOCS_UI_THEME=blue\nBYTEDOCS_UI_DARK_MODE=false\n\n# AI Configuration (Optional)\nBYTEDOCS_AI_ENABLED=true\nBYTEDOCS_AI_PROVIDER=openai\nBYTEDOCS_AI_API_KEY=your-openai-api-key\nBYTEDOCS_AI_CHAT_ENABLED=true\nBYTEDOCS_AI_MODEL=gpt-4o-mini\n```\n\n## 📚 Documentation Features\n\n### Schema-First Approach\n\nByteDocs works great with Fastify's native JSON Schema validation:\n\n```typescript\nfastify.post('/api/users', {\n  schema: {\n    body: {\n      type: 'object',\n      required: ['name', 'email'],\n      properties: {\n        name: { type: 'string', minLength: 1 },\n        email: { type: 'string', format: 'email' },\n      },\n    },\n    response: {\n      201: {\n        type: 'object',\n        properties: {\n          success: { type: 'boolean' },\n          data: {\n            type: 'object',\n            properties: {\n              id: { type: 'number' },\n              name: { type: 'string' },\n              email: { type: 'string' },\n            },\n          },\n        },\n      },\n    },\n  },\n  handler: async (request, reply) => {\n    const { name, email } = request.body;\n    const newUser = { id: Date.now(), name, email };\n    return reply.code(201).send({ success: true, data: newUser });\n  },\n});\n```\n\n### JSDoc Comments\n\nAdd rich documentation using JSDoc:\n\n```typescript\n/**\n * Get user by ID\n * @summary Retrieve a specific user\n * @tag Users\n * @param {string} id - User ID\n */\nfastify.get('/api/users/:id', async (request, reply) => {\n  // Handler implementation\n});\n```\n\n### Response Examples\n\nAttach examples to handlers:\n\n```typescript\nimport { attachExamples } from '@bytedocs/fastify';\n\nconst handler = async (request, reply) => {\n  return reply.send({ success: true, data: { id: 1, name: 'John' } });\n};\n\nattachExamples(handler,\n  { name: 'John Doe', email: 'john@example.com' },  // Request example\n  { success: true, id: 1 }  // Response example\n);\n\nfastify.post('/api/users', handler);\n```\n\n## 🔐 Authentication\n\nByteDocs supports multiple authentication methods:\n\n### 1. Session Authentication (Recommended)\n\n```typescript\nauthConfig: {\n  enabled: true,\n  type: 'session',\n  password: 'your-secure-password',\n  sessionExpire: 1440, // Minutes (24 hours)\n  ipBanEnabled: true,\n  ipBanMaxAttempts: 5,\n  ipBanDuration: 30, // Minutes\n}\n```\n\n### 2. Basic Authentication\n\n```typescript\nauthConfig: {\n  enabled: true,\n  type: 'basic',\n  username: 'admin',\n  password: 'password',\n}\n```\n\n### 3. API Key Authentication\n\n```typescript\nauthConfig: {\n  enabled: true,\n  type: 'api_key',\n  apiKey: 'your-api-key',\n  apiKeyHeader: 'X-API-Key',\n}\n```\n\n### 4. Bearer Token Authentication\n\n```typescript\nauthConfig: {\n  enabled: true,\n  type: 'bearer',\n  apiKey: 'your-bearer-token',\n}\n```\n\n## 🤖 AI Assistant\n\nEnable AI-powered documentation assistance:\n\n```typescript\naiConfig: {\n  enabled: true,\n  provider: 'openai', // or 'claude', 'openrouter'\n  apiKey: process.env.OPENAI_API_KEY,\n  features: {\n    chatEnabled: true,\n    model: 'gpt-4o-mini',\n    maxTokens: 4096,\n    temperature: 0.7,\n  },\n}\n```\n\nThe AI assistant can answer questions about your API endpoints, provide code examples, and help with integration.\n\n## 📤 Export Options\n\n### OpenAPI JSON\nAccess the full OpenAPI specification:\n```\nhttp://localhost:3000/docs/openapi.json\n```\n\n### OpenAPI YAML\nDownload as YAML:\n```\nhttp://localhost:3000/docs/openapi.yaml\n```\n\n## 🎨 Theming\n\nChoose from multiple color themes:\n\n- `green` (default)\n- `blue`\n- `purple`\n- `red`\n- `orange`\n- `teal`\n- `pink`\n\n```typescript\nuiConfig: {\n  theme: 'blue',\n  darkMode: true,\n}\n```\n\n## 📝 Examples\n\nCheck out the `examples/` directory for complete working examples:\n\n- `examples/basic/` - Basic setup with auto-detection\n- More examples coming soon!\n\n## 🤝 Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\nMade with ❤️ by the ByteDocs team\n","readmeFilename":"README.md"}