Is it fine in next.js to have around 20mb of static images in the public folder ?
Answered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
I have 20+ mb static images in my public folder on next app. Is that fine ?
Answered by B33fb0n3
It looks like you can, yes. https://www.sanity.io/docs/assets
I havent used sanity for asset management, but I guess it's fine. Keep in mind, that you need to somehow save the files and you also need a way to serve these files via a CDN. I like to use s3 for saving the files and bunnycdn to serve the files. s3 is cheap and bunnycdn as well
I havent used sanity for asset management, but I guess it's fine. Keep in mind, that you need to somehow save the files and you also need a way to serve these files via a CDN. I like to use s3 for saving the files and bunnycdn to serve the files. s3 is cheap and bunnycdn as well
10 Replies
@Asiatic Lion I have 20+ mb static images in my public folder on next app. Is that fine ?
it is. But if you host on vercel, they will charge you for their bandwith. So watch out for an huge amount of charges...
American Chinchilla
Better to compress it. I have around 20+ images also but they are all combined less than 2MB
@B33fb0n3 it is. But if you host on vercel, they will charge you for their bandwith. So watch out for an huge amount of charges...
Asiatic LionOP
I saw this repo and he has like 40mb+
https://github.com/leerob/leerob.io/tree/main
https://github.com/leerob/leerob.io/tree/main
@American Chinchilla Better to compress it. I have around 20+ images also but they are all combined less than 2MB
Asiatic LionOP
@American Chinchilla How to do so ?
@Asiatic Lion yea, one option is image optimization an other one is to use a cdn to deliver your files. It's way cheaper. So use the Image component (optimzation) and serve your files NOT thought the public folder, instead serve them though your cdn provider of your choice (aws = cloudflare, another one would be bunnycdn). Choose which one you would like to use
@B33fb0n3 <@988744889141432330> yea, one option is image optimization an other one is to use a cdn to deliver your files. It's way cheaper. So use the Image component (optimzation) and serve your files NOT thought the public folder, instead serve them though your cdn provider of your choice (aws = cloudflare, another one would be *bunnycdn*). Choose which one you would like to use
Asiatic LionOP
@B33fb0n3 Can I use sanity cms to store the images ?
@Asiatic Lion <@301376057326567425> Can I use sanity cms to store the images ?
It looks like you can, yes. https://www.sanity.io/docs/assets
I havent used sanity for asset management, but I guess it's fine. Keep in mind, that you need to somehow save the files and you also need a way to serve these files via a CDN. I like to use s3 for saving the files and bunnycdn to serve the files. s3 is cheap and bunnycdn as well
I havent used sanity for asset management, but I guess it's fine. Keep in mind, that you need to somehow save the files and you also need a way to serve these files via a CDN. I like to use s3 for saving the files and bunnycdn to serve the files. s3 is cheap and bunnycdn as well
Answer
Sure thing