Skip to content

Eshaan-byte/Carbon-Tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

64 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฑ Carbon Footprint Tracker

A comprehensive web application that helps users track and reduce their digital carbon footprint through daily activity monitoring, personalized recommendations, and gamification.

๐ŸŒ Project Overview

The Carbon Footprint Tracker estimates COโ‚‚ emissions from digital activities like emails, video streaming, coding, video calls, cloud usage, gaming, and social media. Users can log activities, visualize their impact, receive actionable tips, set reduction goals, and earn badges for sustainable behavior.

โœจ Key Features

๐Ÿ“Š Activity Tracking

  • Manual Entry: Log daily digital activities with intuitive sliders and inputs
  • API Integrations: Automatic tracking via Gmail and GitHub APIs
  • Quick Entry: Fast logging for common activities
  • Real-time Calculations: Instant COโ‚‚ footprint calculations

๐Ÿ“ˆ Data Visualization

  • Interactive Dashboard: Charts showing daily, weekly, and monthly trends
  • Activity Breakdown: Pie charts displaying emissions by category
  • Progress Tracking: Visual progress indicators and comparisons
  • Real-world Equivalents: Contextualize emissions (e.g., "like driving X km")

๐Ÿ’ก Eco-Friendly Tips

  • Personalized Recommendations: Tips based on your highest impact activities
  • Categorized Advice: Organized by activity type (emails, streaming, etc.)
  • Impact Calculations: Potential savings for each tip
  • Interactive Application: Track which tips you've applied

๐ŸŽฏ Goal Setting & Gamification

  • Weekly Goals: Set percentage reduction targets
  • Progress Tracking: Visual goal progress with motivational messaging
  • Achievement Badges: Earn badges for consistent tracking and reductions
  • Point System: Accumulate points for various achievements
  • Difficulty Levels: Easy, medium, and hard goals to choose from

๐Ÿ” Authentication & Security

  • Google Login: Secure authentication with Google OAuth
  • GitHub Integration: Connect GitHub for automatic coding activity tracking
  • User Profiles: Personalized experience with preferences
  • Data Security: Secure storage with Firebase

๐Ÿ› ๏ธ Tech Stack

Frontend

  • Next.js 15 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Chart.js - Interactive data visualizations
  • React Charts 2 - Chart components for React

Backend & Database

  • Firebase - Authentication and Firestore database
  • Next.js API Routes - Server-side functionality
  • Cloud Functions - Serverless computing (if needed)

APIs & Integrations

  • Gmail API - Email activity tracking
  • GitHub API - Coding activity monitoring
  • Google OAuth - Secure authentication

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • TypeScript - Static type checking

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ app/                    # Next.js App Router
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout
โ”‚   โ”œโ”€โ”€ page.tsx           # Main page
โ”‚   โ””โ”€โ”€ globals.css        # Global styles
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ auth/              # Authentication components
โ”‚   โ”œโ”€โ”€ charts/            # Data visualization
โ”‚   โ”œโ”€โ”€ dashboard/         # Dashboard components
โ”‚   โ”œโ”€โ”€ forms/             # Activity input forms
โ”‚   โ”œโ”€โ”€ gamification/      # Badges and goals
โ”‚   โ”œโ”€โ”€ layout/            # Navigation and layout
โ”‚   โ””โ”€โ”€ tips/              # Recommendation system
โ”œโ”€โ”€ hooks/                 # Custom React hooks
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ api/               # External API integrations
โ”‚   โ”œโ”€โ”€ calculations/      # Carbon footprint logic
โ”‚   โ”œโ”€โ”€ firebase/          # Firebase configuration
โ”‚   โ””โ”€โ”€ gamification/      # Badge evaluation system
โ”œโ”€โ”€ types/                 # TypeScript type definitions
โ””โ”€โ”€ constants/             # App constants and data

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Firebase project
  • Google Cloud Console project (for APIs)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd cabon-tracker
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.local.example .env.local

    Fill in your Firebase and API credentials:

    NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
    NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_domain
    NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
    NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_bucket
    NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
    NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
    
  4. Configure Firebase

    • Create a Firebase project
    • Enable Authentication with Google provider
    • Set up Firestore database
    • Configure security rules
  5. Set up Google APIs

    • Enable Gmail API in Google Cloud Console
    • Configure OAuth consent screen
    • Add authorized domains
  6. Run the development server

    npm run dev

Open http://localhost:3000 to view the application.

๐Ÿ”ง Configuration

Firebase Setup

  1. Create collections in Firestore:
    • users - User profiles and preferences
    • activities - Individual activity logs
    • carbon_footprints - Daily footprint calculations
    • weekly_goals - User reduction goals
    • user_badges - Earned achievements

API Permissions

  • Gmail API: gmail.readonly scope for email counting
  • GitHub API: read:user and repo scopes for activity tracking

๐Ÿ“Š Carbon Footprint Calculations

The app uses research-based COโ‚‚ emission factors:

Activity Emission Factor
Email 4g COโ‚‚ per email
Video Streaming 36g COโ‚‚ per hour
Coding/Development 15g COโ‚‚ per hour
Video Calls 150g COโ‚‚ per hour
Cloud Storage 0.5g COโ‚‚ per GB/day
Gaming 60g COโ‚‚ per hour
Social Media 12g COโ‚‚ per hour

๐Ÿ† Gamification System

Badge Categories

  • Environmental: Reduction achievements
  • Consistency: Daily tracking streaks
  • Social: Tip application and sharing
  • Milestones: Time-based achievements

Goal System

  • Set weekly reduction targets (10-90%)
  • Track progress with visual indicators
  • Motivational messaging based on progress
  • Achievement rewards for meeting goals

๐ŸŽจ Design Philosophy

Eco-Friendly Aesthetics

  • Green color palette representing nature and sustainability
  • Earth tones and natural gradients
  • Floating leaf animations for visual interest
  • Clean, minimal design reducing cognitive load

User Experience

  • Mobile-first responsive design
  • Intuitive navigation with clear icons
  • Progressive disclosure of complex features
  • Immediate feedback for user actions

๐Ÿš€ Deployment

Vercel (Recommended)

npm run build
# Deploy to Vercel

Other Platforms

The app can be deployed to any platform supporting Next.js:

  • Netlify
  • AWS Amplify
  • Google Cloud Run
  • Traditional hosting with Node.js

๐Ÿ”ฎ Future Enhancements

Planned Features

  • Social Features: Share achievements, compete with friends
  • Advanced Analytics: Detailed emission breakdowns and trends
  • Offset Marketplace: Purchase carbon offsets directly
  • IoT Integration: Smart home device monitoring
  • Corporate Dashboard: Team and organization tracking
  • Mobile App: Native iOS and Android applications

API Expansions

  • Spotify API for music streaming tracking
  • Slack API for workplace communication
  • Cloud provider APIs (AWS, Azure, GCP) for detailed usage
  • Transportation APIs for commute tracking

๐ŸŽƒ Hacktoberfest 2025

Hacktoberfest Issues Good First Issues

๐ŸŒฑ Join Hacktoberfest 2025 and help make digital sustainability accessible!

This project welcomes contributions during Hacktoberfest! We have issues suitable for all skill levels:

๐ŸŸข For Beginners:

  • Add new activity types (music streaming, online shopping)
  • Create new eco-friendly tips and badges
  • Improve UI/UX with dark mode and accessibility
  • Add data export and visualization features

๐ŸŸก For Intermediate:

  • Build PDF report generation
  • Implement social features and sharing
  • Create mobile responsiveness improvements
  • Add API integrations

๐Ÿ”ด For Advanced:

  • Real-time collaboration features
  • AI-powered recommendations
  • Mobile app development
  • Advanced analytics and ML

๐Ÿ“‹ See HACKTOBERFEST_ISSUES.md for detailed issue ideas!

๐Ÿค Contributing

We welcome contributions from developers of all skill levels! Here's how to get started:

Quick Start

# 1. Fork this repository
# 2. Clone your fork
git clone https://github.com/YOUR_USERNAME/carbon-footprint-tracker.git

# 3. Install dependencies  
npm install

# 4. Start development server
npm run dev

# 5. Open http://localhost:3000 and start coding!

Contribution Process

  1. Check Issues for tasks to work on
  2. Comment on an issue to get assigned
  3. Fork the repository and create a feature branch
  4. Make your changes following our Contributing Guidelines
  5. Test thoroughly and ensure code quality
  6. Submit a Pull Request with a clear description
  7. Respond to feedback and iterate as needed

๐Ÿท๏ธ Issue Labels

  • ๐ŸŸข good first issue - Perfect for newcomers
  • ๐ŸŸก enhancement - New features and improvements
  • ๐Ÿ”ด bug - Something isn't working
  • ๐ŸŸฃ design - UI/UX improvements
  • โšช hacktoberfest - Hacktoberfest eligible

๐Ÿ“– Read our full Contributing Guide for detailed guidelines.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • COโ‚‚ emission factors based on research from various environmental organizations
  • Icons and emojis used throughout the application
  • Open source libraries and frameworks that made this project possible
  • Environmental awareness campaigns that inspired this project

๐Ÿ“ž Support

For support, feedback, or questions:

  • Create an issue in the GitHub repository
  • Contact the development team
  • Check the documentation and FAQ

Made with ๐Ÿ’š for a sustainable digital future

About

No description or website provided.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 19