I have created an operations journal website where users can write and read what happened during their shifts and report (on-going) incidents. I was looking to expand the solution by letting the users attatch images as well. The images should not be hosted publicly, so what are the common options?
Technologies that I’ve used to build the app are primarily: React, NextJS, Next-auth, MongoDB, and it’s all hosted on Azure.
Should I just host the images with MongoDB?
Is it possible to use say OneDrive or Workplace, which we already pay for, for image hosting?
Or is there some other practice that is highly recommended?
2
Answers
The natural storage option for things like images (or any other kind of media files) is Azure Blob Storage. Cost effective and well suited for what you usually want to do with them. Putting binary data into any kind of database is usually a waste of resources.
Using Azure Blobs to Store the Images as blobs is the standard
if you don’t want the Images to be available publicly then use a shared access signature (SAS),
https://learn.microsoft.com/en-us/azure/storage/blobs/sas-service-create?tabs=dotnet
But from the Stack you are using Mongodb can be sufficent create a seperate Collection and save the blobs there bcos
blob storage is a Nosql db. are you using azure’s NoSql db Cosmosdb ? or mongodb itself.
Do you want to trigger code using events from the db?. such as after the image is uploaded do xxxx automatically.