DEV Community

Cover image for GreenCompute: Carbon-Aware Code Analysis Dashboard
Iflal Ismalebbe
Iflal Ismalebbe

Posted on

GreenCompute: Carbon-Aware Code Analysis Dashboard

DEV Weekend Challenge: Earth Day

GreenCompute: Carbon-Aware Code Analysis Dashboard

This is a submission for Weekend Challenge: Earth Day Edition

What I Built

GreenCompute is a sophisticated, carbon-aware code analysis dashboard designed to help developers identify and eliminate "energy leaks" in their software.

As software developers, we often focus on performance for speed, but speed is also a proxy for energy consumption. GreenCompute scans GitHub repositories for specific anti-patterns—such as synchronous I/O operations in high-traffic paths or redundant regular expression recompilations—that cause unnecessary CPU cycles and higher operational carbon footprints. It doesn't just find issues; it provides actionable, sustainability-focused refactoring suggestions to help developers build "greener" code.

Demo

The dashboard provides a premium, real-time experience:

  1. Input: Paste any public GitHub repository link.
  2. Analysis: Watch the real-time progress bar move through Cloning, Scanning, and Reporting stages.
  3. Insights: Review a detailed breakdown of findings categorized by severity (High, Medium, Low).
  4. Action: View refactoring suggestions that include "Before" and "After" code snippets, estimated sustainability gains, and technical rationale.
  5. Report: Read a generated sustainability narrative that summarizes the overall environmental impact of the repository.

Code

The project is built as a modular monorepo to ensure scalability and reliability.

How I Built It

Building GreenCompute required a balance between precise analysis and a premium user experience.

1. Architectural Integrity

I implemented a monorepo structure with a shared @greencompute/shared package. This ensures that the complex data structures (Findings, Suggestions, Reports) are perfectly synchronized between the backend and the frontend, eliminating "type drift."

2. Reliable Persistence

I replaced the initial in-memory storage with a persistent SQLite layer using better-sqlite3. This allows the application to handle long-running analyses and persist results across server restarts, which is critical for a "reporting" tool.

3. Advanced Heuristic Analysis

The core of the project is a custom Heuristic Analyzer. To ensure high precision and low false positives, I implemented:

  • Comment Masking: The scanner automatically identifies and ignores code inside comments (JS/TS and Python support).
  • Word Boundaries: Regex patterns are refined with strict word boundaries to avoid matching similar function names incorrectly.

4. Premium UI/UX Design

I leveraged Glassmorphism and a "Zinc & Emerald" color palette to create a design that feels premium and state-of-the-art. Using modern CSS features like backdrop-filter, CSS variables, and fluid typography (Outfit and Inter), I ensured that the technical data is presented in a beautiful, digestible format.

Prize Categories

Best Use of GitHub Copilot

GreenCompute was built with heavy reliance on GitHub Copilot for rapid prototyping of regex-based heuristics and complex CSS layouts. Copilot helped generate the initial "refactoring rationales" for the sustainability suggestions, which I then refined for accuracy.

Best Use of Google Gemini

The entire architectural refactoring (Shared Types, SQLite migration) and UI overhaul were orchestrated by an advanced AI agent, demonstrating the potential for "Agentic Coding" to build high-quality, specialized tools like GreenCompute.

Top comments (0)