Hi Lichess-Devs,
I'm building a scalable chess SaaS platform with a NestJS backend and an open-source Vue 3 frontend (https://github.com/ImMoSer/extrapawn.com). I am currently implementing a sync feature for user studies using the study:read and study:write OAuth scopes. (for using --header 'Authorization: Bearer YOUR_SECRET_TOKEN')
I want to design the architecture right from the start to avoid 429 errors and ensure security. I have three specific questions regarding rate limiting:
- Backend as Proxy (Preferred): If my backend securely stores the OAuth tokens and proxies the API requests to Lichess, are the rate limits evaluated per user-token or strictly against my server's IP? If it's IP-based, what is the recommended global rate limit (req/s) I should configure for my backend's request queue?
- Trusted IP: If the limits are heavily IP-based, is there a process to register a backend IP as a "trusted IP" for a legitimate OAuth application?
- Client-Side Requests (Alternative): If I am forced to run the requests directly from the client's browser to avoid bottlenecking my backend IP, what are the recommended cooldowns and concurrency limits specifically for study read/write operations?
Thanks in advance for the technical insights!