Firefox priviledged browser extension to track the internal system metrics and generate estimated carbon emissions.
This browser extension uses experimental API features in Firefox for access metrics and is built with modern web technologies including React, TypeScript, and Webpack. The project leverages Babel for transpilation, Material UI and Emotion for styling, and a suite of tools to streamline development and packaging.
Additionally, a backend service, cost-estimation-server, supports the extension by providing data and real-time communication. This component is deployed live; check its status above.
When starting a tracking session, please note the following:
about:config page, set:
xpinstall.signatures.required to falseextensions.experiments.enabled to trueClone the Repository:
git clone <repository-url>
cd cost-model-addon
Install Dependencies:
npm install
| Script | Command | Description |
|---|---|---|
| test | echo "Error: no test specified" && exit 1 |
Placeholder for tests (no tests currently specified). |
| build | webpack --config webpack.dev.js --mode=development --watch |
Bundles the project in development mode and watches for file changes. |
| clean | rm -rf dist |
Cleans the build output by removing the dist directory. |
| xpi | cd dist && web-ext build --overwrite-dest && mv web-ext-artifacts/carbon_footprint_tracker-1.0.zip web-ext-artifacts/carbon_footprint_tracker-1.0.xpi |
Packages the extension as a Firefox XPI file. |
| build:production | webpack --config webpack.prod.js --mode=production |
Bundles the project for production deployment. |
npm run build to start the development build with webpack in watch mode.npm run xpi from the root to generate an XPI package for distribution.npm run clean.@babel/core, @babel/preset-env, @babel/preset-react, babel-loaderwebpack, webpack-cli, copy-webpack-plugin, html-webpack-pluginreact, react-dom, typescript, ts-loader, @types/react, @types/react-dom@mui/material, @mui/icons-material@emotion/react, @emotion/styleddotenv, dotenv-cliweb-ext, webextension-polyfill@visx/gradient, @visx/group, @visx/mock-data, @visx/scale, @visx/shape@react-spring/web@types/events, @types/firefox, @types/firefox-webext-browserThe cost-estimation-server supports the browser extension by providing data and real-time communication. Built with Node.js, Express, and TypeScript, it is deployed live and its status can be monitored through the provided links.
ts-node, node-cache, winston, and ws (for WebSocket support).Navigate to the Backend Directory:
(If the backend service is in a separate directory, navigate accordingly.)
cd cost-estimation-server
Install Dependencies:
npm install
| Script | Command | Description |
|---|---|---|
| start | tsc --noEmit & node --no-warnings=ExperimentalWarning --loader ts-node/esm src/index.ts |
Compiles the TypeScript files (without emitting) and starts the backend service using ts-node and Node.js. |
Starting the Service:
Run the following command to start the backend service:
npm start
Testing the Service:
Although no automated tests are currently configured, you can verify the backend functionality by sending HTTP requests (using tools like curl or Postman) to the endpoints defined in src/index.ts.
This project is licensed under the MIT License.