apidocs-sparkcrm
v3.0.0
Published
Automated API documentation generator that creates markdown docs, PDF, and Postman collections from Express.js routes
Downloads
173
Maintainers
Readme
API Docs Generator 🚀
Automated API documentation generator that creates comprehensive documentation from your Express.js routes, including:
- 📄 Markdown Documentation - Detailed API docs with request/response examples
- 📋 PDF Documentation - Professional PDF format for sharing
- 📦 Postman Collection - Ready-to-import collection for API testing
Features ✨
- Automatic Route Detection - Scans your Express.js routes automatically
- Request Body Extraction - Extracts request schemas from controller functions
- Response Schema Analysis - Analyzes response patterns from your code
- Multiple Output Formats - Markdown, PDF, and Postman collection
- Smart Pattern Recognition - Supports various Express.js patterns
- Professional Documentation - Clean, organized, and easy to read
Installation 📦
npm install -g apidocsOr use directly with npx:
npx apidocsUsage 🎯
Simply run the command in your Express.js project directory:
npx apidocsThe tool will automatically:
- Scan your
src/,api/,controllers/, androutes/directories - Extract all Express.js routes
- Analyze controller functions for request/response schemas
- Generate comprehensive documentation
Output Files 📁
After running, you'll get these files in the docs/ folder:
api-docs.md- Detailed markdown documentationapi-docs.pdf- Professional PDF documentationpostman-collection.json- Postman collection for API testing
Supported Express Patterns 🔧
The tool recognizes these Express.js patterns:
// Standard router patterns
router.get('/users', userController.getUsers);
router.post('/users', userController.createUser);
// With middleware
router.get('/users', authMiddleware, userController.getUsers);
// App patterns
app.get('/api/users', userController.getUsers);
// Express.Router patterns
.get('/users', userController.getUsers)Request Body Detection 🎯
The tool automatically detects request body schemas from:
// Destructuring patterns
const { name, email, age } = req.body;
// Direct usage
req.body.name
req.body.emailResponse Analysis 📊
Response schemas are extracted from:
// Success responses
res.json(result.rows);
res.json(result.rows[0]);
// Error responses
res.status(400).json({ message: err.message });Example Output 📋
Markdown Documentation
# My API Project - API Documentation
## 📊 API Statistics
| Method | Count |
|--------|-------|
| GET | 2 |
| POST | 1 |
| PUT | 1 |
| DELETE | 1 |
## 🚀 API Endpoints
### 1. getUsers
**Method:** `GET`
**URL:** `/users`
**Request Body:**
```json
{}Response:
[{"id": 1, "name": "John", "email": "[email protected]"}]
### Postman Collection
The generated Postman collection includes:
- All API endpoints with proper HTTP methods
- Request body examples for POST/PUT/PATCH requests
- Response examples
- Environment variables (baseUrl)
- Proper headers and content types
## Configuration ⚙️
The tool automatically scans these directories:
- `src/`
- `api/`
- `controllers/`
- `routes/`
## Requirements 📋
- Node.js 12.0.0 or higher
- Express.js project structure
- Standard Express.js route patterns
## Contributing 🤝
Contributions are welcome! Please feel free to submit a Pull Request.
## License 📄
MIT License - feel free to use in your projects!
## Support 💬
If you encounter any issues or have suggestions, please open an issue on GitHub.
---
**Happy Documenting! 📚✨**