intro
What is itdoc?
It is a library that generates reliable, test-driven API documentation.
Features
- 🧪 Test-driven API documentation generation
- 📄 Supports OpenAPI, Markdown, HTML output(redocly style)
- 🚫 Fails to generate docs if tests fail – ensures accuracy
- 🔧 Easy integration with your existing test suite
- 🧩 Framework-agnostic (Express, NestJS, Fastify)
- 🤖 In addition, we offer automatic test generation powered by GPT
Why itdoc needed?
Tired of unreliable API documentation?
For developers working withJavaScript
or TypeScript
, documenting RESTful web services is a constant challenge. The process is completely separate from testing; every code change requires updating your tests and then manually updating your documents. It's easy for them to fall out of sync, leaving you with documentation you can't trust.
Introducing itdoc
itdoc fundamentally solves this problem by ensuring your documentation is a direct result of your verified code.
With itdoc, you're not just writing documentation. it generates docs only after tests pass, ensuring that your documentation is perfectly aligned with your team's code and tests.
1. Just write itdoc code
const app = require("../expressApp.js")
const { describeAPI, itDoc, HttpStatus, field, HttpMethod } = require("itdoc")
const targetApp = app
describeAPI(
HttpMethod.POST,
"signup",
{
summary: "User Signup API",
tag: "Auth",
description: "Performs user signup by receiving ID and password from the user.",
},
targetApp,
(apiDoc) => {
itDoc("Successful signup", async () => {
await apiDoc
.test()
.prettyPrint()
.req()
.body({
username: field("Username", "username"),
password: field("Password", "P@ssw0rd123!@#"),
})
.res()
.status(HttpStatus.CREATED)
})
...
2. Run test(with jest or mocha)

3. Boom! Reliable documents are created.
When the test passes, the document is automatically created in types such as redocly html, oas, etc.
