Blog · Development

From WordPress to Astro: a Lighthouse score of 100 in one day

· updated · 4 min read · by

Originally written in Portuguese. Português

Dark cover with the title From WordPress to Astro: a Lighthouse score of 100 in one day and the visitor's path to the static files

4 min read

The old N3XUS website ran on WordPress with Elementor and an off-the-shelf theme. It worked, but it relied on heavy plugins for everything, loaded about 20 JavaScript files per page and still had the theme’s sample content left over in several sections.

We migrated to Astro in one working day. This is the path, with the measured numbers and the mistakes we made along the way.

In short

  • A static Astro site, with no third-party JavaScript on public pages (only one first-party 328-byte script in the head), served by rootless nginx in a container.
  • Deploy by git push: Coolify publishes in about 1 minute, and WordPress was kept as a fallback.
  • Lighthouse between 99 and 100 in all four categories, on mobile and desktop, with CLS 0.
  • The three mistakes that cost the most: a CSS effect that made images disappear, fonts shifting the layout and an animation weighing down mobile.

The new architecture

Visitante -> Cloudflare (DNS, CDN, WAF) -> Cloudflare Tunnel
          -> Traefik (Coolify) -> nginx sem root -> arquivos estáticos do Astro
  • Astro generates plain HTML at build time. The blog and legal pages are Markdown files with a validated schema.
  • Rootless nginx, with a strict CSP, HSTS and isolation headers.
  • Coolify builds the Dockerfile on every push to the main branch, via a GitHub webhook.
  • Cloudflare Tunnel delivers traffic with no open port on the server.
  • Content panel (Sveltia CMS) at /admin/, protected by Cloudflare Access and with GitHub login through a token restricted to the repository.

Precautions so nothing would break

Stable URLs. The privacy policy and the support page were already registered in app stores. We kept exactly the same addresses and created 301 redirects for the old WordPress URLs that changed.

Test subdomain first. The new site went to novo.n3xus.dev before taking over the main domain. Only after validating pages, headers and visuals was the main domain switched.

Reversible DNS switch. The main domain was a CNAME pointing to the old server’s tunnel. The switch only changed that target, and the way back was written down. Email, SPF and verification records on the same domain were not touched.

Before and after

Before (WordPress) After (Astro)
Home page HTML ~125 KB ~15 KB
JavaScript on public pages about 20 files 1 first-party file, 328 bytes
Total weight per page not measured 64 to 125 KB
Publishing WordPress dashboard git push, about 1 minute
Attack surface PHP, database and plugins static files

The old total weight is not in the table because we did not measure it with the same method before the switch, and we did not want to estimate it.

What went wrong (and how we fixed it)

Images that disappeared. A filter: drop-shadow() applied to a large image caused that image and the following section not to be painted under software rendering. We removed the effect: it was also heavy on low-end phones.

Layout jumping with the fonts. When the final font replaced the fallback, the large headings changed width and pushed the content. The solutions page had a CLS of 0.33 on desktop. Preloading the main fonts solved it.

Slow mobile because of details. The home page fluctuated between 90 and 95 on mobile. The causes were a cursor blinking in an infinite animation and a mask-image over the grid at the top. We replaced them with a static cursor and a plain gradient, and the score went to 98 to 100 in the tests.

Symbols that depended on the font. An arrow and a status dot showed up as squares in some environments, because those characters do not exist in the site’s font. They became SVG and CSS.

What kept the quality up

  • Rules written in the README: no inline styles, no stock photos with people and no infinite animations.
  • CI on GitHub: the build runs type checking and fails if inline styles show up in the generated HTML.
  • Lighthouse on every page, not just the home page. The two worst problems were on internal pages.

References

If your company’s website still depends on a heavy theme and plugins, we can talk about the migration.