#Next.js#SanityCMS#WebDevelopment#Tutorial#ReactJs

How I Built My Portfolio with Next.js and Sanity CMS (And What I Learned)

Behind the scenes of rebuilding my personal developer portfolio with Next.js App Router, Tailwind CSS, & sub-second page loads.

How I Built My Portfolio with Next.js and Sanity CMS (And What I Learned)

Every developer reaches a point where their existing portfolio feels obsolete. My previous portfolio was built on a clunky setup with slow client-side rendering, layout shifts on mobile, and manual hard-coded HTML for every project. It was a chore to update.

For Portfolio 2.0, I set three non-negotiable architectural mandates: 100/100 Core Web Vitals on Lighthouse, fluid 60FPS spring animations powered by Framer Motion, and a headless CMS schema that would allow me to publish rich case studies and blogs in minutes. Here is how I built it.

The Portfolio Paradox

Building a personal developer portfolio is frequently harder than client projects because there are no external constraints. Clear technical constraints are the secret to finishing.


Why Next.js 15 App Router and React Server Components?

The App Router fundamentally changes how we ship JavaScript to the browser. By default, components in the 'app' directory are React Server Components (RSC). They render on the server, output pure HTML, and ship zero JavaScript to the user's browser for static content.

For dynamic interactive widgets — such as our Super Dynamic Island, theme toggles, and animated case study cards — we selectively use 'use client' at the leaf level of our component tree.

The Leaf Component Rule

Keep 'use client' boundaries as deep and small as possible. Never slap 'use client' at the top of a page layout unless the entire page truly requires client-side state.


Headless content modeling with Sanity CMS & GROQ

Rather than managing messy markdown files or dealing with static JSON drift, I modeled project case studies, client testimonials, and blog posts in Sanity CMS. Sanity's GROQ query language allows you to request the exact fields needed for a view with zero over-fetching.

Real-Time Visual Editing

Sanity's Presentation Tool with Next.js Draft Mode allows you to edit content directly in a split-screen live preview with instant on-demand cache revalidation.

❌Overfetching Bloated REST Endpoints

// Inefficient: Downloads 80KB of unused fields on initial load
const res = await fetch('https://api.cms.com/projects');
const allProjects = await res.json();

✅Surgical GROQ Query in Next.js Server Component

// Exact payload: Only returns necessary card fields in 2KB
const query = groq`*[_type == "project" && featured == true]{
  title,
  slug,
  metrics,
  "thumbnail": coverImage.asset->url
}`;
const featuredProjects = await client.fetch(query);

Tactile micro-interactions: sound & spring physics

A great portfolio shouldn't just look pretty; it should feel tactile and responsive under your fingers. We introduced two signature details to Portfolio 2.0:

Web Audio Without Overhead

Generating synthetic audio pulses with the Web Audio API takes 0KB of network bandwidth and executes with 0ms latency compared to loading .mp3 files.

  • •Framer Motion Spring Physics: Active navigation pills and dynamic command palettes use stiffness: 380, damping: 35 for natural, momentum-based motion.
  • •Soft Acoustic Feedback: A custom 18ms Web Audio API sine oscillator generates a subtle, premium acoustic click on CTA buttons without external audio file latency.
  • •Native View Transitions: Theme switching uses document.startViewTransition with frozen snapshot capture to prevent delayed black/white element pops.

Key Takeaways

1. 1. Server Components First

Ship zero JavaScript for static content. Reserve client components strictly for interactive leaves.

2. 2. Precise Content Queries

Use GROQ or GraphQL to request exactly the fields needed for the viewport to eliminate data bloat.

3. 3. Tactile Spring Physics

Tune spring animations with high stiffness and balanced damping for an Apple-like physical feel.

4. 4. Native View Transitions

Leverage browser-level view transitions for silk-smooth, GPU-accelerated theme switching.

Published on Jun 18, 2026 · 12 min read

FROM CONCEPT TOCODE</>

LET'S TURN IDEAS INTOSOLUTIONS

I'm available for full-time roles & freelance projects.

I thrive on crafting dynamic web applications and delivering seamless user experiences.