Skip to content
Home

Writing ·

How I built this portfolio

How I built saifbuilds.dev on Next.js 16 and React 19: content as data, JSON-LD, per-page share images, and why two Lighthouse modes disagreed on LCP.

Why I rebuilt it

The first version of this site started in January 2026 from Create Next App: a hero, a list of skills, a work timeline and a contact form. It worked, but it read like most developer portfolios. It listed technologies and job titles and left the reader to guess what I had actually built.

In October 2026 I rebuilt it as an engineering dossier. Every project is a case study with the same six parts: context, my role, the architecture, the decisions I made, the results and the stack. Someone hiring for a full stack or AI role should be able to see in a few minutes what the problem was, what I owned and what changed because of it.

Most of my client work is under NDA, so the case studies describe each client by its domain, such as public transit, tax compliance, legal operations or cybersecurity, and never by name. The numbers are real; the client names are left out.

Stack and structure

The site is Next.js 16 with the App Router, React 19 and TypeScript, styled with Tailwind CSS v4 and hosted on Vercel.

Almost everything is a React Server Component, and every page is prerendered at build time. The homepage is static, and each case study is generated from its slug with generateStaticParams, so a visitor gets finished HTML and the server does no work per request. Only a few pieces ship JavaScript to the browser: the header for the mobile menu, the theme toggle and the contact form.

The contact form posts to a single API route, which rate-limits by IP and sends the message through Resend. A pre-commit hook and a gitleaks workflow in GitHub Actions scan for secrets before anything reaches the repository.

Content as data

Every word on the site lives in one file, content.ts, and components only render it. Case studies are typed objects with a fixed shape, so a missing section or a misspelled field is a TypeScript error at build time, not a broken page in production.

The same objects drive everything around the content: the sitemap, page titles and descriptions, structured data and share images. They cannot drift apart. Adding a case study means adding one object; the route, sitemap entry, metadata and share image follow from it. This article is one of those objects too.

Each page also carries two dates: when it was first published and when its content last changed. Those dates feed the sitemap and the structured data instead of the build time, so search engines only see a page as updated when it really was.

SEO: metadata, JSON-LD and the sitemap

Each page sets its own title, a meta description of 140 to 160 characters and a canonical URL through the Next.js Metadata API. The canonical is set per page rather than in the root layout, so the 404 page does not inherit the homepage's canonical. Next.js marks 404 responses noindex on its own.

Structured data is JSON-LD with stable @id values. The root layout describes the website, me as a Person (job title, location, the topics I work on, and my LinkedIn and GitHub profiles) and my employer. Each case study adds a CreativeWork and a BreadcrumbList that point back to that Person and WebSite by @id instead of repeating them. This article does the same with an Article.

Every case study also gets its own share image, generated at build time with next/og from the project name and one key result, in the same fonts as the site. A shared link shows what the project achieved, not a generic card.

I also removed the meta keywords tag, which search engines have ignored for years, and retired a page that nothing linked to.

Performance, and which LCP to trust

On a phone, the largest element on the homepage is my portrait, so it decides Largest Contentful Paint. It loads with priority and a high fetch priority. I rewrote its sizes attribute from the real layout width at each breakpoint, served it as AVIF or WebP, and capped the generated widths at 1080 pixels because the source is only 800 wide. A phone now downloads a 16 KB image.

Even with the image sorted, the single stylesheet still blocked rendering for about 700 ms on a throttled mobile connection. Next.js has an experimental option to inline CSS into the HTML, and turning it on removed that request. The contact form, the last thing on the page, now loads its JavaScript only when it scrolls near the viewport.

Measured with Lighthouse's devtools throttling, mobile went from a Performance score of 91 and an LCP of 2.26 s to 97–98 and about 1.7 s. Then I learned something about measurement. PageSpeed Insights uses Lighthouse's simulated throttling, which estimates a slow connection from a fast trace, and on the same build it reports an LCP of about 3.0 s. The simulation assumes every script requested before the image painted had to load first, and roughly 100 KB of that is React and Next.js itself.

The lesson: decide which measurement you are optimising for before you start, and check it in PageSpeed Insights, not only locally. Lab scores are a proxy anyway. Google ranks on real-user data from the Chrome UX Report.

What I would do next

Ship less JavaScript. The header is a client component only because of the mobile menu; making it a server component with a small client piece for the menu would cut what has to load before the page settles. After that, track real-user Core Web Vitals alongside the lab scores.

On the content side: new case studies as projects finish, and more articles like this one, with an index page to list them.