api-version-platform
v0.3.2
Published
Local-first API versioning and testing: turn your API README into versioned OpenAPI documents, compare versions and test endpoints, with the same dashboard as the hosted platform.
Maintainers
Readme
api-version-platform
Local-first API versioning and testing. Turn the API documentation in your project's README into versioned OpenAPI documents, compare versions, and test endpoints from the same dashboard as the hosted API Version Platform, with no database server, accounts or sign-in.
Requires Node.js 22.19 or later.
Quick start
From the project whose README documents its API:
Install it once in your project (or globally with npm install -g api-version-platform), then use the short avp command:
npm install --save-dev api-version-platform
npx avp init
npx avpWithout installing, name the package so npx fetches the right one: npx -p api-version-platform avp init (or npx api-version-platform init). Plain npx avp only works once the package is installed, because the npm package named avp is a different, unrelated package.
Need a starting point for your API docs? npx avp template writes API_README_TEMPLATE.md, a README template in the format the parser reads, into the current directory.
init reads README.md in the current directory, creates .api-platform/ (SQLite database, specs/, exports/), adds .api-platform/ to .gitignore, and saves the parsed README as the first version, v1.0.0. If the README has no supported API documentation, init still completes and you can upload or paste Markdown or OpenAPI JSON in the dashboard. To track a different Markdown file, run init --readme docs/API.md. Running it again with another path switches files and keeps the version history.
The dashboard runs on http://127.0.0.1:4173 and only answers requests from that machine. Use --port (or PORT) to change the port and --no-open to keep the browser closed.
Dashboard
- Versions: import Markdown or OpenAPI JSON by upload or paste, review the parse, save, edit the stored JSON, and compare any two versions.
- README tracking: when the tracked README changes, a banner shows what changed since the latest version and saves the edit as the next version in one click.
- Test APIs: call your API's endpoints from the latest version against named environments (base URLs). Servers listed in the document are offered as environments. API sign-in tokens stay in the browser session.
- History: method, URL, status, duration and time of requests you sent, with sensitive query values redacted.
Local mode has a single implicit user and one project named after the folder. Accounts, collaborators and share links are only available in the hosted platform.
CLI
avp and api-version-platform are the same command.
npx avp init [--readme README.md]
npx avp [dev] [--port 4173] [--no-open]
npx avp template [file] [--force]
npx avp version save "Added /users endpoint" # next version number is chosen for you
npx avp version save --label v2.0.0 --note "Breaking release"
npx avp version create v2.0.0 --note "Breaking release" # same as the PHP package's CLI
npx avp status
npx avp versions
npx avp compare [from] [to]template writes the README template to API_README_TEMPLATE.md (or the path you give) and won't overwrite an existing file unless you pass --force.
New version names follow the format of your first version and increment its last number: v1.0.0, v1.0.1, … (or v1, v2, … for projects that started with v1).
Developing this package
The package is assembled from the monorepo: the parser and diff modules come from ../Nodejs_Backend/src, and the dashboard is ../client built in local mode.
npm install
npm test # syncs shared modules into src/shared, then runs the local API tests
npm run build # syncs shared modules and builds the dashboard into client/dist
npm pack --dry-run
npm publish # runs the build first (prepack)src/shared/ and client/dist/ are generated and not committed.
