npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aitesting

v1.1.0

Published

AI-powered API testing & documentation generator with OpenAPI/Swagger support

Downloads

112

Readme

🚀 AITesting - Complete API Testing & Documentation Suite

An AI-powered CLI tool that automatically generates Postman collections, API documentation, test files, and live endpoint testing from your backend codebase.

✨ Features

  • 🔍 Route Scanning - Automatically discovers all API routes from TypeScript files
  • 🧪 Live Endpoint Testing - Makes REAL HTTP requests and records actual responses
  • 🔐 Auth Detection - Automatically detects login endpoints and manages JWT tokens
  • 📋 Schema Detection - Finds Zod, Joi, and class-validator schemas
  • 📁 Postman Collections - Generates organized collections with example responses
  • 🌍 Environment Files - Creates local & production Postman environments
  • 🧪 Test Generation - Generates Bun test files for all routes
  • 📜 OpenAPI/Swagger - Generates OpenAPI 3.0 spec with interactive Swagger UI
  • 📚 Enhanced Documentation - Creates comprehensive markdown API docs
  • 📊 Test Reports - Saves detailed live test results in JSON format

🛠️ Installation

Install Globally (Recommended)

cd /Users/devx/Desktop/AITESTING
bun link

Now use aitesting command from anywhere!

Or Run Locally

cd /Users/devx/Desktop/AITESTING
bun install

📖 Usage

Simple Mode (Just scan and generate Postman collection)

aitesting --path /path/to/your/backend

Complete Mode (Everything!)

aitesting --path /path/to/your/backend --all

With Remote Backend

aitesting --path /path/to/backend --all --url https://api.yourapp.com

Specify Output Directory

aitesting --path /backend --all -o ~/Documents/api-docs

The --all flag runs the complete workflow:

  1. ✅ Scans backend for routes
  2. ✅ Detects authentication endpoints
  3. ✅ Finds validation schemas
  4. ✅ Tests all endpoints live
  5. ✅ Captures JWT tokens automatically
  6. ✅ Generates Postman collection with example responses
  7. ✅ Creates environment files
  8. ✅ Generates automated test files
  9. ✅ Creates enhanced documentation

📦 Generated Files

When you run with --all, you'll get:

📁 Project Root
├── postman_collection.json              # Postman collection with examples
├── local_environment.postman_environment.json
├── production_environment.postman_environment.json
├── openapi.json                         # OpenAPI 3.0 specification
├── api-docs.html                        # Swagger UI (open in browser!)
├── API_DOCUMENTATION.md                 # Markdown API docs
├── .aitesting/
│   └── report.json                      # Live test results
└── tests/auto/
    ├── users.test.ts                    # Auto-generated tests
    ├── auth.test.ts
    └── ...

🎯 What It Does

1. Route Discovery

Scans your TypeScript files using AST parsing to find all route definitions:

router.get("/users/:id", handler);
router.post("/auth/login", handler);

2. Live Testing (REAL HTTP Requests!)

⚠️ Makes actual HTTP requests to your backend:

  • Tests each endpoint with real network calls (using fetch)
  • Records actual response status codes
  • Captures real response bodies
  • Saves headers and error messages
  • Requires your backend to be running!

3. Auth Handling

  • Automatically detects login/auth endpoints
  • Obtains JWT tokens during testing
  • Injects tokens into subsequent requests
  • Adds auth headers to Postman collection

4. Schema Detection

Finds validation schemas in your code:

  • Zod schemas (z.object(...))
  • Joi schemas (Joi.object(...))
  • class-validator decorators (@IsString(), etc.)

5. Test Generation

Creates ready-to-run Bun tests:

import { test, expect, describe } from "bun:test";

describe("Users Routes", () => {
  test("GET /users/:id", async () => {
    const response = await fetch(`${baseUrl}/users/1`);
    expect(response).toBeDefined();
  });
});

6. OpenAPI/Swagger Generation

Generates industry-standard OpenAPI 3.0 specification:

  • openapi.json - Complete OpenAPI 3.0 spec
  • api-docs.html - Interactive Swagger UI
  • Includes auth schemes, request/response examples
  • Path parameters, request bodies, responses
  • Open api-docs.html in browser for interactive docs!

🔧 Configuration

The tool works out-of-the-box, but you can customize:

  • Base URL: Edit the baseUrl in generated environment files
  • Auth Token Detection: Supports token, access_token, and accessToken fields
  • Route Detection: Looks for router.* patterns in TypeScript files

📋 Requirements

  • Bun runtime
  • Backend with TypeScript route definitions
  • Routes using router.get(), router.post(), etc. pattern

🚦 Example Output

🚀 AITesting v1.0 - Full Workflow

🔍 Scanning backend in: ./backend

✅ Found 23 routes
🔐 Detected auth endpoint: POST /auth/login
📋 Detected schemas: zod, class-validator

🧪 Running live endpoint tests...

✅ Auth token obtained
✓ GET /users 200
✓ POST /users 201
✓ GET /users/:id 200
✗ DELETE /users/:id 401

📊 Live test report saved to .aitesting/report.json

📁 Generated: postman_collection.json
🌍 Environments generated (local & production)
🧪 Test files generated in tests/auto/
📘 Enhanced documentation generated (API_DOCUMENTATION.md)

✅ Complete! All features executed successfully.

📝 Important Notes

Live Testing (with --all flag)

  • ⚠️ Requires your backend to be running at http://localhost:5000 (default)
  • Makes REAL HTTP requests using fetch() - not mock/sample data!
  • Path parameters (e.g., :id) are replaced with 1 during testing
  • Failed tests are recorded in the report but don't stop the workflow
  • Responses in openapi.json and Postman collection are actual responses from your API

OpenAPI/Swagger UI

  • Open api-docs.html in any browser for interactive documentation
  • Works offline - Swagger UI loads from CDN
  • Can be hosted on any web server for team sharing

🤝 Contributing

This is a productivity tool. Feel free to extend and customize for your needs!

📄 License

See LICENSE file.