Next.js Discord

Discord Forum

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
Open in Discord
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
View full answer

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
@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
@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
Answer
Sure thing