#Hey guys, what is better way to store an
1 messages · Page 1 of 1 (latest)
In my previous case, I stored it in public images folder and recorded their paths to the db in Node.js/Express.js app.
What technical stack are you using in your backend?
Hahaha
Im using nextjs default server
Im managing front end and backend there
yeah
but im using nodejs
xD
yeah, that's what I was concerned with
As you said, it would be Node.js/Express app, right?
since it's next.js's default support
But in my past, I used next in frontend while using Ruby on Rails in backend
so that was why I asked
Yeah sure
I was using react and laravel
Just migrated to nextjs after seeing server actions
So tell me
How can i store it on the public folder ?
I have to use some package ?
Im storing them using base64 for now, will thath be a problem? I just have a blog stored on db thats all. title content and image
The best practice for storing images, especially if you're expecting to store a lot, is to store the binary file in a bucket store (GCP/AWS S3), and just store that URL in your DB.
Can i use aws s3 for free ?
I mean i want something to work with locally
before prod
Yeah, there's a very generous free tier.
Okay cool
So from nextjs i have to store the image on aws
And return url to store it in db
Is there package for that ?
ty
You can also use Vercel's blob storage which is easier to setup.
However, be careful when using it with local development as the requests won't be cached and you'll very quickly hit the data transfer limits.