Unlock the Value of Your Green Initiatives
Carbon Coin is a comprehensive web application that helps users quantify, track, and report their carbon savings from agricultural and technological interventions. The platform turns sustainability efforts into measurable impact and generates professional reports for carbon credit markets.
- User Authentication: Secure login with email/password and Google OAuth
- AgriCarbon Wizard: Guided data entry for land use, soil type, and farming practices
- Interventions Tracking: Log sustainable interventions with type-specific calculators
- Interactive Dashboard: Visualize total COโe savings with detailed breakdowns
- Report Generation: Download professional PDF reports with impact metrics
- Client-side Encryption: All location data encrypted before transmission
- AES-CBC Algorithm: Industry-standard encryption for sensitive data
- Duplicate Detection: Prevents duplicate locations without revealing coordinates
- Key Rotation Support: Future-proof architecture for security updates
- AgriPV Calculator: Solar, agroforestry, drip irrigation, biogas, and EV savings
- SOC Calculator: Soil organic carbon sequestration calculations
- AgriCarbon Plots: Plot-based carbon tracking with land use classification
- AgriPV Feasibility: Technical assessment for solar implementation
- Frontend: Next.js 15, React 18, TypeScript
- Styling: Tailwind CSS, Radix UI components
- Backend: Firebase (Auth, Realtime Database)
- Encryption: Web Crypto API (AES-CBC)
- Maps: Leaflet.js with geolocation
- PDF Generation: jsPDF with html2canvas
- AI Integration: Genkit AI with Google Gemini
- Node.js 18+
- npm or yarn
- Firebase project setup
-
Clone the repository
git clone <repository-url> cd Carbon-Coin
-
Install dependencies
npm install
-
Set up environment variables
# Copy the example environment file cp .env.example .env.local # Add your Firebase configuration NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id NEXT_PUBLIC_FIREBASE_DATABASE_URL=your_database_url
-
Generate encryption key
npm run generate-key
Add the generated key to your
.env.local:NEXT_PUBLIC_CRYPTO_SECRET_KEY=your_generated_key
-
Start development server
npm run dev
-
Open your browser Navigate to
http://localhost:9002
Carbon Coin includes a robust client-side encryption system for protecting sensitive location data. See Encryption Setup Guide for detailed instructions.
# Generate encryption key
npm run generate-key
# Add to .env.local
NEXT_PUBLIC_CRYPTO_SECRET_KEY=your_generated_key
# Restart development server
npm run devsrc/
โโโ app/ # Next.js App Router pages
โ โโโ (main)/ # Main application routes
โ โโโ login/ # Authentication pages
โ โโโ learn-more/ # Educational content
โโโ components/ # Reusable UI components
โ โโโ ui/ # Radix UI components
โ โโโ sdg-icons/ # SDG icon management
โโโ hooks/ # Custom React hooks
โโโ lib/ # Utility libraries
โ โโโ crypto.ts # Encryption utilities
โ โโโ firebase.ts # Firebase configuration
โ โโโ utils.ts # General utilities
โโโ types/ # TypeScript definitions
โโโ ai/ # AI integration files
{
"users/{uid}": {
"name": "User Name",
"phone": "Phone Number",
"email": "user@example.com",
"projectDetails": {
"projectName": "Green Pastures Farm",
"location": "Anytown, State",
"encryptedLocation": "base64_encrypted_data",
"locationIV": "base64_iv",
"keyVersion": "v1"
},
"calculations": {
"solarCarbon": {
"results": {
"solar": 82.0,
"agro": 70.0,
"drip": 49.2,
"bio": 0.9,
"ev": 1.8,
"total": 203.9
}
}
},
"agriCarbonPlots": {
"plot1": {
"plotId": "PLOT001",
"co2e": 45.2
}
}
}
}{
"locations/{hash}": {
"userId": "user_uid",
"timestamp": 1703123456789,
"projectName": "Green Pastures Farm"
}
}- Generate encryption key:
npm run generate-key - Add key to
.env.local - Start development server:
npm run dev - Test user registration and login
- Test location selection and encryption
- Test duplicate location detection
- Test report generation
// Import test function
import { testEncryptionSystem } from '@/lib/crypto.test';
// Run tests in browser console
testEncryptionSystem().then(success => {
console.log('Encryption tests:', success ? 'PASSED' : 'FAILED');
});-
Generate production encryption key
npm run generate-key
-
Set environment variables in your hosting platform
- All Firebase configuration
NEXT_PUBLIC_CRYPTO_SECRET_KEY
-
Build and deploy
npm run build npm start
- HTTPS enabled in production
- Environment variables secured
- Encryption key rotated periodically
- Firebase security rules configured
-
.envfiles in.gitignore
- Solar:
MWh ร 0.82 = tCOโe/year - Agroforestry:
Area (ha) ร 7 = tCOโe/year - Drip Irrigation:
(Area ร 1200) / 1000 ร 0.82 = tCOโe/year - Biogas:
(Volume ร 1.8) / 1000 = tCOโe/year - EV Savings:
Distance (km/year) ร 0.12 = tCOโe/year
- SOC Sequestration:
ฮSOC ร Bulk Density ร Depth ร Area ร Soil Factor ร 3.67 = tCOโe
- Primary: Forest green (#38A3A5)
- Background: Light beige (#F5F5DC)
- Accent: Terracotta (#E07A5F)
- Headlines: Belleza sans-serif
- Body: Alegreya serif
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Check the documentation
- Review encryption setup
- Check browser console for errors
- Contact the development team
- Mobile app support
- Advanced key rotation
- Audit trail logging
- Enhanced AI features
- Carbon credit marketplace integration
- Real-time collaboration features
Carbon Coin - Making sustainability measurable and profitable ๐ฑ