jsdelivr/data.jsdelivr.com

Name: data.jsdelivr.com

Owner: jsDelivr

Description: The official jsDelivr API

Created: 2017-07-12 19:14:58.0

Updated: 2018-05-23 13:52:47.0

Pushed: 2018-05-23 13:52:45.0

Homepage: https://data.jsdelivr.com/v1

Size: 871

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

jsDelivr API

Build Status dependencies devDependencies

Related projects:

The jsDelivr API allows you to:

The API is free to use and imposes no rate limits (however, if you plan to make 100+ RPM for longer periods of time, you should contact us first). Please note that usage statistics are available with a 48 hour delay. We only have data starting from Aug 19, 2017 and data older than one year may not be available.

Looking for a search endpoint? You can use the official npm API or Algolia's npm search (more info).

Let us know how you use this API

If you create a tool/plugin/etc. which uses this API, please include a link to your tool in the User-Agent header so that we can learn more about how this API is being used.

Endpoints

https://data.jsdelivr.com/v1

Restrictions

Neither jsDelivr CDN nor this API supports packages larger than 50 MB. Trying to get a list of files using the API will result in a 403 response.

List package versions
kage/npm/:name
ame: npm package name

kage/gh/:user/:repo
ser: GitHub username
epo: GitHub repository name

Example

s://data.jsdelivr.com/v1/package/npm/jquery

>

"tags": {
    "beta": "3.2.1",
    "latest": "3.2.1"
},
"versions": [
    "3.2.1",
    "3.2.0",
    "3.1.1",
    ...
]

List package files
kage/npm/:name@:version/:structure?
ame: npm package name
ersion: exact package version (not a version range)
tructure: "tree" or "flat"; defaults to "tree"

kage/gh/:user/:repo@:version/:structure?
ser: GitHub username
epo: GitHub repository name
ersion: exact package version (not a version range) or a commit hash
tructure: "tree" or "flat"; defaults to "tree"

Example

s://data.jsdelivr.com/v1/package/npm/jquery@3.2.1

>

"default": "/dist/jquery.min.js",
"files": [
    {
        "type": "directory",
        "name": "dist",
        "files": [
            {
                "type": "file",
                "name": "core.js",
                "hash": "BSsbXsDErniq/HpuhULFor8x1CpA2sPPwQLlEoEri+0=", // base64-encoded sha256
                "time": "2017-03-20T19:01:15.000Z",
                "size": 11197
            },
            {
                "type": "file",
                "name": "jquery.js",
                "hash": "DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=",
                "time": "2017-03-20T19:01:15.000Z",
                "size": 268039
            },
            {
                "type": "file",
                "name": "jquery.min.js",
                "hash": "hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=",
                "time": "2017-03-20T19:01:15.000Z",
                "size": 86659
            },
            ...
        ]
    },
    ...
]

Resolve version range
kage/resolve/npm/:name@:range
ame: npm package name
ange: any valid semver version range

kage/resolve/gh/:user/:repo@:range
ser: GitHub username
epo: GitHub repository name
ange: any valid semver version range

Example

s://data.jsdelivr.com/v1/package/resolve/npm/jquery@3

>

"version": "3.2.1"

Get package usage stats
kage/npm/:name/stats/:groupBy?/:period?
ame: npm package name
roupBy: "version" or "date"; defaults to "version"
eriod: "day", "week", "month", or "year"; defaults to "month"

kage/gh/:user/:repo/stats/:groupBy?/:period?
ser: GitHub username
epo: GitHub repository name
roupBy: "version" or "date"; defaults to "version"
eriod: "day", "week", "month", or "year"; defaults to "month"

Example

s://data.jsdelivr.com/v1/package/npm/jquery/stats

>

"rank": 7, // number of packages with more hits; null if the package doesn't have any hits
"total": 122152394,
"versions": {
    "2.2.4": {
        "total": 39473984,
        "dates": {
            "2017-07-16": 2013667,
            "2017-07-17": 4136315,
            "2017-07-18": 4006439,
            ...
        }
    },
    "3.0.0-rc1": {
        "total": 14547754,
        "dates": {
            "2017-07-16": 891674,
            "2017-07-17": 1852922,
            "2017-07-18": 1571811,
            ...
        }
    },
    ...
},
"commits": {} // same structure as "versions"; always empty for npm packages

Get package version usage stats
kage/npm/:name@:version/stats/:groupBy?/:period?
ame: npm package name
ersion: exact package version (not a version range)
roupBy: "file" or "date"; defaults to "file"
eriod: "day", "week", "month", or "year"; defaults to "month"

kage/gh/:user/:repo@:version/stats/:groupBy?/:period?
ser: GitHub username
epo: GitHub repository name
ersion: exact package version (not a version range) or a commit hash
roupBy: "file" or "date"; defaults to "file"
eriod: "day", "week", "month", or "year"; defaults to "month"

Example

s://data.jsdelivr.com/v1/package/npm/jquery@3.2.1/stats

>

"total": 837129,
"files": {
    "/dist/jquery.js": {
        "total": 987,
        "dates": {
            "2017-07-16": 19,
            "2017-07-17": 108,
            "2017-07-18": 84,
            "2017-07-19": 158,
            ...
        }
    },
    "/dist/jquery.min.js": {
        "total": 732301,
        "dates": {
            "2017-07-16": 25844,
            "2017-07-17": 72004,
            "2017-07-18": 70519,
            ...
        }
    },
    ...
}

Get the most popular packages
ts/packages/:period?
eriod: "day", "week", "month", or "year"; defaults to "month"

Example

s://data.jsdelivr.com/v1/stats/packages

>

{
    "hits": 552050612,
    "type": "npm",
    "name": "slick-carousel"
},
{
    "hits": 414990868,
    "type": "npm",
    "name": "webshim"
},
{
    "hits": 219178863,
    "type": "npm",
    "name": "emojione"
},
...

Get a badge for your project
kage/npm/:name/badge/:period?
ame: npm package name
eriod: "day", "week", "month", or "year"; defaults to "month"

kage/gh/:user/:repo/badge/:period?
ser: GitHub username
epo: GitHub repository name
eriod: "day", "week", "month", or "year"; defaults to "month"

Example

s://data.jsdelivr.com/v1/package/npm/jquery/badge

https://www.jsdelivr.com/package/npm/jquery

s://data.jsdelivr.com/v1/package/npm/jquery/badge?style=rounded

https://www.jsdelivr.com/package/npm/jquery

Query string options

All invalid values are ignored.

| Description | Format | Notes | |———————— |——————– |——————————- | | Start date (inclusive) | ?from=YYYY-MM-DD | | | End date (inclusive) | ?to=YYYY-MM-DD | | | Limit | ?limit=number | max 100 | | Page | ?page=number | |

Production config
le.exports = {
server: {
    port: 'SERVER_PORT', // defaults to 4454
    debugToken: 'SERVER_DEBUG_TOKEN' // The debug endpoint will be available at /debug/SERVER_DEBUG_TOKEN
},
db: {
    connection: {
        host: 'DB_CONNECTION_HOST', // defaults to localhost
        port: 'DB_CONNECTION_PORT', // defaults to 3306
        user: 'DB_CONNECTION_USER',
        password: 'DB_CONNECTION_PASSWORD',
        database: 'DB_CONNECTION_DATABASE', // defaults to jsdelivr-stats
    },
},
redis: {
    db: 'REDIS_DB', // defaults to 0
    host: 'REDIS_HOST',
    port: 'REDIS_PORT',
    password: 'REDIS_PASSWORD',
},
v1: {
    gh: {
        apiToken: 'V_1_GH_API_TOKEN',
    },
},

Additionally, opbeat token should be set via OPBEAT_TOKEN variable and NODE_ENV=production.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.