Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

Migrating my portfolio from Next.js + Sanity to Astro 5

Originally published on ercan-atak.de . I moved my portfolio from Next.js 14 + Sanity to a static Astro 5 site, and the short version is: the new site ships almost no JavaScript, has no external CMS, and drops every third-party network call that used to make GDPR compliance a chore. Content that once lived in a hosted Sanity dataset now lives in the repo as MDX and JSON, validated at build time.…

The author recounts their migration of a personal portfolio from Next.js 14 and Sanity to Astro 5. The transition aimed to reduce JavaScript usage, eliminate the need for an external CMS, and minimize third-party network calls to improve GDPR compliance. The new static Astro 5 site ships almost no JavaScript and has no external CMS, which led to faster page loads and reduced legal risks.

The portfolio's content, initially stored in a hosted Sanity dataset, was moved to the repository as MDX and JSON files. Validation of these files occurs during the build process. The author implemented server-first architecture with small Svelte islands for interactive components, resulting in only four islands in total. They replaced the Sanity CMS with Astro content collections, which included MDX for blog posts, JSON for image galleries, and other content types.

The author notes that while the migration took effort, the benefits in terms of performance, privacy, and simpler content management outweigh the initial costs. They also highlight the GDPR advantages of self-hosting fonts, using cookieless analytics, and reducing the number of processors disclosed in the privacy policy. However, the author acknowledges that the static model might not be ideal for sites with frequent content updates.

Overall, they recommend the transition for content-light, interaction-light personal sites, emphasizing that the runtime should match the page's content and interactivity level.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Wednesday 19 August →