API Coingecko and Rate Limit

Hi,

I am relatively new to V0 Dev Vercel

I developed a basic Crypto Dashboard by retrieving Crypto Market Prices from Coingecko APIs.

Now that I am reaching the daily rate limit even though I haven’t been using this at all.

How does these API rate limits work ? My Vercel V0 Apps requires a user to authenticated using a password hashed. So, how to I subscribe a Coingecko API plan that will work to the apps - or it has to be tied to the Vercel V0 Account User name or User Id ? Anyone know how the API subscription plan works ?

Please advise.

Cheers

David

If your app is hitting a third party rate limit, you need to prevent your app from hitting their API as often. There are a number of ways to do this

  1. You should upgrade your code to detect rate limits and prevent itself from over fetching. Rate limits are generally communicated by the x-rate-limit headers in the response which tells you how many more requests you can make.

There are fetch wrappers like Ky that implement this for you, so you can set a retry and it won’t try again until the rate limit resets

  1. Cache the results you get. If a dozen users come to your page at the same time, your app should only make one request to the third party API. If your app is a public dashboard, you can pre-render it with Incremental Static Revalidation. Add export const revalidate = 60 and your dashboard will only refresh once a minute
  1. If you need to do more elaborate filtering, then you can mirror the data from the third party into your own database. Your app talks to your database, and you have some code that runs regularly to pull new data from the API. This is ideal especially if you have multiple sources you want to combine together
1 Like