Skip to content
© Devang Patel

How I built this portfolio for speed

The decisions behind a fast, motion-heavy Next.js portfolio: server-rendered HTML, 3D that loads only on intent, one canvas for every model, and LCP measured live.

updated 15 November 20264 min read

Most developer portfolios claim to be "fast." This one is full of real-time 3D and scroll-driven motion, and it still has to load quickly on a mid-range phone. Near the end of the home page it prints its own Largest Contentful Paint, measured on your device. Here's how it's built to earn it.

Rewritten in November 2026, after the site's redesign. The first version of this post described the previous build.

Answer first: what actually moves the needle

If you only take four things away:

  1. Render HTML, not JavaScript. React Server Components send finished markup, so the page is useful before any hydration.
  2. Load anything heavy on intent. Three.js isn't even requested until your first pointer move, touch or scroll.
  3. Animate only transform and opacity. Everything else costs layout or paint on every frame.
  4. Be ruthless about fonts and images. They are the two biggest, most common Core Web Vitals regressions.

RSC-first rendering

The App Router lets most of the page be a Server Component. That means the content (headings, copy, project cards) is HTML by the time it reaches the browser. Only genuinely interactive pieces (the menu, the contact form, the 3D canvas) opt into client JavaScript with "use client".

Motion follows the same rule. Sections stay server-rendered and carry plain data attributes; one small client runtime finds them after paint and attaches the animation. Motion costs one module, not a client wrapper around every section.

The practical rule I follow: a component is a Server Component until it needs state, effects, or browser APIs. Keeping that boundary tight is the single biggest lever on bundle size.

3D that never blocks

Every project on this site is shown as a real-time 3D model built in code, and the hero is one too. Three.js is not small, so the 3D is:

  • Loaded on intent. The first pointer move, touch, wheel or key press imports it. Never on load, never on idle, so it can't compete with the first paint.
  • One canvas for every model. A single fixed WebGL canvas draws each model into its box on the page, using viewport and scissor rectangles. A page with a dozen models still has one WebGL context, and a model that's offscreen costs nothing.
  • Gated. With reduced motion, data saving on, or no WebGL, it never loads. The hero shows a still render of the same model, and every other box keeps a designed fallback.
  • Capped. Device pixel ratio is capped, there are no shadow maps (a soft texture fakes the contact shadow), and geometries and materials are shared and disposed.

The result: the 3D is a progressive enhancement, not a tax on the people who can least afford it.

Motion on the compositor

GSAP drives everything that moves, and Lenis is the only smooth scroll. The rule is strict: animate transform and opacity, nothing else. The compositor handles those two; animating top, left, width or a filter forces layout or paint on every frame. The case study for this site has a live demo of the difference.

Fonts and images

Fonts are self-hosted with next/font, subset to Latin, and limited to the weights actually used, with font-display: swap. Every face has a fallback size-matched to its real metrics, so the swap doesn't reflow the text. The monospace fallback even matches character widths, so tags and chips don't re-wrap when the web font arrives.

Images go through next/image with explicit dimensions (no CLS), modern formats, and lazy-loading below the fold. The hero's still render is the Largest Contentful Paint element and gets priority; nothing else does.

Prove it, don't claim it

Near the end of the home page, the site prints your real Largest Contentful Paint, measured with the web-vitals library as the page loads. The library loads after the content, and the readout reserves its own space so it can't cause layout shift. That's the whole philosophy of this site: don't tell people you're a performance engineer; let them watch the proof on their own device.

Takeaways

  • Default to Server Components; make the client boundary earn its place.
  • Treat every dependency's weight as a budget line, and load the heaviest only on intent.
  • Animate transform and opacity, and nothing else.
  • Measure real field data, not lab screenshots.

The full build, with the code behind each of these decisions, is in this portfolio's case study.

Portrait of Devang Patel

Written by Devang Patel

Full-stack product engineer in Vadodara, India. I build the things I write about.