DEV Community

loading...

12 Ways To Reduce Carbon Footprints as a Full Stack Developer

Ricardo Dantas
Full-stack TypeScript & JavaScript developer, writer, solo maker. Writing articles about webdevelopment, green tech, career progression and indie hacking.
Originally published at betterprogramming.pub ・6 min read

Minimize CO2 emissions

Photo by [Noah Buscher](https://cdn.hashnode.com/res/hashnode/image/upload/v1630750454649/DRixoSz2v.html) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)Photo by Noah Buscher on Unsplash

We had an interesting presentation about Digital Sustainability at Dynamo recently that made me think about what I could do to reduce my ecological footprint in my day-to-day job as a full stack developer. That inspired me to write this post.

The simplest way to define ecological footprint would be to call it the impact of human activities measured in terms of the area of biologically productive land and water required to produce the goods consumed and to assimilate the wastes generated. More simply, it is the amount of the environment necessary to produce the goods and services necessary to support a particular lifestyle.
WWF

Did you know that the IT industry’s greenhouse gas emissions are predicted to reach 14% of global emissions by 2040? And that if the internet was a country, it would be the 7th largest polluter? It’s impressive, isn’t it?

Thinking about all the approaches I have used during my career to optimize web apps, e-commerce, and portals projects, I have concluded that the lighter and faster the application loads to the user, the more efficient energy consumption the application will have. So here are some tips you could use on your next project.

Measure

You can use tools like WebsiteCarbon.com to measure how eco-friendly your website is. In addition, you can use Safari's Lighthouse on DevTools to measure its energy impact. Then, use the following tips to form an attack plan to solve the possible issues.

Choose Renewable Energy Host Providers

Host providers and data centers may not look like they use a lot of power, but they have thousands of computers to process data and the room gets very warm. They need to keep the air cool, so air conditioning systems are a must for this industry and those systems consume a lot of energy.

The Green Web Foundation is doing a fantastic job by providing a list of the most eco-friendly host providers in the world. Consider picking one of them for your next project.

Stop daemons and Servers When You’re Not Using Them

When developers are coding apps they usually need several processes running on their local machines, in order to test and avoid crashing the live version of the app. However, eventually they will switch projects and forget to stop some of those background processes. As a result, they keep running forever or until someone notices a high consumption of memory or processing.

By stopping unused servers and background processes you can drastically (depending on the type of process) reduce your memory, processing, and power consumption.

Use Dark Mode

If you’re using an OS that supports Dark Mode, or if you have apps that allow you to switch their theme to use darker colors, consider using it. Darker colors are better for the eyes and can save battery and energy on both smartphones and laptops.

Turn Your Camera Off

In these difficult times, everyone is using tools like Google Meets, MS Teams, and Zoom for online meetings. This behavior has become part of our day-to-day.

Research has revealed that one hour of video calling or Netflix streaming emits 150 to 1,000 grams of carbon dioxide. By turning your camera off during video calls, you can reduce your carbon footprint by 96%.

Optimize Fonts

By optimizing your font files you can reduce file sizes by up to 97%.

  • Use modern web font formats such as WOFF and WOFF2. These formats use higher compression methods compared to TTF, OFT, and SVG file formats.

  • Give the browser the best chance at getting fonts right by preloading required fonts.

  • Subset your fonts to include only the characters that are required.

Use CDN and Server That Are Near to Your Users

Using CDNs and servers that are nearer to your users will reduce traffic on telecom networks, which will considerably reduce the energy consumption used by their infra-structure.

Use AMP (Accelerated Mobile Pages)

AMP makes content load faster on mobile devices by removing unnecessary code and file weight, rendering a minimalist version of the original web page.

Use Static Web Pages

Using server-side rendering solutions like WordPress will process the information to send back to the user each time someone tries to load a page. That causes the server to use more energy. You can use static generator tools to help you to distribute content that does not need to be fetched from databases every single pageview. You can also make it even better by using caching on the client side.

Do Not Use GIFs

GIF animations are fun but they create significantly larger file sizes, consuming a lot of traffic and energy. The good news is, you can replace them with the <video> element.

<video autoplay loop muted playsinline>
  <source src="/saving-energy.webm" type="video/webm">
  <source src="/saving-energy.mp4" type="video/mp4">
</video>
Enter fullscreen mode Exit fullscreen mode

Note: The order of the &lt;source&gt; tag matters! Specify the WebM &lt;source&gt; first otherwise the browser will skip it and will play the mp4 version.

Use the Lighthouse tab, available in the DevTools to check your website for GIFs that can be converted to videos. If you have any GIFs that can be converted, you should see a suggestion to “Use video formats for animated content” in the report.

Optimize Images

Images are the biggest contributors to page weight. The larger the image files you use, the more data needs to be transferred and the more energy is used. You can use some techniques and tools to solve this problem.

Use the WebP format

WebP images are smaller than JPEG and PNG, usually, it reaches a 25–35% reduction in file size. This decreases page sizes and improves performance. Using the approach below you make sure the browser will render the right image, even if it does not support WebP.

<!-- 
The browser uses the first listed source that's in 
a format it supports. If the browser does not support 
any of the formats listed in the <source> tags, it 
falls back to loading the image specified by the <img> tag.
-->
<picture>
  <source type="image/webp" srcset="green-environment.webp">
  <source type="image/jpeg" srcset="green-environment.jpg">
  <img src="green-environment.jpg" alt="">
</picture>
Enter fullscreen mode Exit fullscreen mode

Lazy load images

You can do it natively! The most popular Chromium-powered browsers (Chrome, Edge, Opera) and Firefox support the loadingattribute on the image element. The implementation for Safari is in progress. You also can check the availability of this feature on caniuse.com. Browsers that do not support the loading attribute simply ignore it without side-effects.

<img src="image.png" loading="lazy" alt="…" width="200" height="200"/>
Enter fullscreen mode Exit fullscreen mode

Check more details about the lazy loading attributes on the MDN documentation.

Image optimization tools

You can use tools like TinyPNG, TinyJPG, SvgHero, and ShortPixel. You can also use packages like image-webpack-loader , gulp-imagemin or grunt-contrib-imagemin.

Stop Using Google Search

The artist Joana Moll **created a **project in which users can know how many kilograms of CO2 are emitted by Google search since you access the website.

There is a nice alternative to Google: Ecosia search engine! Ecosia is not only an eco-friendly search engine but also privacy-friendly.

Conclusion

Reducing the footprint of tech is not only all about reducing energy consumption, it’s a win-win game!

  • The companies get to optimize their resources consumption and their costs

  • The user has a better experience with faster and lighter apps

  • The environment will have a significant reduction of pollution.

Do you know some more tips to make it even more eco-friendly? Feel free to share in the comments area!

Get Engaged

Resources

Discussion (13)

Collapse
martinromario55 profile image
Martin Romario Ntuwa

I believe most of your points are valid, but still some are just not reasonable enough. Like if I stop using Google search, will I still receive all those billion results on Ecosia. And for facts sake, if Ecosia gets as much users as google, we would be worried about it's energy consumption.

The other thing we should focus on is crypto mining, because it's now consuming more energy than anything else online. I think that's a topic you should've covered too.

The other topic is about these giant companies that own servers. Like Most servers are in Europe and Asia. Europe doesn't use coal, well as some servers in USA run on coal. Amazon is one of the top 10 companies that deal in servers and cloud computing. Even companies like Facebook and google use Amazon servers. So you should research about how these big data companies are consuming energy.

My final point is about the alternative energy sources. Earth only has a limited number of energy sources at the moment, mostly coming from Hydro power dams, Coal power plants, oil/fossil fuel and Nuclear power plants. Wind and solar power cannot really generate that much energy for industrial consumption. And our storage materials like Lead Ion can only do too much. Unless if we get some advancement in fusion energy experiments or if we discover some new mineral on Mars that we might use to make more energy.
I believe we can only do enough at the moment. Because, all these new ideas and applications that come up everyday just help make our lives easier and extend our life span. This has to come at a certain cost. We cannot choose horses over cars, we cannot choose bicycles over planes. Earth is dying either way, we can try to prolong the inevitable, or find ourselves an alternative, another way we can survive.

Collapse
bradtaniguchi profile image
Brad • Edited

Further investments into wind, solar, and yes even nuclear can meet significant amounts of energy demand and reduce carbon footprint over time. You don't need fusion or magical Mars minerals to power civilization sustainably, you just need the right kind of investments, mitigation against existing infrastructure and continual implementation over time. There are a number of countries in Europe that have large portions of their energy production being green and or nuclear. (nuclear isn't renewable, but it is very clean when done properly)

Most cloud providers publicly document their environmental impact, with all major ones aiming for or are already at carbon neutral. Generally however, cloud providers don't want to run unsustainably, hence they invest into making things as efficient as possible. When the alternative to the cloud is you doing stuff yourself, or worse getting on a plane/car and going somewhere in-person, the cloud, and thus large cloud companies are actually less energy intensive than most common alternatives.

Earth isn't dying, it's just changing incredibly rapidly. It is not the end of the world, but its deeply disturbing modern civilization more or less created this problem in the last 200 years. 200 years from now the question will be how bad did it get for those still around.

We just gotta keep the march toward making things better (and really pick up the pace to stave off the worse effects). We don't need 1 solution, we need all of them.

PS Fusion is nice, and has seen significant progress recently, but engineering the sun as an energy source isn't exactly the easiest engineering challenge. Its very possible for it to take another 50 years before seeing any real gains. In the mean time, building more renewables and possibly even investing into nuclear can and will be enough.

Collapse
codenameone profile image
Shai Almog

I use Ecosia as my primary search and Google if I don't find something. Most of the stuff we search for isn't in one of those niche sites only Google indexes. Especially when searching in English.

If you find a host that uses renewables you help fund the development of renewables and slightly reduce the usage of fossil. We can fly a bit less and choose Zoom conference over flying. We can sometimes take the train over flying. We can avoid cruises and try to pick an electric car as our next car. These are small things that have a very small impact overall but they help signal financially to policy makers how important this issue is for us.

Collapse
martinromario55 profile image
Martin Romario Ntuwa

I understand your points, but still somewhere somehow we still rotate to the same thing. Because, you may not fly and use Zoom, but even Zoom and all these other internet platforms feed on some servers which in most cases run on fossil energy. Electric cars are still a long way from setting up refilling stations that cover the entire planet. There are even cases of electric cars recharging by using fuel generators. We also want to go to the moon, and to build colonies on Mars and Ganymede, but we can't travel to space with solar power.

I believe the steps have to be taken, however small they're, but we can only do too much, unless if we discover a revolutionary alternative in the near future (like fusion energy).

Thread Thread
codenameone profile image
Shai Almog

There are scales. A flight produces many orders of magnitude more pollution than any Zoom call. We don't need to stop pollution entirely, just reduce it to manageable reasonable amounts and plant more trees in the process. Maybe find technological solutions for carbon capture etc. Individually and at small scale each of those is insignificant but at large scales they can make an impact.

Even if we find a magical solution like fusion we'd still need to replace all the energy plants in the world and get everyone to use electric energy and do carbon capture. There's no "magic bullet", we'll need to do all of these things AND hope for SEVERAL magic bullets AND advocate for heavier government regulation.

Collapse
adam_cyclones profile image
Adam Crockett

my toilet doest fill itself at night, I have to pull the handle in the morning to make it fill for the rest of the day. It's quite funny and I joke that it's an eco feature that saves water, but really the only way that would save water is by me dieing in the night as the next tankful wouldn't be required.

I respect this list and will try to understand the suggested, besides small changes make a big difference (we are cutting plastic out at home)

My ability to work funds my reductions and steps towards a more eco life, sooner or later my overal world footprint should be neutral... Sadly it's 30 years too late, but I will raise my children to have a small impact.

Collapse
johnkazer profile image
John Kazer

It is certainly going to be possible to generate our energy (not just electricity) from renewables within the next 30 years weforum.org/agenda/2020/02/renewab...

Collapse
johnkazer profile image
John Kazer

As a (theoretical) example, the whole Sahara Desert receives 22 billion GWh of sunshine energy per year. Which translates, at 20% panel efficiency, to 4.4 million TWh of electricity. Which is 37 times more than 2018 total world energy demand.
For example theconversation.com/should-we-turn... and iea.org/reports/key-world-energy-s...

Collapse
alidev profile image
Ali Kamalizade

Great stuff, thanks for sharing!

Collapse
ricardodantas profile image
Ricardo Dantas Author

Thanks @alidev ! 🙏

Collapse
jessicawanda profile image
Jessica Wanda ✤

Thank you for this. This is so helpful 😘

Collapse
realattila profile image
[ATTILA]

it can be good point for Start Tnx for sharing

Collapse
leouofa profile image
Leonid Medovyy

All sounds good, except for AMP. I wouldn’t use that if someone paid me.