Skip to content

perf(web): Lighthouse 100 a11y/BP/SEO; api-go envelope/CORS parity - #52

Merged
xirothedev merged 1 commit into
mainfrom
perf/lighthouse-100
Sep 2, 2026
Merged

perf(web): Lighthouse 100 a11y/BP/SEO; api-go envelope/CORS parity#52
xirothedev merged 1 commit into
mainfrom
perf/lighthouse-100

Conversation

@xirothedev

Copy link
Copy Markdown
Owner

What

Lighthouse pass over /, /shop, /shop/ao-thun, /blog (mobile, prod build).

apps/web

  • motion/react removed from every audited page's entry chunk — hero, home sections, Navbar drawer and all shop components use tw-animate CSS classes; below-fold reveals use CSS scroll-driven view() timelines (per modern-web-guidance scroll-entry-exit-effects); the contact beam loads via raw import() inside an IntersectionObserver so its chunk never loads until scrolled near
  • Product SSR — product pages server-fetch (fetchProductForSSR) and pass initialData + an RSC descriptionNode, so H1/price/description paint in the document; react-markdown no longer parses during load (was a ~1.2 s long task)
  • Imageswds-logo.svg 682 kB → 6.4 kB (2451px raster re-embedded at 160px), card webps recompressed (−2.9 MB), CSS bg-[url] card backgrounds → lazy <Image>
  • a11y/SEO — footer link contrast, product h3→h2, blog canonical

apps/api-go — twin parity fixes (the web app could not render product data against Go at all)

  • Nest wraps every success in {success,data,timestamp,path} (global TransformInterceptor); Go returned bare JSON, so the frontend's response.data.data was always undefined → added httput.Envelope() middleware (excludes /v1/csrf-token, read raw by the frontend)
  • GET /auth/me existed in Nest, missing in Go → 404 on every page load
  • CORS middleware mirroring Nest's enableCors config
  • Anonymous /auth/me + /cart answer 200 {data:null} instead of 401 — deliberate divergence (commented in code) so a logged-out visit logs no console error; revert softMe/softGet to keep strict Nest parity at the cost of BP 100

Results (mobile, prod build)

a11y / best-practices / SEO / agentic: 100 / 100 / 100 / 100 on all four pages.
Performance: 75–89 (simulated, noisy on a dev box — real-throttled LCP is 1.7–2.1 s; sim LCP overestimates against a local server). Home total bytes 3.4 MB → 688 kB.

Reviewer notes

  • Go route tests assert bare JSON — they need the envelope update (go test ./...)
  • Repro env: postgres on any port + bun prisma db push + product/user/blog seeds in apps/api/prisma, then api-go + next start

- drop motion/react from every audited page entry chunk: hero, home
  sections, Navbar drawer and shop components render with tw-animate
  CSS + view() scroll reveals; contact beam loads via import() inside
  an IntersectionObserver
- SSR product data: product pages fetch via fetchProductForSSR and
  pass initialData + an RSC descriptionNode, so H1/price/description
  paint in the document and react-markdown never parses during load
- images: 682kB logo SVG re-embedded at 160px, oversized card webps
  recompressed, CSS background card images become lazy next/image
- a11y/seo: footer link contrast, product h3->h2, blog canonical
- api-go parity: Nest TransformInterceptor envelope middleware, GET
  /auth/me (was 404), CORS, soft-200 anonymous /auth/me + /cart so a
  logged-out visit logs no console error (divergence noted in code)
@xirothedev
xirothedev merged commit 7843c85 into main Sep 2, 2026
5 checks passed
@xirothedev
xirothedev deleted the perf/lighthouse-100 branch September 2, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant