karakanb / devo

A Chrome and Firefox extension that displays GitHub Trending, Hacker News, Product Hunt and Designer News on every new tab.
https://burakkarakan.com/devo/
MIT License
401 stars 46 forks source link

Use static assets for platforms instead of the Lambda API calls #46

Closed karakanb closed 3 years ago

karakanb commented 3 years ago

I have been hosting the backend for Devo on AWS Lambda as separate lambda functions, each would work on incoming requests. Even though this was easy in the beginning, it was suboptimal for multiple reasons:

Therefore, I have decided to take some advice from the community and instead of running the data fetch and parse operations on demand via lambda functions, I'd do it as a background job, and serve the resulting files as a static asset over S3. Since the Devo backend was already private because of the tokens used there, I have implemented a new version of the fetch setup which would fetch the data from every platform every 10 minutes and update a static file on S3. For the storage I have used my private DigitalOcean Spaces account, and I am running the jobs in the background without exposing anything to the outside world.

This setup has a couple of benefits:

I have been testing this setup myself and the reloads are super fast, which is a much better experience, making the page look like the data is always served from the local cache with every reload. I'll move forward with this.