# npm Package Dependency Intelligence (`taroyamada/npm-package-dependency-intelligence`) Actor

Analyze npm package metadata, versions, dependencies, maintainer hints, release cadence, and package risk signals using the official npm registry API.

- **URL**: https://apify.com/taroyamada/npm-package-dependency-intelligence.md
- **Developed by:** [太郎 山田](https://apify.com/taroyamada) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## npm Package Dependency Intelligence

Analyze npm packages from the official `registry.npmjs.org` packument endpoint and export flattened rows for package summaries, version metadata, dependency declarations, maintainer hints, release cadence, and package hygiene signals.

This actor is built for direct package watchlists. It does not scrape npmjs.com HTML pages.

### Inputs

| Field | Default | Notes |
|---|---:|---|
| `packages` | required | npm package names such as `react`, `vite`, `express`, or `@types/node`. |
| `includeVersionHistory` | `true` | Emit `package_version` rows. When false, only the latest version row is emitted. |
| `includeDevDependencies` | `true` | Include `devDependencies` from emitted versions. |
| `maxVersionRowsPerPackage` | `100` | Cap version rows per package. |
| `maxDependencyRowsPerPackage` | `250` | Cap dependency rows per package across emitted versions. |
| `concurrency` | `5` | Parallel package fetches. |
| `timeoutMs` | `15000` | Per-request timeout in ms. |
| `delivery` | `dataset` | `dataset` or `webhook`. |
| `webhookUrl` | empty | Required when `delivery=webhook`. |
| `dryRun` | `false` | Skip dataset and webhook delivery. |

### Dataset Rows

The dataset is flattened so it can be filtered and joined without unpacking one large object.

`package_summary`

- `packageName`, `normalizedPackageName`, `requestedName`, `status`
- `latestVersion`, `description`, `license`, `homepage`, `repositoryUrl`, `bugsUrl`
- `keywords`, `author`, `maintainers`, `publisher`, `distTags`
- `versionCount`, `emittedVersionCount`, `firstPublishedAt`, `latestPublishedAt`, `modifiedAt`
- `releaseCadenceDays`, `dependencyCount`, `emittedDependencyCount`
- `nodeEngine`, `deprecated`, `warnings`, `fetchedAt`

`package_version`

- `packageName`, `version`, `publishedAt`, `distTags`, `isLatest`
- `license`, `nodeEngine`, `deprecated`
- dependency group counts
- `tarballUrl`, `shasum`, `integrity`, `unpackedSize`, `fetchedAt`

`dependency`

- `packageName`, `packageVersion`
- `dependencyName`, `normalizedDependencyName`
- `dependencyGroup` such as `runtime`, `development`, `peer`, `optional`, or `bundled`
- `versionSpec`, `rawSpec`, `optional`, `bundled`, `fetchedAt`

### Example Input

```json
{
  "packages": ["react", "vite", "@types/node"],
  "includeVersionHistory": true,
  "includeDevDependencies": true,
  "maxVersionRowsPerPackage": 25,
  "maxDependencyRowsPerPackage": 250,
  "concurrency": 3,
  "timeoutMs": 15000,
  "delivery": "dataset",
  "webhookUrl": "",
  "dryRun": false
}
````

### Local Development

```bash
npm install
npm test
node src/index.js
```

`output/result.json` contains the full payload for local inspection. On Apify, dataset delivery writes the flattened rows.

### Limitations

- V1 is direct package lookup only; npm search and npmjs.com HTML pages are out of scope.
- Dependency declarations come from published package metadata in `registry.npmjs.org/{package}`.
- Historical dependency rows are capped by `maxVersionRowsPerPackage` and `maxDependencyRowsPerPackage`.

# Actor input Schema

## `packages` (type: `array`):

npm package names such as react, vite, express, or @types/node.

## `includeVersionHistory` (type: `boolean`):

Emit package\_version rows. When disabled, only the latest version row is emitted.

## `includeDevDependencies` (type: `boolean`):

Include devDependencies from emitted package versions.

## `maxVersionRowsPerPackage` (type: `integer`):

Maximum package\_version rows to emit per package.

## `maxDependencyRowsPerPackage` (type: `integer`):

Maximum dependency rows to emit per package across emitted versions.

## `concurrency` (type: `integer`):

Number of npm package registry requests to run in parallel.

## `timeoutMs` (type: `integer`):

HTTP request timeout for registry.npmjs.org calls.

## `delivery` (type: `string`):

Where to send results. Webhook delivery does not also push dataset rows.

## `webhookUrl` (type: `string`):

Webhook URL to POST the full normalized payload to when delivery=webhook.

## `dryRun` (type: `boolean`):

Run without pushing rows to the dataset or webhook.

## Actor input object example

```json
{
  "packages": [
    "react",
    "vite",
    "@types/node"
  ],
  "includeVersionHistory": true,
  "includeDevDependencies": true,
  "maxVersionRowsPerPackage": 100,
  "maxDependencyRowsPerPackage": 250,
  "concurrency": 5,
  "timeoutMs": 15000,
  "delivery": "dataset",
  "dryRun": false
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "packages": [
        "react",
        "vite",
        "@types/node"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("taroyamada/npm-package-dependency-intelligence").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "packages": [
        "react",
        "vite",
        "@types/node",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("taroyamada/npm-package-dependency-intelligence").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "packages": [
    "react",
    "vite",
    "@types/node"
  ]
}' |
apify call taroyamada/npm-package-dependency-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=taroyamada/npm-package-dependency-intelligence",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "npm Package Dependency Intelligence",
        "description": "Analyze npm package metadata, versions, dependencies, maintainer hints, release cadence, and package risk signals using the official npm registry API.",
        "version": "0.1",
        "x-build-id": "7WfpLKJNmu0th1a9a"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/taroyamada~npm-package-dependency-intelligence/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-taroyamada-npm-package-dependency-intelligence",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/taroyamada~npm-package-dependency-intelligence/runs": {
            "post": {
                "operationId": "runs-sync-taroyamada-npm-package-dependency-intelligence",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/taroyamada~npm-package-dependency-intelligence/run-sync": {
            "post": {
                "operationId": "run-sync-taroyamada-npm-package-dependency-intelligence",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "packages"
                ],
                "properties": {
                    "packages": {
                        "title": "Packages",
                        "minItems": 1,
                        "maxItems": 100,
                        "type": "array",
                        "description": "npm package names such as react, vite, express, or @types/node.",
                        "items": {
                            "type": "string",
                            "minLength": 1
                        }
                    },
                    "includeVersionHistory": {
                        "title": "Include version history",
                        "type": "boolean",
                        "description": "Emit package_version rows. When disabled, only the latest version row is emitted.",
                        "default": true
                    },
                    "includeDevDependencies": {
                        "title": "Include dev dependencies",
                        "type": "boolean",
                        "description": "Include devDependencies from emitted package versions.",
                        "default": true
                    },
                    "maxVersionRowsPerPackage": {
                        "title": "Max version rows per package",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum package_version rows to emit per package.",
                        "default": 100
                    },
                    "maxDependencyRowsPerPackage": {
                        "title": "Max dependency rows per package",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum dependency rows to emit per package across emitted versions.",
                        "default": 250
                    },
                    "concurrency": {
                        "title": "Concurrency",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Number of npm package registry requests to run in parallel.",
                        "default": 5
                    },
                    "timeoutMs": {
                        "title": "Timeout (ms)",
                        "minimum": 1000,
                        "maximum": 30000,
                        "type": "integer",
                        "description": "HTTP request timeout for registry.npmjs.org calls.",
                        "default": 15000
                    },
                    "delivery": {
                        "title": "Delivery",
                        "enum": [
                            "dataset",
                            "webhook"
                        ],
                        "type": "string",
                        "description": "Where to send results. Webhook delivery does not also push dataset rows.",
                        "default": "dataset"
                    },
                    "webhookUrl": {
                        "title": "Webhook URL",
                        "type": "string",
                        "description": "Webhook URL to POST the full normalized payload to when delivery=webhook."
                    },
                    "dryRun": {
                        "title": "Dry run",
                        "type": "boolean",
                        "description": "Run without pushing rows to the dataset or webhook.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
