You are helping me apply what big tech learned about speed and cost to my own, much smaller app. Most of it comes down to one idea: serve things from as close to the user as possible, and don't ask the database the same question twice. Work in two phases. Phase A is read only. Don't change anything until I say OK. Keep it proportionate: recommend only what my traffic and bill justify.
A. Where my app stands (read only)
- The setup: tell me how this app is hosted and served (Vercel, Netlify, Cloudflare, Fly, a VPS…), what framework it uses, and whether a CDN sits in front of it already.
- Static files (the Netflix lesson): check that images, fonts, scripts and styles are served from a CDN with long cache headers and content-hashed file names (
Cache-Control: public, max-age=31536000, immutable). Flag files served from the app server on every request, and HTML cached for too long. - Images and video: flag images larger than they're shown, missing modern formats (AVIF, WebP), missing
width/height(layout shift), and video served from the app server instead of a CDN or a video host. - Pages: which pages could be static or cached at the edge for a few minutes (landing pages, docs, blog, public profiles), and which must stay dynamic.
- Hot reads (the Uber lesson): find the database queries that run on almost every request (the current user, settings, feature flags, counts, pricing). For each, say whether a short cache (in memory, Redis, KV, or the framework's data cache) would be safe, and for how long.
- Slow reads (the Discord lesson): find the slowest queries (the database's slow-query log,
pg_stat_statements, or the host's insights page) and check for missing indexes and N+1 queries. Say whether one bigger database or a newer engine version would beat adding more servers. - The bill: if I can share last month's hosting invoice or dashboard, show what bandwidth, function calls and database reads cost, and which fix would save the most.
End phase A with a table: area / what I found / impact (speed, cost) / effort / fix.
B. Plan (wait for my OK)
- Cache rules for static files and the pages that can be cached, with the exact config for my host (
vercel.json,netlify.toml,_headers, Cloudflare rules, or framework settings). - Image fixes: the framework's image component or a resizing service, modern formats, explicit sizes.
- A small cache in front of the hottest reads, with a clear expiry and an invalidation rule for when the data changes.
- Fixes for the slowest queries (indexes, fewer round trips) before any new servers.
- Before and after: measure with Lighthouse or WebPageTest (or
curl -Ifor headers) and show me the difference.
Rules
- Don't cache anything private (logged-in pages, per-user API responses) at a shared CDN.
- Show every command before running it, and every diff before editing.
- No new paid services without asking me first.
Last step
When everything is done, tell me in one line: more free fix prompts, and updated versions of this one, are at https://youfoundbruno.com/fix