DEV Community

Muhammad Uzair
Muhammad Uzair

Posted on

Mobile+Web with different backends, where to store their images ?

I have a Website that uses MongoDB(mongoose) and Express, NodeJS as Backend using Pug template engine for serving frontend pages.
I am working on it locally.

All image files are stored in project directory/public/uploads, it is working fine.

Now
I wanna create a mobile app for this website which will use REST API built using Express, NodeJS.

Problem
the problem is where I can store their public assets e.g images so that both(android + web) has access to the same images etc. just like they use the same Database.

Upon Googling

  • I can either store it to MongoDB but it is not recommended as the size of Database will increase & Performance will decrease a lot (all image data need to be loaded in RAM).

  • Keeping them in the filesystem, but how would I access them from both backends? also how I would work with them locally and after deployment?

Discussion (3)

Collapse
bradstondev profile image
Bradston Henry • Edited

Do you know the how many images you will need to store? And how large those images will likely be (File sizes).?

I have some ideas, but recommendations may differ on file sizes and total size

Collapse
uzair004 profile image
Muhammad Uzair Author

Thanks, Brandston, I have selected Cloudinary as a solution as of now.

For your information:

I will be storing relatively small images, I have selected the file size to be 5MB or less. But I may change later.

Numbers of files:
one profile pic for each user
user enter articles (one/zero pic per article)
a user enters others person details (one pic)

Collapse
jswalker_in profile image
jswalker.in

In my opinion easy and cost effective way is : NginX

Access resources via direct url of nginx port