A comprehensive web application to track and visualize your carbon footprint. Calculate emissions from daily activities like commute, electricity usage, and food consumption, then visualize your impact with beautiful charts and discover carbon offset opportunities.
- 🚗 Track Commute: Calculate emissions from cars, buses, trains, planes, and motorcycles
- ⚡ Monitor Energy: Track electricity consumption and its carbon impact
- 🍽️ Food Impact: See how your dietary choices affect your carbon footprint
- 📊 Visualize Data: Beautiful daily and weekly emission charts using Chart.js
- 🌱 Offset Suggestions: Discover verified carbon offset projects via Gold Standard API
- 💾 Local Storage: Your activities are saved locally in your browser
- Frontend: React, React Router, Chart.js, React-Chartjs-2
- Backend: Node.js, Express
- APIs:
- Climatiq API - For emission factor calculations
- Gold Standard API - For carbon offset project suggestions
- Node.js (v14 or higher)
- npm or yarn
- Climatiq API key (get one at climatiq.io)
-
Clone or download the project
-
Install dependencies for all parts:
npm run install-all
Or install manually:
# Root dependencies npm install # Server dependencies cd server npm install # Client dependencies cd ../client npm install
-
Set up environment variables:
Create a
.envfile in theserverdirectory:CLIMATIQ_API_KEY=your_climatiq_api_key_here PORT=5000
Get your free API key from Climatiq
-
Start the development servers:
From the root directory:
npm run dev
This will start both the backend server (port 5000) and frontend React app (port 3000).
Or start them separately:
# Terminal 1 - Backend npm run server # Terminal 2 - Frontend npm run client
-
Open your browser:
Navigate to
http://localhost:3000to see the application.
carbon-footprint-calculator/
├── client/ # React frontend
│ ├── public/
│ ├── src/
│ │ ├── components/
│ │ │ ├── LandingPage.js
│ │ │ ├── Calculator.js
│ │ │ ├── ActivityForm.js
│ │ │ ├── EmissionsChart.js
│ │ │ └── OffsetSuggestions.js
│ │ ├── App.js
│ │ └── index.js
│ └── package.json
├── server/ # Express backend
│ ├── index.js
│ └── package.json
├── package.json
└── README.md
- Landing Page: Start at the beautiful green-themed landing page
- Calculate Emissions: Click "Calculate Your Footprint" to start
- Add Activities:
- Enter your commute details (vehicle type and distance)
- Add electricity consumption (kWh)
- Log food consumption (type and quantity)
- View Charts: Switch to the Charts tab to see daily and weekly trends
- Explore Offsets: Check the Offsets tab for carbon offset project suggestions
POST /api/calculate/commute- Calculate commute emissionsPOST /api/calculate/electricity- Calculate electricity emissionsPOST /api/calculate/food- Calculate food emissionsGET /api/offsets- Get carbon offset project suggestionsGET /api/health- Health check endpoint
- The application uses localStorage to persist your activities
- Make sure your Climatiq API key is valid for accurate calculations
- The Gold Standard API integration provides offset suggestions (may use mock data if API is unavailable)
This is a hackathon project. Feel free to fork and improve!
MIT
Made with 🌱 for a sustainable future