apiscriptor
v1.0.1
Published
Modern, high-performance API documentation for Express.js with beautiful UI, type generation, and seamless integration
Maintainers
Readme
🚀 ApiScriptor
Modern, high-performance API documentation for Express.js with beautiful UI, type generation, and seamless integration.
✨ Features
- 🎨 Beautiful UI - Modern, Stripe-inspired design with dark/light mode
- ⚡ Zero Config - Auto-detects routes, just add one line of code
- 🔒 Password Protection - Secure your docs with password authentication
- 📝 Type Generation - Generate types for TypeScript, Go, Python, Rust, Dart
- 📤 Multi-format Export - Export to OpenAPI, Postman, Insomnia, Markdown
- 🎯 Interactive Playground - Test API endpoints directly from docs
- 🔍 Fuzzy Search - Quickly find endpoints
- 📱 Responsive - Works on all devices
📦 Installation
npm install apiscriptor🚀 Quick Start
import express from 'express';
import { ApiScriptor } from 'apiscriptor';
const app = express();
// Your API routes
app.get('/api/users', (req, res) => {
/* ... */
});
app.post('/api/users', (req, res) => {
/* ... */
});
// Add ApiScriptor - that's it!
app.use(
'/docs',
ApiScriptor.serve(app, {
title: 'My API',
version: '1.0.0',
theme: 'dark',
})
);
app.listen(3000);Visit http://localhost:3000/docs to see your documentation!
🔐 Password Protection
app.use(
'/docs',
ApiScriptor.serve(app, {
title: 'My API',
version: '1.0.0',
auth: {
enabled: true,
password: 'your-secret-password',
sessionMaxAge: 24 * 60 * 60 * 1000, // 24 hours
},
})
);📝 Type Generation
Generate types for multiple languages:
import { ApiScriptor } from 'apiscriptor';
await ApiScriptor.generateTypes(app, {
output: './generated-types',
languages: ['typescript', 'go', 'python', 'rust', 'dart'],
});📤 Export Formats
import { ApiScriptor } from 'apiscriptor';
// Export to OpenAPI 3.0
await ApiScriptor.export(app, { format: 'openapi', output: './openapi.json' });
// Export to Postman Collection
await ApiScriptor.export(app, { format: 'postman', output: './postman.json' });
// Export to Insomnia
await ApiScriptor.export(app, { format: 'insomnia', output: './insomnia.json' });
// Export to Markdown
await ApiScriptor.export(app, { format: 'markdown', output: './API.md' });⚙️ Configuration
| Option | Type | Default | Description |
| ------------- | ------------------- | -------- | --------------------------------- |
| title | string | Required | API title |
| version | string | Required | API version |
| description | string | - | API description |
| baseUrl | string | - | Base URL for API |
| theme | 'dark' \| 'light' | 'dark' | UI theme |
| logo | string | - | Logo URL |
| auth | object | - | Password protection config |
| exclude | string[] | - | Routes to exclude (glob patterns) |
| customCss | string | - | Custom CSS to inject |
| customJs | string | - | Custom JavaScript to inject |
🛠️ Development
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Run example
cd examples/basic-express
npm install
npm start📄 License
MIT © [Your Name]
