Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CarbonMind AI Typing Animation

Next.js React TypeScript TailwindCSS Supabase Gemini Framer shadcn/ui


Track โ€ข Analyze โ€ข Reduce โ€” Your personal AI-powered sustainability companion



๐ŸŒŸ Overview

CarbonMind AI is a full-stack, AI-powered sustainability dashboard that helps individuals track their daily lifestyle habits โ€” from transportation and electricity to food, water, shopping, and flights โ€” calculate their carbon footprint, receive intelligent AI-driven recommendations, set emission targets, earn achievement badges, and compare their impact against national and global benchmarks.

Built with Next.js 16, React 19, TypeScript, Tailwind CSS v4, and powered by Google Gemini AI for intelligent insights and a conversational climate coach, with Supabase for real-time data persistence.


โœจ Features

๐Ÿค– AI & Intelligence

โ€ข ๐Ÿง  AI Weekly Insights (Gemini 2.0)
โ€ข ๐Ÿ’ฌ Climate Coach Chat Assistant
โ€ข ๐Ÿ“ˆ Carbon Score Prediction
โ€ข ๐Ÿ’ก Smart Eco Recommendations
โ€ข ๐Ÿ“Š Behaviour Analysis Engine
โ€ข ๐ŸŽฏ Personalized Sustainability Tips

๐Ÿ“Š Dashboard & Analytics

โ€ข ๐ŸŽฏ Carbon Score Gauge (0โ€“100)
โ€ข ๐Ÿ“‰ 7-Day Emission Trends (Area Chart)
โ€ข ๐Ÿฉ Donut Breakdown by Category
โ€ข ๐Ÿ“Š Category Comparison (Bar Chart)
โ€ข ๐Ÿ† Weekly Sustainability Challenges
โ€ข โšก Real-Time Stats & Live Data

๐ŸŽฎ Gamification & Goals

โ€ข ๐Ÿ… 9 Achievable Badges & Trophies
โ€ข ๐Ÿ”ฅ Daily Streak Tracking
โ€ข ๐ŸŽฏ Weekly/Monthly Emission Goals
โ€ข ๐Ÿ“ˆ Progress Bars & Visual Feedback
โ€ข ๐Ÿฅ‡ Anonymous Leaderboard (200 users)
โ€ข ๐ŸŒ Benchmark vs India & Global Averages

๐Ÿ“ Data & Export

โ€ข ๐Ÿ“„ Downloadable PDF Reports
โ€ข ๐Ÿ“ TXT Report Export
โ€ข ๐Ÿ“Š CSV Emission History Export
โ€ข ๐Ÿ“… Monthly Auto-Generated Recap
โ€ข ๐Ÿ“‹ Last 30 Days Trend Analysis
โ€ข ๐Ÿ”„ Supabase Realtime Sync

๐Ÿ› ๏ธ User Experience

โ€ข ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Multi-Profile Support (Family)
โ€ข ๐ŸŒ™ Dark/Light Theme Toggle
โ€ข ๐Ÿ“ฑ Responsive Sidebar Navigation
โ€ข ๐Ÿšซ Offline Detection Banner
โ€ข ๐Ÿ†• First-Time User Setup Modal
โ€ข โšก Loading Skeletons & Error Boundaries


๐Ÿ–ฅ๏ธ Dashboard Preview

Dashboard โ€” Carbon Score Gauge, AI Insight, Charts & Stats

Dashboard Preview


๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    CarbonMind AI                            โ”‚
โ”‚              Next.js 16 Full-Stack App                      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   Frontend   โ”‚      API Routes              โ”‚   Database    โ”‚
โ”‚  (React 19)  โ”‚   (Next.js Serverless)       โ”‚  (Supabase)   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  โ€ข Dashboard  โ”‚  POST /api/ai              โ”‚  โ€ข users       โ”‚
โ”‚  โ€ข Analysis   โ”‚  POST /api/ai-insights     โ”‚  โ€ข emission_   โ”‚
โ”‚  โ€ข Goals      โ”‚                              โ”‚    logs       โ”‚
โ”‚  โ€ข Recommend  โ”‚     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚  โ€ข chat_       โ”‚
โ”‚  โ€ข Achieve.   โ”‚     โ”‚   Google     โ”‚        โ”‚    messages   โ”‚
โ”‚  โ€ข Leaderboardโ”‚     โ”‚   Gemini     โ”‚        โ”‚  โ€ข goals       โ”‚
โ”‚  โ€ข Reports    โ”‚     โ”‚   2.0 Flash  โ”‚        โ”‚  โ€ข badges      โ”‚
โ”‚  โ€ข Settings   โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚  โ€ข ai_insights โ”‚
โ”‚  โ€ข Recap      โ”‚                              โ”‚               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                    Core Engine (src/lib/)                    โ”‚
โ”‚  emissions.ts โ”‚ badges.ts โ”‚ benchmarks.ts โ”‚ device.ts      โ”‚
โ”‚  supabase.ts  โ”‚ csvExport.ts โ”‚ weeklyChallenge.ts           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”„ Data Flow

  User Input โ”€โ”€โ–บ Emission Calculator โ”€โ”€โ–บ Carbon Score
       โ”‚                                      โ”‚
       โ–ผ                                      โ–ผ
  Daily Log (Supabase) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ AI Engine (Gemini)
       โ”‚                                      โ”‚
       โ–ผ                                      โ–ผ
  Dashboard Charts โ—„โ”€โ”€โ”€โ”€ Real Time โ—„โ”€โ”€ Insights + Recommendations
       โ”‚
       โ–ผ
  Goals โ€ข Badges โ€ข Leaderboard โ€ข Reports

๐Ÿงฎ Carbon Calculation Engine

Category Factor Unit
๐Ÿš— Car 0.21 kg COโ‚‚ per km
๐ŸšŒ Bus 0.10 kg COโ‚‚ per km
๐Ÿšฒ Bike 0.02 kg COโ‚‚ per km
โšก Electricity 0.50 kg COโ‚‚ per kWh
๐Ÿฅ— Vegetarian 10 kg COโ‚‚ per week
๐Ÿฅ˜ Mixed Diet 25 kg COโ‚‚ per week
๐Ÿฅฉ Non-Veg 45 kg COโ‚‚ per week
๐Ÿ’ง Water 0.0003 kg COโ‚‚ per litre
๐Ÿ›๏ธ Shopping 0.01 kg COโ‚‚ per โ‚น spent
โœˆ๏ธ Flights 250 kg COโ‚‚ per flight/yr

Carbon Score: max(0, min(100, round(100 - totalEmission / 2)))


๐Ÿ… Achievements & Badges

Badge Title How to Unlock
๐ŸŒŸ First Step Save your first profile
๐Ÿ”ฅ Building Momentum 3-day check-in streak
โšก Week Warrior 7-day check-in streak
๐Ÿ’ช Habit Master 30-day check-in streak
๐ŸŒฟ Eco Champion Carbon score โ‰ฅ 80
๐ŸŽฏ Goal Setter Set an active emission goal
๐Ÿ† Target Hit Stay under your weekly goal
๐Ÿฅ— Plant Powered Vegetarian diet preference
๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Family Footprint 2+ profiles on one device

โš™๏ธ Tech Stack

Tech Stack Icons

Category Technology
Framework Next.js 16 โ€” App Router, API Routes
UI Library React 19 โ€” use client components
Language TypeScript 5
Styling Tailwind CSS v4, tw-animate-css, tailwind-merge
Components shadcn/ui (Radix UI primitives)
Icons Lucide React
Charts Recharts 3 โ€” Area, Pie, Bar charts
Animations Framer Motion 12
PDF Export jsPDF 4
Database Supabase โ€” PostgreSQL + Realtime
AI / ML Google Gemini 2.0 Flash
Linting ESLint v9 + eslint-config-next
Package Mgr npm

๐Ÿš€ Getting Started

Prerequisites

  • Node.js >= 18.x
  • npm >= 9.x
  • Supabase Account โ€” for database & realtime
  • Google Gemini API Key โ€” for AI features

Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/carbonmind-ai.git

# Navigate to project
cd carbonmind-ai

# Install dependencies
npm install

# Set up environment variables
cp .env.local.example .env.local   # Then edit with your keys

# Start development server
npm run dev

Open http://localhost:3000 in your browser.

๐Ÿ” Environment Variables

Create a .env.local file in the root directory:

# Google Gemini AI (required for AI Chat & Insights)
GEMINI_API_KEY=your_gemini_api_key_here

# Supabase (required for data persistence)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

๐Ÿ“œ Available Scripts

Script Command Description
dev next dev Start development server
build next build Build for production
start next start Start production server
lint eslint Lint the codebase

๐Ÿ“ Project Structure

carbonmind-ai/
โ”œโ”€โ”€ public/                       # Static assets (logo, svg icons)
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                      # Next.js App Router
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx             # Dashboard (homepage)
โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx           # Root layout (Sidebar + Header)
โ”‚   โ”‚   โ”œโ”€โ”€ analysis/            # Carbon analysis page
โ”‚   โ”‚   โ”œโ”€โ”€ goals/               # Emission goal setting
โ”‚   โ”‚   โ”œโ”€โ”€ recommendations/     # AI recommendations
โ”‚   โ”‚   โ”œโ”€โ”€ achievements/        # Badges & trophies
โ”‚   โ”‚   โ”œโ”€โ”€ leaderboard/         # Anonymous rankings
โ”‚   โ”‚   โ”œโ”€โ”€ reports/             # Downloadable reports
โ”‚   โ”‚   โ”œโ”€โ”€ recap/               # Monthly recap
โ”‚   โ”‚   โ”œโ”€โ”€ settings/            # Profile & data editor
โ”‚   โ”‚   โ””โ”€โ”€ api/
โ”‚   โ”‚       โ”œโ”€โ”€ ai/              # Climate Coach (Gemini)
โ”‚   โ”‚       โ””โ”€โ”€ ai-insights/     # Weekly AI Insights (cached)
โ”‚   โ”œโ”€โ”€ components/              # React components
โ”‚   โ”‚   โ”œโ”€โ”€ CarbonGauge.tsx      # SVG score gauge
โ”‚   โ”‚   โ”œโ”€โ”€ EmissionChart.tsx    # Area chart (7-day)
โ”‚   โ”‚   โ”œโ”€โ”€ EmissionsDonut.tsx   # Pie chart breakdown
โ”‚   โ”‚   โ”œโ”€โ”€ CategoryComparison.tsx # Bar chart comparison
โ”‚   โ”‚   โ”œโ”€โ”€ WeeklyInsight.tsx    # AI insight display
โ”‚   โ”‚   โ”œโ”€โ”€ AIAssistant.tsx      # Chat widget
โ”‚   โ”‚   โ”œโ”€โ”€ BenchmarkComparison.tsx # India/Global benchmarks
โ”‚   โ”‚   โ”œโ”€โ”€ ... (21 components)
โ”‚   โ”œโ”€โ”€ context/                 # React context
โ”‚   โ”‚   โ”œโ”€โ”€ UserContext.tsx      # User state + profiles
โ”‚   โ”‚   โ””โ”€โ”€ ThemeContext.tsx     # Dark/light theme
โ”‚   โ”œโ”€โ”€ data/                    # Mock data (placeholder)
โ”‚   โ””โ”€โ”€ lib/                     # Utilities
โ”‚       โ”œโ”€โ”€ emissions.ts         # Core calculation engine
โ”‚       โ”œโ”€โ”€ supabase.ts          # DB client + types
โ”‚       โ”œโ”€โ”€ badges.ts            # Badge definitions
โ”‚       โ”œโ”€โ”€ useBadges.ts         # Badge evaluation hook
โ”‚       โ”œโ”€โ”€ benchmarks.ts        # Reference emission data
โ”‚       โ”œโ”€โ”€ csvExport.ts         # CSV download
โ”‚       โ”œโ”€โ”€ device.ts            # Device ID generation
โ”‚       โ”œโ”€โ”€ ToastContext.tsx     # Toast notification system
โ”‚       โ”œโ”€โ”€ weeklyChallenge.ts   # Weekly challenge logic
โ”‚       โ””โ”€โ”€ useRealtimeUser.ts   # Supabase Realtime hook
โ”œโ”€โ”€ components/ui/               # shadcn/ui primitives
โ”œโ”€โ”€ docs/                        # Documentation assets
โ”œโ”€โ”€ frontend/                    # Future standalone frontend
โ”œโ”€โ”€ backend/                     # Future FastAPI backend
โ”œโ”€โ”€ .env.local                   # Environment variables
โ”œโ”€โ”€ AGENTS.md                    # Next.js version info
โ”œโ”€โ”€ next.config.ts               # Next.js configuration
โ”œโ”€โ”€ tailwind.config.ts           # Tailwind configuration
โ””โ”€โ”€ package.json                 # Dependencies & scripts

๐Ÿ—บ๏ธ Roadmap

Status Feature
โœ… Dashboard with live analytics & charts
โœ… Carbon footprint calculator
โœ… AI-powered weekly insights (Gemini)
โœ… AI Climate Coach chat assistant
โœ… Personalized recommendations
โœ… Weekly sustainability challenges
โœ… Goal setting & progress tracking
โœ… Badge/achievement gamification
โœ… Anonymous leaderboard
โœ… Dark/light theme
โœ… Multi-profile support (family)
โœ… Offline detection
โœ… Report exports (PDF, TXT, CSV)
โœ… Monthly recap
โœ… Streak tracking
โœ… Benchmark comparison (India/Global)
๐Ÿ”„ Authentication system
๐Ÿ”„ Advanced Supabase integration
๐Ÿ”„ Google Maps route emission tracking
๐Ÿ”„ Carbon offset marketplace
๐Ÿ”„ Mobile app (React Native)
๐Ÿ”„ FastAPI Python backend
๐Ÿ”„ Social sharing & community challenges
๐Ÿ”„ Gamification leaderboards & seasons

๐Ÿ“ˆ GitHub Stats

GitHub Stats ย  GitHub Streak


๐Ÿค Contributing

Contributions are welcome! See CONTRIBUTING.md for the full guide.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-idea)
  3. Make changes and run npm run build to verify
  4. Commit and push
  5. Open a Pull Request

๐Ÿ“„ License

Open source under the MIT License โ€” feel free to use, modify, and contribute.


๐Ÿ™ Acknowledgements


๐ŸŒ Build Today. Save Tomorrow.

Made with ๐Ÿ’š by Ayush Nandi


GitHub Project


Every ton of COโ‚‚ reduced brings us closer to a sustainable future.

About

CarbonMind AI - Track your carbon footprint, get AI-powered insights, and reduce your environmental impact. Open to contributions!

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages