Skip to content

willcyber/RepoReLeaf

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Project Story: RepoReLeaf πŸŒ±πŸ’»

About the Project πŸš€

We were inspired by the hackathon track name β€” "Clean Code" β€” and the broader Sustainable Web Design movement 🌍.
As developers, we believe that writing efficient, sustainable code can have a meaningful impact on our planet, and we wanted to create a tool that empowers developers to take action ✨.

RepoReLeaf analyzes your GitHub repositories, estimates the carbon footprint of your code 🌿, suggests direct changes to make it more sustainable, and even pushes those improvements to a new branch automatically πŸ“‚πŸŒ±.

Our stack:

  • Frontend: React + Vite ⚑
  • Backend: FastAPI + Gemini API (LLM) 🧠

We also developed a custom GitHub App πŸ› οΈ that interacts with repositories, enabling seamless integration and automatic branch creation with sustainability-focused improvements.


How the Algorithm for Code Generation Works πŸ› οΈπŸ§ 

  1. Parse the Code
    We scan the repository code for static heuristics(file sizes, unused code, image formats, etc) that we find through our parsing script and estimate dynamic properties (DOM size, server response times, etc) using the Gemini LLM 🧩.

  2. Analyze and Find Problems
    Using sustainable web development practices 🌱, we prompt Gemini to analyze specific files and detect predefined problems (like inefficient image handling, unoptimized loops, etc.) πŸ•΅οΈβ€β™‚οΈ.

  3. Generate Solutions
    For each identified problem in a file, we provide Gemini with instructions to generate code improvements targeted at fixing those issues πŸ”§πŸ“„.

  4. Push Changes
    Once the improved code is generated, we offer users the ability to push the changes directly to a new branch on their selected GitHub repository πŸš€πŸŒΏ.


What We Learned πŸ“š

Throughout the project, we learned:

  • How to estimate digital emissions based on file storage and code complexity βš‘πŸ“¦.
  • Best practices for sustainable web development 🌎.
  • How to leverage LLMs like Gemini for large-scale code analysis and generation πŸ€–.
  • Building and integrating a GitHub App to automate code contributions πŸ”§.

Challenges We Faced βš”οΈ

One major challenge was deciding how to estimate emissions from repository code πŸ€”.
After research and discussion, we chose to follow the methodology outlined in Sustainable Web Design's estimation guide, using storage size and additional heuristics inspired by sustainable web development guidelines πŸ“.

Another challenge was working with Gemini API for code generation 🧩. Some of the larger reasoning tasks we needed β€” like suggesting holistic improvements for large files β€” were too slow to process in a single request 🐒.
We had to rethink our approach and break tasks down into smaller, faster operations ⚑.


We hope RepoReLeaf helps developers make cleaner, greener code accessible to everyone β€” making sustainability a first-class citizen in the world of software development πŸŒπŸ’š.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 50.9%
  • TypeScript 38.4%
  • CSS 8.7%
  • JavaScript 1.5%
  • HTML 0.5%