What this paper covers
This is the order we work in when a headless Next.js site is slow to build, slow to load or slow to change. Each section names the projects it comes from, and the sources at the end link to every case study the numbers were measured on.
Among them are sites on Contentful, Sanity and Shopify. Two moved from AWS to Vercel, and one was rebuilt from two PHP sites.
Builds come first
A slow build doesn’t show up in Lighthouse, but it decides how often a team can ship. Tray.ai ran Next.js 9 on AWS Serverless functions, with 250 MB packages choking every deploy. Previewing a change meant a full production build, and failed deploys were a weekly ritual.
We consolidated five repositories into one Turborepo monorepo on Next.js 13, with hybrid static and server rendering across 25 page types. Deployments that once took 24 hours now finish in two minutes: 99.86% faster.
Three smaller sites each started at 30 minutes a build.
Full build time before and after, in minutes#
- Before
- After
Bulletproof, Jamb and Trippin World case studies, robotostudio.com/case-study.
Bar chart of Before, After across 3 site values: Before is 30 throughout; After is highest for Bulletproof (4) and lowest for Jamb (3).
| Site | Before | After |
|---|---|---|
| Bulletproof | 30 | 4 |
| Jamb | 30 | 3 |
| Trippin World | 30 | 3 |
Bulletproof’s builds dropped by 87% through incremental static regeneration and a reworked build toolchain, as part of a move from AWS to Vercel. It wasn’t a rewrite: the change was the infrastructure, the deploy pipeline and a move of the localization layer onto Next.js native i18n.
Trippin World’s came down with a rebuilt Next.js static generation pipeline on Vercel. Jamb’s came with a rebuild: two legacy PHP sites became one Next.js and Sanity site.
Fetch content on purpose
Trippin World builds more than 5,000 pages, and every one of them asks Sanity for content. We restructured how content is fetched and cached during the build, so the pipeline stays inside Sanity’s API limits instead of hitting them. The result was zero build failures from API limits.
A build that size also has to survive a missing image or a missing field. Trippin’s build falls back for both, so one bad asset can’t stop the deploy.
Mario Testino’s site had 200% overages on its Sanity plan when we took it over. We stripped the project back to vanilla Sanity, removed the deprecated dependencies and abandoned libraries it had piled up, and rewrote every page, image implementation and data query. The overages went away.
Ship less code
On Tray.ai we moved from styled-components to Tailwind CSS progressively, and added next/link prefetching and next/image. The bundle got smaller, and Vercel Speed Insights scores sit in the high 90s.
Static first holds under load
A page that was built ahead of time doesn’t need a server to answer. Tray.ai’s static-first build served traffic through two DDoS waves with 0% downtime, for a site with more than a million visitors a month.
We also moved half a million pages to Vercel in six weeks, progressively rather than in a single cutover.
Keep the rankings you earned
A faster site that loses its URLs is slower to find. Mario Testino’s previous migration had left more than 160 redirects missing. We fixed every one, cleaned up the navigation so crawlers could read it, and rebuilt the structured data.
When Jamb merged two PHP sites into one, we built a sitemap spanning both, mapped every page into the new site before launch and linked pages through Sanity document references instead of hardcoded URLs. Rankings held through the cutover, and redirects found after launch shipped the same day.
The checklist
- Time a full build and a preview build. If a preview needs a production build, fix that first.
- Count the content requests a build makes, and cache them so the build stays inside your CMS plan’s API limits.
- Give every missing image and missing field a fallback, so one bad entry can’t stop a deploy.
- Weigh your component library and styling runtime against the pages that ship them.
- Build pages ahead of time wherever the content allows, and render on request only where it can’t wait.
- Map every old URL before a migration launches, and watch Search Console the week after.




