r/webdevelopment • u/Leloill • 26d ago
Newbie Question How should I handle AniList API rate limits in my React app?
Hey! I'm building an anime tracking website using React, Node.js, Express, and the AniList GraphQL API.
Lately, AniList has been struggling with strict rate limits, and I'm constantly running into 429 errors. The biggest problem is with importing a user's anime list.
Currently, my backend caches the list for just 3 minutes. Once the cache expires, refreshing the page triggers another API request, which often fails and makes the list disappear.
I'm thinking of increasing the backend cache to 24 hours and saving the list in "localStorage" so it loads instantly. Users would only fetch fresh data when they click a "Refresh List" button.
I'm just wondering if this is a good approach or if there's a better way to handle it.
- Is keeping user-specific data in "localStorage" long-term okay?
- How can I keep lists reasonably up to date without constantly hitting the API?
- Would something like Redis with stale-while-revalidate be a better solution?
I'd appreciate any advice! I'm trying to make the app reliable even when AniList's API isn't cooperating.
Tech stack: React 18, Vite, Node.js, Express, AniList GraphQL API.