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.
|
โข ๐ง AI Weekly Insights (Gemini 2.0) |
โข ๐ฏ Carbon Score Gauge (0โ100) |
โข ๐
9 Achievable Badges & Trophies |
|
โข ๐ Downloadable PDF Reports |
โข ๐จโ๐ฉโ๐งโ๐ฆ Multi-Profile Support (Family) |
Dashboard โ Carbon Score Gauge, AI Insight, Charts & Stats
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
User Input โโโบ Emission Calculator โโโบ Carbon Score
โ โ
โผ โผ
Daily Log (Supabase) โโโโโโโโโโโบ AI Engine (Gemini)
โ โ
โผ โผ
Dashboard Charts โโโโโ Real Time โโโ Insights + Recommendations
โ
โผ
Goals โข Badges โข Leaderboard โข Reports
| 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 |
| 250 kg COโ | per flight/yr |
Carbon Score: max(0, min(100, round(100 - totalEmission / 2)))
| 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 |
| 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 |
- Node.js >= 18.x
- npm >= 9.x
- Supabase Account โ for database & realtime
- Google Gemini API Key โ for AI features
# 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 devOpen http://localhost:3000 in your browser.
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| 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 |
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
| 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 |
Contributions are welcome! See CONTRIBUTING.md for the full guide.
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-idea) - Make changes and run
npm run buildto verify - Commit and push
- Open a Pull Request
Open source under the MIT License โ feel free to use, modify, and contribute.
- Next.js โ The React framework
- shadcn/ui โ Beautifully designed components
- Supabase โ Open source Firebase alternative
- Google Gemini โ AI capabilities
- Recharts โ Composable charting library
- Lucide Icons โ Beautiful icon set
- Framer Motion โ Animation library
