celestemods-com / CelesteMods

https://celestemods.com
Other
2 stars 2 forks source link

Cache External API Requests #533

Open otobot1 opened 10 months ago

otobot1 commented 10 months ago

Is your feature request related to a problem? Please describe. This uses certain external resources, primarily images from GameBanana. Right now, these are requested directly in the client and are cached only by the browser. For the sake of minimizing the load this project puts on Gamebanana, caching should be improved.

Describe the solution you'd like Implement Next.js's Image component for GameBanana images and verify that this implements server-side caching of the images.

Describe alternatives you've considered

  1. Cache the image files directly on the backend server. Write them to disk, and write the file names to the database. Best way is probably to create a ModImage table that has id, modId, and imagePath columns and add an imageExpires timestamp column to the Mod table. The frontend can then grab the image using the tRPC API, which will handle frontend caching.

  2. We could implement only frontend caching. This wouldn't minimize the hit to GameBanana nearly as much, but it would still be a good first step. EDIT: #764

Additional context N/A.

otobot1 commented 10 months ago

Resolving #531 would also resolve this issue, as then we could simply serve the GameBanana images using Next.js's Image component. Right now, we are unable to use it to server external images. We receive this error due to being unable to edit next.config.mjs.

otobot1 commented 4 months ago

531 is closed, so this issue may now be resolvable using Next.js's Image component.