# npm Package Health & Abandonment Checker (`accommodating_aptitude/npm-package-health`) Actor

Audits the maintenance status of npm packages via the official npm Registry and downloads APIs: last release date, abandonment signal, deprecation warning, weekly downloads and trend, dependency count, license, maintainer count and a 0-100 health score.

- **URL**: https://apify.com/accommodating_aptitude/npm-package-health.md
- **Developed by:** [Korhan Coşan Ergün](https://apify.com/accommodating_aptitude) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 package checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## npm Package Health & Abandonment Checker

Audits the **maintenance status and abandonment risk** of npm packages using the
official, key-free npm APIs. No scraping — all three sources are JSON APIs.

- **Registry metadata** — `https://registry.npmjs.org/<package>`
- **Download statistics** — `https://api.npmjs.org/downloads/point/...` and
  `https://api.npmjs.org/downloads/range/...`
- **Package search** — `https://registry.npmjs.org/-/v1/search`

Pass the dependencies from your `package.json` as input and see in a single run
which of them are abandoned, deprecated, single-maintainer or unlicensed — for
supply-chain audits, security reviews and technical-debt inventories.

### Input

| Field | Description |
|---|---|
| `packages` | Package names, e.g. `["express","react","@types/node"]`. Scoped packages are supported |
| `searchQuery` | Optional: package discovery through the npm search API, e.g. `keywords:cli` |
| `maxItems` | Maximum number of packages |
| `includeDownloadTrend` | Compute the percentage change from the 30-day download series (+1 request per package) |

### Output (each record)

```json
{
  "id": "request",
  "title": "request@2.88.2",
  "link": "https://www.npmjs.com/package/request",
  "package_name": "request",
  "latest_version": "2.88.2",
  "license": "Apache-2.0",
  "last_publish": "2020-02-11T16:35:36.122Z",
  "last_metadata_change": "2026-07-17T17:10:13.431Z",
  "first_publish": "2011-01-22T17:12:54.986Z",
  "days_since_last_publish": 2463,
  "maintenance_status": "abandoned",
  "is_deprecated": true,
  "deprecation_message": "request has been deprecated...",
  "health_score": 25,
  "risk_level": "high",
  "risk_flags": ["deprecated", "abandoned-no-release-2y", "no-release-5y"],
  "downloads_last_week": 13964396,
  "downloads_trend_pct": 11.09,
  "version_count": 234,
  "releases_last_year": 0,
  "dependencies_count": 21,
  "maintainers_count": 1,
  "repository_url": "https://github.com/request/request"
}
```

#### Maintenance status (`maintenance_status`)

Based on the time elapsed since the last **real version release**:

| Status | Threshold |
|---|---|
| `active` | ≤ 90 days |
| `maintained` | ≤ 365 days |
| `stale` | ≤ 730 days |
| `abandoned` | > 730 days |

> **Why `time.modified` is not used:** npm's `modified` field is also updated by
> a deprecation marking or a metadata edit. For example the `request` package's
> `modified` value appears to be 2026, while its last real release was in 2020.
> This actor uses the newest of the real version release dates; the `modified`
> value is additionally exposed in the `last_metadata_change` field.

#### Risk flags (`risk_flags`)

`deprecated`, `abandoned-no-release-2y`, `stale-no-release-1y`,
`no-release-5y`, `no-license`, `no-public-repository`, `single-maintainer`,
`no-maintainer-listed`, `very-low-adoption`, `large-dependency-tree`,
`declining-usage`.

#### Health score (`health_score`, 0-100)

A heuristic score: maintenance freshness (the heaviest, 40 points), deprecation
status, presence of a license/repository, maintainer count ("bus factor"),
adoption and the size of the dependency tree. `risk_level` is derived from the
score, but serious flags such as `deprecated` / `abandoned` / `no-license` put a
floor under the level.

`sample_output.json` contains 3 records taken from a real local run.

### Pricing (PPE)

A `package-checked` event is fired for every package checked —
**$0.002 per package**.

### Local run

```bash
cd ~/rua/products/apify/npm-package-health
mkdir -p storage/key_value_stores/default
cat > storage/key_value_stores/default/INPUT.json <<'EOF'
{"packages": ["express","left-pad","request","node-sass"], "maxItems": 10}
EOF
APIFY_LOCAL=1 python3 main.py
## output: storage/datasets/default/*.json
```

### Known limitations

- `dependencies_count` only counts **direct** dependencies; it does not resolve
  the full transitive tree.
- npm's download series occasionally returns data-outage days as `0`. The trend
  calculation skips those days and compares the daily averages of the two
  halves; if there is not enough data, `downloads_trend_pct` returns `null`.
- The bulk download endpoint does not support scoped packages (`@scope/name`),
  so those are queried one by one (slower).
- `health_score` is a heuristic indicator, not a normative standard; for
  critical decisions look at the raw fields (`last_publish`, `is_deprecated`,
  `maintainers_count`).
- The registry document of very large packages can be several MB (including the
  readme), so lists of hundreds of packages run slowly.

# Actor input Schema

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

The npm packages to check, e.g. \['express','react','@types/node']. Scoped packages are supported. You can paste the dependencies from your package.json here to spot the abandoned/risky ones.

## `searchQuery` (type: `string`):

When filled in, packages matching this query are discovered through the npm search API and added to the 'packages' list, e.g. 'react-table' or 'keywords:cli'.

## `maxItems` (type: `integer`):

Maximum number of packages to check.

## `includeDownloadTrend` (type: `boolean`):

When enabled, the last 30 days of download data are pulled and the percentage change (growing/declining) is computed. Adds 1 extra request per package.

## Actor input object example

```json
{
  "packages": [
    "express",
    "react",
    "lodash",
    "left-pad",
    "request",
    "moment",
    "node-sass",
    "gulp",
    "axios",
    "typescript"
  ],
  "searchQuery": "",
  "maxItems": 50,
  "includeDownloadTrend": true
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all records found in this run.

# 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": [
        "express",
        "react",
        "lodash",
        "left-pad",
        "request",
        "moment",
        "node-sass",
        "gulp",
        "axios",
        "typescript"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("accommodating_aptitude/npm-package-health").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": [
        "express",
        "react",
        "lodash",
        "left-pad",
        "request",
        "moment",
        "node-sass",
        "gulp",
        "axios",
        "typescript",
    ] }

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

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).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": [
    "express",
    "react",
    "lodash",
    "left-pad",
    "request",
    "moment",
    "node-sass",
    "gulp",
    "axios",
    "typescript"
  ]
}' |
apify call accommodating_aptitude/npm-package-health --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,accommodating_aptitude/npm-package-health"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/uGzpRAYej5cKOOKvU/builds/NTBv8PipdE6nU9plw/openapi.json
