Back to blog

From Next.js to Astro: less waiting to browse and publish

October 30, 2026 · 4 min read

A professional website I manage ran on Next.js and worked well. It combines information about the client and the services they offer in a blog in Spanish and English. It already had 100/100 for performance in Lighthouse.

But using it, there was something I wanted to improve: some loads and page transitions felt slow. I felt waits of one or two seconds. And whenever I published content or fixed something, deploying on AWS Amplify took almost four minutes.

So I decided to look at whether a different way of building the site could help with those two waits. I ended up migrating it to Astro with help from OpenCode.

Why Astro made sense to me

I started by thinking about how people used the site. They visit to explore what my client offers, learn more about them or read their blog. Much of that content could be ready before someone opened the page.

With Astro, I could prepare the pages during the build and send the browser whatever JavaScript the site's small interactions needed.

I decided to move the whole site. Its pages shared design, navigation and languages, so keeping them together was more practical for me.

I also knew what I wanted to keep: the content in both languages, the links and the design. I wanted to improve how the site was built and published without having to redesign it.

How I worked with AI

I created a feature branch and asked OpenCode, an AI agent that works from the terminal, to migrate the site from Next.js to Astro. Then I tried deploying the changes to dev.

What happened when I deployed on Amplify

Astro was already generating the site files. The problem came afterward: the existing Amplify application was still configured to receive a Next.js deployment with server rendering.

I created a new Amplify application to publish Astro's static files. First, I reviewed the site at the temporary AWS address. Then I switched the domain.

I also checked that production served the right branch, that pages allowed indexing and that Analytics loaded.

What changed afterward

Browsing the site

Navigation now feels practically instant to me. That is my experience using it.

To put numbers behind the change, I compared the homepage Lighthouse reports from before and after:

What I measured on the homepageNext.jsAstroObserved reduction
First Contentful Paint, FCP669 ms381 ms43.0%
Largest Contentful Paint, LCP688 ms537 ms22.0%
Data transferred355 KiB135 KiB61.9%
JavaScript downloaded155 KiB3.6 KiB97.7%

The table shows rounded values. Percentages were calculated from the original data, and both reports cover the production domain with Analytics active.

Homepage comparison: FCP from 669 to 381 ms, LCP from 688 to 537 ms, transfer from 355 to 135 KiB and JavaScript from 155 to 3.6 KiB. Each metric uses its own scale.

Lighthouse stayed at 100/100, but the homepage downloaded less data and showed content sooner.

Publishing changes

This was one of the benefits that mattered most to me as a developer.

I compared eight Next.js deployments and three Astro deployments. The average shown by Amplify went from 3 minutes 58 seconds to 1 minute 45 seconds.

Across those records, the reduction was 55.7%: about 2 minutes 12 seconds less waiting per deployment.

Average Amplify deployment duration: Next.js, 237.6 seconds across eight records; Astro, 105.3 seconds across three records. Observed reduction of 55.7%.

In practice, that means less waiting to publish content, check a correction or review an adjustment. When I need to make several changes, those shorter pauses are welcome.

The time covers the deployment process shown by Amplify. It includes more than the framework's compilation.

Post-migration summary

  • Problem: reduce the wait to load the site and publish changes. The homepage transferred 355 KiB, including 155 KiB of JavaScript. Amplify deployments took 3 minutes 58 seconds on average.
  • Process: I created a feature branch, requested the Next.js-to-Astro migration through OpenCode and tried deploying to dev. I then configured a new Amplify application for static hosting, reviewed the site and switched the domain.
  • Observed results: the homepage transferred 61.9% less data and downloaded 97.7% less JavaScript. FCP fell by 43.0% and LCP by 22.0%. Lighthouse remained at 100/100. Deployments averaged 1 minute 45 seconds, a 55.7% reduction: about 2 minutes 12 seconds less waiting per deployment.

About the comparison: Lighthouse had one desktop run per version, with different viewport widths and an active extension. Amplify was compared using eight Next.js deployments and three Astro deployments, from different applications and builds. These are observed results with small samples and conditions that were not identical.