Giter Club home page Giter Club logo

data.jsdelivr.com's Introduction

jsDelivr API

Related projects:

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.

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.

Restrictions

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

Endpoints

See the documentation or download the OpenAPI spec file.

FAQ

Search npm packages

There is no search endpoint in this API because there are already two other APIs for that:

Contributing

Refer to CONTRIBUTING.md for more information.

Production config

module.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, ELASTIC_APM_SERVER_URL, ELASTIC_APM_SECRET_TOKEN, ELASTIC_SEARCH_URL (including user + pass), and NODE_ENV=production should be set.

data.jsdelivr.com's People

Contributors

birkhofflee avatar geraltrivyan avatar jimaek avatar martincostello avatar martinkolarik avatar zarianec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

data.jsdelivr.com's Issues

Redis Persistence

Based on https://redis.io/topics/persistence the RDB method should work best for us. We want to cache all directory listings, as they can be expensive to generate, but loosing some data is OK (i.e. a snapshot every 24 hours is good enough).

Ability to list/query packages

This is two-fold.

  1. Before, it was possible to get all the versions and assets in a single query. Now, I have to do a single query to get just the versions and then from that, do multiple requests to get each version's assets. This isn't really ideal from an API consumption standpoint because that means instead of making a single request, I'm now making dozens. Yes, I did see Trying to get a list of files using the API will result in a 403 response. on the project page, but it offers no reasonable explanation for why this is, especially considering that this was a feature of the previous API this one is supposed to supersede.

  2. Before, it was possible to query multiple packages based on wildcards. This was primarily useful for inline UI discovery and installation for a CMS. AFAICT, there is currently no replacement functionality of any kind offered. I understand this is a new structure and, likely for performance reasons, some functionality is limited. However, isn't it possible to perhaps get around this by introducing more query string options?

502 Errors for Package Metadata

Seems like we are getting 502 errors from the package metadata endpoint:

"https://data.jsdelivr.com/v1/packages/npm/jquery"

{
  "status": 502,
  "message": "Couldn't fetch versions for jquery."
}

Incorrectly showing CSS file

For recent versions of fullcalendar, the https://cdn.jsdelivr.net/npm/fullcalendar/main.min.css is being advertised when in fact its part of an old version of the package. The current version of the package (6.1.0) does not have CSS files anymore. This is confusing our users a bit!

PS- I love the recent redesign of the site. Very slick.

500 & 524 on usage stats request

I am trying to get the usage stats for my package, I also tried the example on the readme page (https://data.jsdelivr.com/v1/package/npm/jquery/stats) and I am still getting a 500 Internal Server Error.

This is the actual response I am getting after a considerable amount of time (about a minute)

{
	"status": 500,
	"message": "Internal Server Error"
}

A version list request (https://data.jsdelivr.com/v1/package/npm/jquery) works just fine...

{
	"tags": {
		"beta": "3.4.1",
		"latest": "3.4.1"
	},
	"versions": [
		"3.4.1",
		"3.4.0",
		"3.3.1",
		"3.3.0",
		"3.2.1",
		"3.2.0",
		"3.1.1",
		"3.1.0",
		"3.0.0",
		"3.0.0-rc1",
		"3.0.0-beta1",
		"3.0.0-alpha1",
		"2.2.4",
		"2.2.3",
		"2.2.2",
		"2.2.1",
		"2.2.0",
		"2.1.4",
		"2.1.3",
		"2.1.2",
		"2.1.1",
		"2.1.1-rc2",
		"2.1.1-rc1",
		"2.1.1-beta1",
		"2.1.0",
		"2.1.0-rc1",
		"2.1.0-beta3",
		"2.1.0-beta2",
		"1.12.4",
		"1.12.3",
		"1.12.2",
		"1.12.1",
		"1.12.0",
		"1.11.3",
		"1.11.2",
		"1.11.1",
		"1.11.1-rc2",
		"1.11.1-rc1",
		"1.11.1-beta1",
		"1.11.0",
		"1.11.0-rc1",
		"1.11.0-beta3",
		"1.9.1",
		"1.8.3",
		"1.8.2",
		"1.7.3",
		"1.7.2",
		"1.6.3",
		"1.6.2",
		"1.5.1"
	]
}

Sometimes I also get a Error 524 from Cloudflare...

screenshot

I am from Indonesia, I also tried using a VPN from Singapore without success.

I don't really need this for any project right now, I just think it worth to notify you about the issue.

Thank you.

Server incorrectly advertises HTTP/3 support

I'm still exploring HTTP/3 (and QUIC) so I may misunderstand something here, but as far as I can tell, https://data.jsdelivr.com seems to be advertising support for HTTP/3 protocol with the alt-svc : h3=":443" header. However attempting to make a QUIC connection to the server does not seem to be working.

Checking on a testing site also seem to indicate that HTTP/3 support is not available on the server.

It would be great that if the server does not support HTTP/3 it should not send the alt-svc header with the h3 value, or even better to enable support of HTTP/3 for the server (the https://cdn.jsdelivr.net host seems to already have good HTTP/3 support already for example).

Missing CORS header in Hong Kong

Describe the bug

data.jsdelivr.com always redirects to data-jsdelivr-com.onrender.com and without access-control-allow-origin header.

Affected jsDelivr links

(others are not affected)

Response headers

HTTP/2 301
date: Tue, 06 Sep 2022 19:32:53 GMT
content-type: text/html; charset=utf-8
content-length: 101
location: https://data-jsdelivr-com.onrender.com/v1/package/npm/element-plus
server: BunnyCDN-HK-557
cdn-pullzone: 499850
cdn-uid: b1941f61-b576-4f40-80de-5677acb38f74
cdn-requestcountrycode: HK
alt-svc: h3=":443"
alt-svc: h3-29=":443"
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
cf-ray: 73b6887dff196e64-HKG
cdn-proxyver: 1.02
cdn-requestpullsuccess: True
cdn-requestpullcode: 301
cdn-cachedat: 08/16/2022 01:52:53
cdn-edgestorageid: 557
cdn-status: 301
cdn-requestid: 48e8a4fb986ddb35eaee263f22202c37
cdn-cache: HIT

Screenshots

image

Please complete the following information:

  • Device OS: macOS
  • Browser: Chrome / curl CLI
  • Browser version: 104.0.5112.101
  • VPN provider if you use one: BunnyCDN-HK-557
  • Your location (country): only Hong Kong (tested on CN, US, JP without any issue)

Additional context

Affected website: https://issue.element-plus.org/

Rank badge

jsDelivr rank | #1

/package/npm/:name/badge/rank/:period?
/package/gh/:user/:repo/badge/rank/:period?

Implementation similar to the existing hits badge.

Origins per project

Sent an email, but I think it bounced, so copying to here: (feel free to close whenever)

If I made a PR that saves the request's origin domain to the stats, would you accept?

Why:
My open source project is getting about 2M+ hits/month now, and I know 90% of this is coming from only a couple of websites, but sometimes jsDelivr shows unexpected spikes that I have no clue who/where is using it.

Adding the request's origin domain to the stats will let you, me, and Open Source author's see which sites use their libraries the most.

Would this be ok? Thanks so much again for jsDelivr!

Version badge

Technically it'll always show the same version as a npm version badge, but several projects out there created their own "jsDelivr CDN version" badge, so it might be a good idea to support this (+ it should work with GitHub links too).

How search

How to do a search without resorting to Algolia and the Public Registry API?

Question: Package Usage Stats Performance/Stability

Hi there! We've been experiencing frequent timeout issues (eventually receiving an HTTP 524 error) with the package usage stats api when we use a value for period other than the default month

Some times the API returns fine, but it is a consistent and recurring issue that's been causing some problems for us over at Shields.io.

Is it possible to get this API stabilized and/or is there a different API/query we could use to get the hit counts for a package/repo on a per year, week, and daily basis?

Thanks!

Add CORS preflight support for `v1/package/resolve/npm/x`

In Safari - when you make an API call to https://data.jsdelivr.com/v1/package/resolve/npm/react@latest, it will first send an OPTIONS request to validate CORs (at least according to this book and alternatively this implies it's a root URL request)

Screen Shot 2021-10-14 at 1 17 23 PM

This doesn't seem to happen in Chromium browsers though ๐Ÿก

You can reproduce by loading https://www.typescriptlang.org/play/?jsx=2&esModuleInterop=true&q=407#example/typescript-with-react in Safari

Looking up packages by query

Hi this is Oskar from JSFiddle.

I've been looking into using the API for our NPM needs, one thing that would be needed is a way to search for packages by the name string.

Is this by any chance on your roadmap for the API?

GitHub packages not working properly

It seems that since a while accessing files and metadata of GitHub projects is not working very reliable anymore. I think it has something to do with the fact that the versions cannot be loaded from GitHub:

Repository (working): http://github.com/bgrins/spectrum (tags exist, releases exist)
Landing Page (working): https://cdn.jsdelivr.net/gh/bgrins/spectrum/
Listing versions via API (not working): https://data.jsdelivr.com/v1/package/gh/bgrins/spectrum
Listing files via API (not working): https://data.jsdelivr.com/v1/package/gh/bgrins/[email protected]/flat

This is causing LibMan (ASP.net core library manager) to fail if you have GH packages.

Edit: If this issue would be better placed over at the data.jsdelivr.com repo feel free to move the issue with the "transfer issue" option of GH.

How could I refresh my CDN cache?

As we know, the cache has no time limit, so how can I refresh my CDN cache without a new release? Need I post an email to anyone? Thank you for helping me. :D

Download stats for custom CDN endpoints

I was wondering if there is any way to get the download stats for custom CND endpoints (and in particular cdn.jsdelivr.net/pyodide/).

We talked about it a year or so ago, and it was costly to obtain at the time. So just opening this issue in case the situation changed since (I seem to remember some Github discussions about this but I could be wrong).

If there is anything we can contribute to make this easier, please let me know.

API CORS access issue via ByWave VPN

Describe the bug
CORS error for data.jsdelivr.com domain

Affected jsDelivr links
https://www.jsdelivr.com/package/npm/swiper

Response headers

age: 202
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400
cf-cache-status: HIT
cf-ray: 666b3832791f195f-HKG
cf-request-id: 0af6e173890000195f9f133000000001
content-length: 82
content-type: text/html; charset=utf-8
date: Tue, 29 Jun 2021 01:00:43 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
location: https://data.jsdelivr.com/v1/package/npm/swiper
nel: {"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v2?s=IACCOOPVNddm7kzzRgVDk1ABjHMW2xPkjK90yCyF0xLzmfOFYld7KKFfzmVrmoC%2FNFz%2FBQmKVY%2Bp7HsWBWrjJJ80CxHMf8CcYYn2UTph5FTLAOmtsqVOSKWSFsW%2FEDU%3D"}],"group":"cf-nel","max_age":604800}
server: cloudflare
strict-transport-security: max-age=31536000; includeSubDomains; preload
vary: Accept-Encoding
x-content-type-options: nosniff

Screenshots
image

Please complete the following information:

  • Device OS: Windows 10 Pro 19041.1052
  • Browser: Microsoft Edge
  • Broser version: 91.0.864.59 (Official build) (64-bit)
  • VPN provider if you use one: ByWave
  • Your location (country): China

Additional context
If VPN is disconnected, the issue disappears. I guess the VPN vendor may have some proxy rules causing this problem but still this is weird because the VPN is a transparent proxy and the header is just missing. (The access-control-allow-origin: * header exists if VPN is disconnected.)

Get combined badge and stats for same gh + npm package

If I publish code on github and npm, I'd like the jsDelivr badge to report combined stats for both. (Yay vanity metrics!)

To avoid abuse (e.g., a badge that combines stats for an unknown project with the stats for an unrelated popular project), perhaps you could use the repository field in package.json to make the correlation. It appears that field is already extracted somewhere because it appears on the page for packages.

The badge query `?style=rounded` is not working

Description

  1. The badge query ?style=rounded is not working, the shape of the badge is still square.
  2. The 'Alternate badge style' button is not working, clicking has no effect.

Affected jsDelivr links

All links.

Response headers

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140" height="20" role="img" aria-label="jsDelivr: 1B hits/month">
    <title>jsDelivr: 1B hits/month</title>
    <g shape-rendering="crispEdges">
        <rect width="51" height="20" fill="#555"/>
        <rect x="51" width="89" height="20" fill="#ff5627"/>
    </g>
    <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
        <text x="265" y="140" transform="scale(.1)" fill="#fff" textLength="410">jsDelivr</text>
        <text x="945" y="140" transform="scale(.1)" fill="#fff" textLength="790">1B hits/month</text>
    </g>
</svg>

Information

  • Device OS: [e.g. iOS, Windows, MacOS]
    MacOS
  • Browser & Version: [e.g. Chrome 103, Safari 8, Firefox 108]
    Chrome LTS
  • VPN provider (if you use one)
  • Your location (country/region)

Requisites

  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.
  • I understand that not filling out this template correctly will lead to the issue being closed.

Additional content

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.