
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
@didik-mulyadi/nodejs-api-doc
Advanced tools
A nodejs library to generate the API Docs with multiple UI
This package already supports NestJS and ExpressJS.
At this point, we are focusing on adding examples with many js-doc libraries. In the future, we will create our open API doc generation, "One Code for All Frameworks", but don't worry we are still making it support with other libraries.
Install @didik-mulyadi/nodejs-api-doc using pnpm/npm/yarn:
pnpm add @didik-mulyadi/nodejs-api-doc
# OR
npm install @didik-mulyadi/nodejs-api-doc
# OR
yarn add @didik-mulyadi/nodejs-api-doc
After we set up the package correctly, we can switch the UI in your docs with this.
For example, your API doc location is `http://localhost:3000/docs
http://localhost:3000/docs?ui=swaggerhttp://localhost:3000/docs?ui=stoplighthttp://localhost:3000/docs?ui=redocFor code examples, see the examples directory or click.
This package supports any package/library that returns the open API object. These are tested framework and library that is compatible with our package:
| Library | Support |
|---|---|
| Nest JS + Fastify with @nestjs/swagger | ✅ |
| Nest JS + Express with @nestjs/swagger | ✅ |
| Express with swagger-jsdoc | ✅ |
Here's an example of how to use this package:
Step:
src/main.ts with the below stepsnew DocumentBuilder()SwaggerModule.createDocument(app, config)new NestApiDocnestApiDoc.start()import { NestApiDoc } from '@didik-mulyadi/nodejs-api-doc'
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter()
)
// swagger
const config = new DocumentBuilder()
.setTitle('Node.js API Docs')
.setDescription('This API provides ...')
.setVersion('0.0.1')
.build()
const document = SwaggerModule.createDocument(app, config)
// nodejs-api-doc
const nestApiDoc = new NestApiDoc(app, document, {
defaultUI: 'stoplight',
customPath: '/docs',
})
nestApiDoc.start()
// Run the nestjs
await app.listen(8080, '0.0.0.0')
}
Step:
src/main.ts with the below stepsnew DocumentBuilder()SwaggerModule.createDocument(app, config)new NestApiDocnestApiDoc.start()import { NestApiDoc } from '@didik-mulyadi/nodejs-api-doc'
async function bootstrap() {
const app = await NestFactory.create(AppModule)
// swagger
const config = new DocumentBuilder()
.setTitle('Node.js API Docs')
.setDescription('This API provides ...')
.setVersion('0.0.1')
.build()
const document = SwaggerModule.createDocument(app, config)
// nodejs-api-doc
const nestApiDoc = new NestApiDoc(app, document, {
defaultUI: 'stoplight',
customPath: '/docs',
})
nestApiDoc.start()
// Run the nestjs
await app.listen(8080, '0.0.0.0')
}
Step:
server.js or main.js with the below stepsconst document = swaggerJsdoc(options)const expressApiDoc = new ExpressApiDoc(app, document)expressApiDoc.start()const { ExpressApiDoc } = require('@didik-mulyadi/nodejs-api-doc')
const app = express()
...
// swagger-jsdoc
const options = {
definition: {
openapi: '3.1.0',
info: {
title: 'Node JS API Docs with Express',
version: '0.1.0',
description:
'This is a simple CRUD API application made with Express and documented with Swagger',
license: {
name: 'MIT',
url: 'https://spdx.org/licenses/MIT.html',
},
contact: {
name: 'Didik Mulyadi',
url: 'https://www.linkedin.com/in/didikmulyadi/',
email: 'didikmulyadi12@gmail.com',
},
},
servers: [
{
url: 'http://localhost:3000',
},
],
},
apis: ['./routes/*.js'],
}
const document = swaggerJsdoc(options)
// Nodejs-api-doc
const expressApiDoc = new ExpressApiDoc(app, document)
expressApiDoc.start()
app.listen(3000)
import { NestApiDoc, helmetConfig } from '@didik-mulyadi/nodejs-api-doc';
async function bootstrap() {
...
await app.register(helmet, helmetConfig.nodeApiDocHelmetOption);
...
}
If you found any issues or have a good suggestion, feel free to open an issue
We are still updating this package, to make it more useful and easy to use. Here are the next that author wants to do
bug_report.mdfeature_request.mdReach me on:
FAQs
A nodejs library to generate the API Docs with multiple UI
The npm package @didik-mulyadi/nodejs-api-doc receives a total of 177 weekly downloads. As such, @didik-mulyadi/nodejs-api-doc popularity was classified as not popular.
We found that @didik-mulyadi/nodejs-api-doc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.