AI-powered API testing & documentation generator with OpenAPI/Swagger support
Automatically generates API documentation, Postman collections, OpenAPI specs, and test files from your backend codebase.
- Scans TypeScript files for route definitions
- Generates Postman collections with organized routes
- Creates OpenAPI 3.0 specifications and Swagger UI
- Generates automated test files
- Tests endpoints and captures real responses
- Detects authentication endpoints and manages tokens
``bash`
npm install -g @devxcant/auto-doc-gen
Or install locally:
`bash`
npm install @devxcant/auto-doc-gen
bun install @devxcant/auto-doc-gen
Test non-auth endpoints and generate all files:
`bash`
auto-doc-gen /path/to/backend
Or using the --path option:
`bash`
auto-doc-gen --path /path/to/backend
What it does:
- Scans routes
- Tests non-auth endpoints only (requires backend to be running)
- Generates all files: Postman collection, OpenAPI spec, Swagger UI, test files, documentation, and test report
Test all endpoints including auth (prompts for credentials):
`bash`
auto-doc-gen /path/to/backend --all
Or using the --path option:
`bash`
auto-doc-gen --path /path/to/backend --all
What it does:
- Scans routes
- Prompts for email and password
- Tests all endpoints including auth endpoints
- Generates all files: Postman collection, OpenAPI spec, Swagger UI, test files, documentation, and test report
Test against a remote server:
`bash`
auto-doc-gen /path/to/backend --all --url https://api.example.com
What it does: Tests endpoints at the specified URL instead of localhost. With --all, prompts for email and password.
Generate files to a specific location:
`bash`
auto-doc-gen /path/to/backend --all -o ~/Documents/api-docs
What it does: Creates auto-doc-gen/ folder in the specified output directory.
If installed locally, prefix commands:
`bash`
npx @devxcant/auto-doc-gen /path/to/backend --all
bunx @devxcant/auto-doc-gen /path/to/backend --all
``
--path, -p
--all Test auth endpoints (prompts for credentials)
--url
--output, -o
--verbose Show detailed output and debugging information
--help, -h Show help
--version, -V Show version
``
--mock-server Generate Express.js mock server
--dashboard Generate API health dashboard
--contract-tests Generate contract test files
--security-scan Run security analysis
--performance Generate performance report
--code-examples Generate code examples (cURL, JS, Python, Go)
--load-test Generate load testing scripts (k6, Artillery)
--export-formats Export to Insomnia and Thunder Client
--diagrams Generate API flow diagrams
--ci-cd Generate CI/CD configuration files
--versioning Detect and report API versioning
--rate-limits Detect and document rate limits
Note: Use --all to test auth endpoints (prompts for credentials). Without --all, only non-auth endpoints are tested.
Generate a working Express.js mock server from your API with real response data:
`bash`
auto-doc-gen ./backend --mock-server
Creates a ready-to-run mock server in auto-doc-gen/mock-server/.
Beautiful HTML dashboard with visual metrics and endpoint status:
`bash`
auto-doc-gen ./backend --dashboard
Generate contract test files to validate API responses:
`bash`
auto-doc-gen ./backend --contract-tests
Automated security analysis with recommendations:
`bash`
auto-doc-gen ./backend --security-scan
Measure and analyze endpoint response times:
`bash`
auto-doc-gen ./backend --performance
Generate code examples in multiple languages:
`bash`
auto-doc-gen ./backend --code-examples
Generate k6 and Artillery load test scripts:
`bash`
auto-doc-gen ./backend --load-test
Export to Insomnia and Thunder Client:
`bash`
auto-doc-gen ./backend --export-formats
Generate visual flow diagrams:
`bash`
auto-doc-gen ./backend --diagrams
Generate GitHub Actions and GitLab CI configs:
`bash`
auto-doc-gen ./backend --ci-cd
Detect and report API versioning patterns:
`bash`
auto-doc-gen ./backend --versioning
Detect and document rate limits:
`bash`
auto-doc-gen ./backend --rate-limits
`bashFull suite
auto-doc-gen ./backend --all --mock-server --dashboard --security-scan --performance
Generated Files
All files are generated in the
auto-doc-gen/ folder:$3
-
postman_collection.json - Import into Postman
- local_environment.postman_environment.json - Local environment variables
- production_environment.postman_environment.json - Production environment variables
- openapi.json - OpenAPI 3.0 specification
- api-docs.html - Interactive Swagger UI
- API_DOCUMENTATION.md - Markdown documentation
- tests/auto/*.test.ts - Automated test files
- report.json - Live test results$3
With
--mock-server:-
mock-server/server.js - Express.js mock server
- mock-server/package.json - Dependencies
- mock-server/README.md - Usage instructionsWith
--dashboard:-
dashboard.html - API health dashboardWith
--contract-tests:-
tests/contract/contract.test.ts - Contract test filesWith
--security-scan:-
security-scan.json - Security analysis report
- security-scan.html - Visual security reportWith
--performance:-
performance.json - Performance metrics
- performance.html - Performance dashboardWith
--code-examples:-
code-examples/curl.sh - cURL examples
- code-examples/javascript.js - JavaScript examples
- code-examples/python.py - Python examples
- code-examples/go.go - Go examplesWith
--load-test:-
load-test/k6-script.js - k6 load test script
- load-test/artillery.yml - Artillery configWith
--export-formats:-
insomnia_collection.json - Insomnia format
- thunder-client/collection.json - Thunder Client formatWith
--diagrams:-
diagrams.html - Interactive diagrams
- diagrams.mmd - Mermaid sourceWith
--ci-cd:-
ci-cd/.github/workflows/api-tests.yml - GitHub Actions
- ci-cd/.gitlab-ci.yml - GitLab CIWith
--versioning:-
versioning.json - Versioning report
- versioning.html - Visual versioning reportWith
--rate-limits:-
rate-limits.json - Rate limit data
- rate-limits.html - Rate limit reportRequirements
- Node.js 18.0.0 or higher
- TypeScript route files using
router.get(), router.post(), etc.
- Backend must be running (for live endpoint testing)Examples
Test non-auth endpoints and generate all files:
`bash
auto-doc-gen ./backend
`Test all endpoints including auth (prompts for credentials):
`bash
auto-doc-gen ./backend --all
`Test remote API:
`bash
auto-doc-gen ./backend --url https://staging-api.example.com
`Generate to specific folder:
`bash
auto-doc-gen ./backend --all -o ~/Desktop/api-docs
``See CHANGELOG.md for detailed version history and new features.
This major release adds 12 new powerful features:
1. Mock Server - Generate working mock servers
2. Health Dashboard - Visual API monitoring
3. Contract Tests - API validation tests
4. Security Scan - Automated security analysis
5. Performance Reports - Response time analysis
6. Code Examples - Multi-language code snippets
7. Load Testing - k6 and Artillery scripts
8. Export Formats - Insomnia & Thunder Client
9. API Diagrams - Visual flow charts
10. CI/CD Configs - GitHub Actions & GitLab CI
11. Versioning Detection - API version analysis
12. Rate Limits - Rate limit documentation
All features are opt-in via flags. Your existing workflows remain unchanged!