I am facing the challenge of working with an API that has a limited request capacity, and I want to avoid exceeding this limit by having users directly access the endpoint. My solution involves using JavaScript to automate periodic requests to the API, which will then update a MongoDB cluster with the retrieved data. This way, users can access data stored in their local session storage, which is regularly updated with the data from the MongoDB cluster, instead of making direct requests to the API.
However, I am unsure how to actually implement this solution. I need the code to run autonomously, independent of the client, and to continue operating even when the webpage is not actively being visited. I welcome any suggestions or ideas on how to achieve this.