---
title: "Tech Tip #17: Serve static sites from the edge (video)"
description: "A page view shouldn't need a database."
url: https://greencode.ai/shorts/17-cache-and-compress-at-the-edge/
---

# Tech Tip #17: Serve static sites from the edge (video)

## Tech Tip #17: Serve static sites from the edge

**A page view shouldn't need a database.**

[Watch the video](https://media.greencode.ai/shorts/cache-and-compress-at-the-edge-972ac8e14614.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### The problem

Content sites often run an application server and a database for every page view, even though the pages change rarely.

### The fix you can use today

- Pre-render pages that rarely change as static files.
- Serve them from a CDN or edge network with long cache lifetimes.
- Keep server-side code only for things that really are dynamic, like forms.

GreenCode moved its own website from WordPress to static pages served from the edge.

### Tools that help

- [Greencheck](https://developers.thegreenwebfoundation.org/api/greencheck/v3/check-single-domain/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode) (Green Web Foundation): checks whether a domain is hosted on renewable-powered infrastructure
- [CO2.js](https://developers.thegreenwebfoundation.org/co2js/overview/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode) (Green Web Foundation): an open-source library that turns bytes transferred into an estimate of CO2, using the Sustainable Web Design model
- [WebPageTest](https://www.webpagetest.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): loads a real page and shows every request, its size and when it loaded

### How GreenCode helps

GreenCode helps tackle this by proving it on greencode.ai first: static pages on an edge network, WebP images and scripts only where used. A first view of the home page fell from 6,766 KB over 80 requests to 1,719 KB over 33. [More on this](https://greencode.ai/green-hosting/).

### Tags

#cdn#caching

### Sources

- [Green hosting: static delivery, nothing computed per request except forms](https://greencode.ai/green-hosting/)
- [Sustainable Web Design, Guideline 4.10: use CDNs when beneficial](https://sustainablewebdesign.org/guidelines/4-10-use-content-delivery-networks-cdns-when-beneficial/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [W3C, Web Sustainability Guidelines: deliver static content in place of dynamic wherever possible](https://www.w3.org/TR/web-sustainability-guidelines/#static-over-dynamic)

### Transcript

A page view should not need a database. Many content sites build every page fresh, for every visitor. An app server runs code, and a database answers queries. Yet the pages themselves change only now and then. That is work repeated on every single view. Here is the fix you can use today. Build pages that rarely change as plain static files. Serve them from a content delivery network, close to your visitors. Give them long cache lifetimes. Keep server code only for parts that really change, like forms. GreenCode moved its own website from WordPress to static pages served from the edge. Check the result using tools like Greencheck, CO2.js and WebPageTest. They check for green hosting, estimate carbon from bytes, and show every request. GreenCode helps tackle this by proving it on its own site first. Its home page fell from six point eight megabytes to one point seven. That was GreenCode Tech Tip number seventeen. Follow for the next tip, and find more on greencode.ai/tech-tips.

[The tip in full](https://greencode.ai/tech-tips/17-cache-and-compress-at-the-edge/)

[« Tech Tip #16: Use the smallest AI model that does the job](https://greencode.ai/shorts/16-smallest-model-that-does-the-job/)[Tech Tip #18: Don't build strings with += in a loop »](https://greencode.ai/shorts/18-dont-build-strings-in-a-loop/)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/) · [All GreenCode videos](https://greencode.ai/videos/)

#### Key Facts

- Tip **#17**
- For **Ops and infrastructure**
- Length **1:07**
- Category **Web and front-end**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

Want this checked on your own system? Talk to the GreenCode team.

[Get in touch](https://greencode.ai/contact/)
