CarbonWise is a comprehensive web application designed to help individuals track, analyze, and reduce their carbon footprint through intelligent activity logging, goal setting, and community engagement.
- Smart Activity Logging: Easily log eco-friendly activities with automatic carbon impact calculations
- Advanced Analytics: Comprehensive dashboard with charts, trends, and insights
- Goal Setting & Tracking: Set personalized environmental goals and monitor progress
- Achievement System: Earn badges and rewards for sustainability milestones
- Streak Tracking: Maintain daily logging streaks to build sustainable habits
- Real-time carbon footprint tracking with interactive charts
- Monthly and yearly impact projections
- Category-wise emission analysis (Transportation, Energy, Food, Waste)
- Trend analysis and improvement suggestions
- Comparative benchmarking with community averages
- Weekly progress reports with actionable insights
- Achievement badges for various milestones (First Activity, Week Warrior, Eco Champion, etc.)
- Daily streak tracking with visual progress indicators
- Community challenges and competitions
- Progress sharing and social features
- Impact certificates and detailed reports
- Community challenges and leaderboards
- Impact stories and testimonials
- Carbon offset marketplace integration
- Social sharing of achievements
- Peer-to-peer motivation and support
- Secure Email Authentication: Sign up and sign in with email verification
- OTP Password Reset: Secure password reset via email-delivered OTP codes
- Profile Management: Complete user profile with preferences and settings
- Session Management: Secure session handling with automatic logout
- Row Level Security: Database-level security with Supabase RLS policies
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Dark/Light Mode: Toggle between themes for comfortable viewing
- Intuitive Navigation: Clean, modern interface with easy navigation
- Real-time Updates: Live data updates without page refreshes
- Error Handling: Comprehensive error boundaries and user feedback
- Loading States: Smooth loading indicators and skeleton screens
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Icons: Lucide React
- Charts: Recharts
- State Management: React Hooks + Context
- Database: Supabase (PostgreSQL)
- Authentication: Supabase Auth with custom OTP system
- Real-time: Supabase Realtime subscriptions
- File Storage: Supabase Storage
- API: Next.js API Routes + Server Actions
- Email: Custom OTP email system via Edge Functions
- Package Manager: npm/yarn
- Version Control: Git
- Deployment: Vercel
- Environment: Node.js 18+
- Database Scripts: Automated setup and seeding
- Node.js 18 or higher
- npm or yarn package manager
- Supabase account
-
Clone the repository ```bash git clone https://github.com/yourusername/carbonwise.git cd carbonwise ```
-
Install dependencies ```bash npm install
yarn install ```
-
Set up environment variables ```bash cp .env.example .env.local ```
Fill in your environment variables: ```env NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
EMAIL_WEBHOOK_URL=your_email_webhook_url ```
-
Set up the database
- Create a new Supabase project
- Run the SQL scripts in the
scripts/
folder in numerical order:001-create-tables.sql
- Core database tables002-seed-data.sql
- Initial data and categories003-create-functions.sql
- Database functions004-fix-auth-trigger.sql
- Authentication triggers005-enhanced-schema.sql
- Enhanced features006-update-functions.sql
- Function updates007-fix-database-issues.sql
- Bug fixes008-fix-ambiguous-column.sql
- Column fixes009-final-fix-ambiguous-column.sql
- Final column fixes010-fix-streak-calculation.sql
- Streak calculation fixes
-
Configure authentication
- Enable email authentication in Supabase
- Set up custom email templates (optional)
- Configure redirect URLs for your domain
-
Run the development server ```bash npm run dev
yarn dev ```
-
Open your browser Navigate to http://localhost:3000
``` carbonwise/ βββ app/ # Next.js app directory β βββ auth/ # Authentication pages β β βββ signin/ # Sign in page β β βββ signup/ # Sign up page β β βββ forgot-password/ # Password reset β β βββ otp-info/ # OTP information β βββ dashboard/ # Dashboard pages β βββ features/ # Feature pages β βββ about/ # About page β βββ contact/ # Contact page β βββ how-it-works/ # How it works page β βββ actions/ # Server actions β βββ globals.css # Global styles βββ components/ # React components β βββ ui/ # shadcn/ui components β βββ dashboard/ # Dashboard-specific components β βββ homepage/ # Homepage components β βββ auth-form.tsx # Authentication forms βββ hooks/ # Custom React hooks β βββ use-auth.tsx # Authentication hook βββ lib/ # Utility functions β βββ utils.ts # General utilities β βββ supabase.ts # Supabase client βββ scripts/ # Database scripts β βββ 001-create-tables.sql β βββ 002-seed-data.sql β βββ ... # Additional migration scripts βββ supabase/ # Supabase configuration β βββ functions/ # Edge functions βββ public/ # Static assets ```
The application uses Supabase as the backend. Run the SQL scripts in order:
-
Core Tables (
001-create-tables.sql
)- Users, activities, categories, goals, badges, streaks
-
Initial Data (
002-seed-data.sql
)- Activity categories, badge definitions, sample data
-
Database Functions (
003-create-functions.sql
)- Carbon calculation functions, streak tracking, badge awarding
-
Authentication (
004-fix-auth-trigger.sql
)- User profile creation triggers, RLS policies
-
Enhanced Features (
005-enhanced-schema.sql
)- Advanced analytics, community features, reporting
-
Updates & Fixes (
006-010-*.sql
)- Bug fixes, performance improvements, schema updates
Required environment variables:
NEXT_PUBLIC_SUPABASE_URL
- Your Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY
- Supabase anonymous keySUPABASE_SERVICE_ROLE_KEY
- Supabase service role key
Optional environment variables:
EMAIL_WEBHOOK_URL
- Custom email webhook for OTP delivery
- Enable Email Auth in Supabase dashboard
- Configure Site URL to your domain
- Set up Redirect URLs for authentication flows
- Deploy Edge Function for custom OTP email delivery (optional)
CarbonWise features a modern, clean design with:
- Responsive Layout: Optimized for all device sizes
- Accessible Components: Following WCAG guidelines
- Consistent Design System: Green accent colors with professional styling
- Intuitive Navigation: Clear user flows and navigation patterns
- Data Visualization: Interactive charts and progress indicators
- Loading States: Smooth transitions and skeleton screens
- Error Handling: User-friendly error messages and recovery options
- Quick Entry: Fast activity logging with smart categorization
- Smart Suggestions: AI-powered activity recommendations
- Photo Attachments: Visual documentation of activities
- Bulk Import: CSV import for historical data
- Automatic Calculations: Real-time carbon impact calculations
- Category Management: Customizable activity categories
- Real-time Tracking: Live carbon footprint monitoring
- Interactive Charts: Recharts-powered data visualizations
- Trend Analysis: Monthly and yearly progress tracking
- Category Breakdown: Detailed emission analysis by category
- Benchmarking: Compare with community averages
- Export Functionality: PDF and CSV report generation
- SMART Goals: Specific, measurable, achievable goal setting
- Progress Tracking: Visual progress indicators and milestones
- Deadline Management: Automated reminders and notifications
- Achievement System: Unlock badges and rewards
- Goal Sharing: Community goal sharing and motivation
- Custom Targets: Personalized carbon reduction targets
- Email Verification: Secure email-based registration
- OTP Password Reset: Email-delivered one-time passwords
- Session Management: Secure session handling
- Profile Management: Complete user profile customization
- Security Features: Rate limiting, secure password requirements
- Leaderboards: Community rankings and challenges
- Impact Stories: Share and discover success stories
- Social Sharing: Share achievements on social media
- Group Challenges: Organize team-based sustainability challenges
- Peer Support: Community motivation and support system
We welcome contributions to CarbonWise! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- User authentication with email verification
- OTP-based password reset system
- Activity logging with carbon calculations
- Interactive analytics dashboard
- Goal setting and progress tracking
- Achievement badge system
- Daily streak tracking
- Community features and leaderboards
- Responsive design for all devices
- Real-time data updates