This repository contains the code for a Cloudflare Worker that is applied to the https://https://branch-staging.climateaction.tech/ website. It is a demonstration implementation of the Grid-aware Websites project.
The Branch website already implements a carbon-aware design, that is based on code run in a user's browser when they visit the website. This code makes several design changes to the site, which are outlined in the article "Designing Branch: Sustainable Interaction Design Principles". This Cloudflare Worker removes the client-side carbon aware code, and implements grid-aware design changes to the website run at the edge.
The code on this website is only applied to the Branch staging website at the moment. The public Branch website currently implements the previous client-side carbon aware code.
Note: A valid Electricity Maps API key is required for this project.
To make changes to this Worker, and deploy it:
- Fork this repository, and clone it to your development environment.
- In your terminal, navigate to the folder that the project is cloned into.
- Run
npm install
to install all the project dependencies.
When you're ready, you can deploy your worker to run on your website for the actual path you've configured. Run npx wrangler deploy
in your terminal to deploy your Worker to production.