The web industry contributes somewhere between 2–4% of total global carbon emissions. To me, at first sight that seemed wildly high, but it makes sense when you consider just how many people use the web, and how much power consumption that usage equates to. With this in mind, I chose Astro over its competitors in part due to its environmentally conscious practices. Whilst this is a new technology, both in general and to me, I haven’t regretted it at all – even though I’ve had to learn a new stack without much community support, and that pairing it with Svelte 5 runes was fairly challenging.
HOW DOES ASTRO HELP?
In general, the more javascript that a page requires, and therefore loads, the more power it will generally require to use. The industry standard solution, React, is a javascript library, and its functions need a base amount of javascript to run even a simple page. That bloat contributes to higher rates of avoidable energy consumption.
In comparison, and if properly managed, Astro inherently reduces power consumption by limiting the amount of javascript loaded onto a page. Their architecture ranks the lowest in terms of carbon emissions for web frameworks. With Islands Architecture, Astro renders your page as static html, with “islands” that host javascript only when interactivity is needed. The Astro Starlight Docs’ team covers a lot of this in their documentation.
You’ll see some other ways to reduce page weights, and by extension carbon emissions, later, when I cover Offline Sync in full and how I utilize Service Workers! Obviously I’m not the best of the best out there, but I try to do my part.
Discussion
No comments yet. Be the first to share your thoughts!