Navigating Web Performance: From Frustrating Waits to Instant Loads with Astro

laptop-phone-loading

You're on the hunt for something online

  1. Click on the first result, and the page loads instantly. You see exactly what you’re looking for and can sign-up for a free trial. Smooth sailing. Or,

  2. Click on the first result, and the page keeps loading until a spinner finally appears. It spins away for a few more seconds until most of the content loads, only to be interrupted by annoying pop-ups asking you to accept cookies and subscribe to a newsletter.

Today's websites are multi-functional beasts. Sometimes, due to oversight or incompetence, they load a ton of stuff right from the start, leaving you twiddling your thumbs until everything's ready. This not only frustrates users but also hurts conversion rates and Core Web Vitals. But fear not, there's a solution.

Enter Astro

There’s a simple secret to building fast websites – ship less. And Astro helps us do just that.

Astro is framework-agnostic, meaning we can build components in React, Svelte, Vue, or any other framework we fancy. We can even mix and match frameworks within the same site, saving us from that expensive rewrite once The Next Big Thing™️ comes along.

By default, an Astro site is static, with dynamic components deferred until the page loads. This means you can start browsing and reading content while the site becomes interactive. And since the site is Server-Side Generated it can basically be hosted on a potato. Better yet, on multiple potatoes, all over the world! Which is a tongue-in-cheek way of saying Content Delivery Network (CDN); let me explain.

Read the full report.

astro-statistics

CloudFlare steps in

When you need to buy milk, it’s faster to go to a nearby shop than one in the next city. The same applies to web requests: it’s quicker when the server is closer to you and slower when it’s on a different continent. CDNs, like CloudFlare, effectively move the next-city shop closer to you, and another one closer to me, so that neither of us needs to venture too far for milk. The idea here is that CDNs provide many servers so that there’s one as close to each of your users as possible. And when the site is statically generated it’s easy and cheap to host it on a CDN. It is possible to do with dynamic sites too, such as hosting Remix via CloudFlare Workers for example, but let’s leave that for another time.

Now, let's talk content management.

blue-world-map

TinaCMS to the rescue

TinaCMS is an open-source, Git-backed headless content management system (CMS). With built-in version control via Git, developers can edit content directly in their code-editor software without disrupting their workflow. This integration ensures that developers can maintain their workflow efficiency without switching between different platforms. One of the standout features of TinaCMS is its ability to allow inline content editing directly within the website interface. Developers can set up editable regions on their site, enabling content editors to make changes visually without needing to access complex backend systems or codebases. This streamlines the content creation and editing process, reducing friction for both developers and content creators.

tinacms-gif

Developers have the flexibility to customize the editing interfaces provided by TinaCMS to match the specific needs of their project. Whether it's defining custom fields, creating specialised workflows, or integrating with other tools, TinaCMS offers robust customization options that empower developers to tailor content management capabilities to their exact requirements.

The edits in TinaCMS are saved as Markdown files, which is, among others, a format that Astro handles with ease making the two pieces of software a perfect match to aid us in our goal.

  1. A content editor writes a new piece of content; Say, it’s a blog post. They do this job by either writing it out in markdown or creating a new post via the website itself via TinaCMS which also results in a markdown file.

  2. The resulting markdown file is then combined with templates and styling via Astro to build out a new version of the website which includes the new blog-post in the blog section of the site.

  3. The built version of the site is then deployed to a CDN, which serves it to your users.

Winning combination

Together, Astro, CloudFlare, and TinaCMS create a winning combination. Fast load times, robust security measures, efficient content management, and version control capabilities result in an enhanced user experience for developers, content editors, and end-users alike.

Let's talk

If you want to discuss this or have IT dilemmas of your own, don't be shy to reach out

Linas Balke

Linas Balke

CEO of Adapt Lithuania