I have a webapp using ReactJS as the frontend and Rails as the backend service.

I have an account manager, where a user can choose multiple avatars from a default library. This library contains around 250/300 images, and uses 20Mb of disk space.

I was wondering whether it is a good thing or not to have them stored on the client side. I believe that client side storage is easier to update, since I can just add/remove/rename files from my explorer during development.

However, I hesitate quite a lot, since I am aware of possible performances issues from memory usage. Plus, once uploaded to server, images can be easily retrieved as a URL list, and I won’t have to use file libraries like fs. But it’s a pain to upload them all, not to mention I’ll need to use a specific database manager each time I need to update/add/remove a file.

Which is the best practice for this particular case, and given the libraries in use (ReactJS and Rails)?

  • 1
    Maybe I'm being dense and have missed something in the question where are users supposed to get these images from if they are not stored on the server?
    – Ant P
    Jul 25, 2019 at 9:55
  • @AntP In frontend static folder (along with css and other assets).
    – KawaLo
    Jul 25, 2019 at 10:06
  • @AntP By storing on server, I mean in a distant database handled by my backend API. Storing on client side refer to files that are sent locally with the frontend API.
    – KawaLo
    Jul 25, 2019 at 10:10
  • 2
    The best approach is the one that best meets your needs or requirements. What would you say are the needs? You have described 2 solutions but you didn't say what are they solving and it makes impossible for us to say which one is preferable. If there's no special needs or the choice is irrelevant for the project, then choose the simplest one (KISS). The one that is easier to maintain.
    – Laiv
    Jul 25, 2019 at 11:20
  • 3
    If the client option is your simplest solution go ahead. If later, needs change and the solution shift to the server option, just adapt yourself and move it. Let the needs dictate what to do. Don't anticipate because it leads to YAGNI, don't overthink it because it leads to overengineering (in opposition to KISS). Ideally, a solution is as cheap/expensive/complex as the problem it solves.
    – Laiv
    Jul 25, 2019 at 12:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.