Review request

Portfolio CMS in Lovable, 8 MB photos and the bandwidth bill is climbing

Open · 10 views · asked by noor_builds · edited

Repo or live app

github.com/noor-haddad/folio-cms

Unsure about: CostsPerformance

Designers upload work and get a public page. Lovable stores the original upload and serves it with a plain <img>. The originals are straight off a camera, 6 to 8 MB each, and a portfolio page has 20 of them. Vercel bandwidth went from nothing to noticeable in three weeks and the pages are slow on mobile.

Comment

2 answers

dev_ana · edited

You are serving a 6,000px image into a 600px box, twenty times per page. Fix the delivery first, it is one component swap.

Replace <img> with next/image and give it real sizes, for example sizes="(max-width: 768px) 100vw, 33vw". It serves AVIF or WebP at the width the layout actually uses, and caches the result. A 7 MB JPEG becomes roughly 60 KB at 600px. That alone is most of your bandwidth and most of the mobile slowness.

Then fix the storage: resize on upload to a sane maximum, 2,400px long edge, and keep the original in cold storage only if a designer needs the download. Right now every visitor pays for the archive copy.

Comment
lena_ops · edited

Worth knowing which meter you are on. Vercel bills image optimization as transformations, so twenty distinct images per page is twenty transformations the first time and cache hits after. That is fine. What is not fine is a cache-busting query string on the URL, which some CMS uploads add on every render and which makes each view a fresh transformation. Check the rendered src in your page source before you conclude the numbers are just traffic.

Comment