District-Level Oxygen Intelligence for a Greener India
Vayura is an open-source web application that estimates district-level oxygen demand across India and converts it into actionable tree-plantation and donation workflows. Built with transparency, scientific accuracy, and community contribution at its core.
- All Indian Districts: Comprehensive coverage of every district across India
- District-Level Analysis: Search any Indian district to see detailed environmental metrics
- Oxygen Calculation: Transparent scientific formulas estimate oxygen demand vs. supply
- Tree Requirements: Clear calculation of trees needed to offset oxygen deficit
- Environmental Health Card: AQI, soil quality, disaster frequency, population data
- AI-Powered Data Fetching: Uses Gemini AI to intelligently aggregate data from multiple government sources
- Tree Contribution System: Upload tree plantation photos analyzed by AI for environmental impact
- NGO Donation Hub: Donate trees through verified NGOs with transparency scores
- Contribution Dashboard: Track your personal impact (planted vs donated trees)
- Legal & Privacy: Dedicated Terms of Service and Privacy Policy for secure usage
- State Leaderboard: Rankings by oxygen self-sufficiency across Indian states
- Transparent Methodology: All formulas and assumptions clearly explained
- Next.js 16+ (App Router)
- React 19 with TypeScript
- Tailwind CSS for styling
- Recharts for data visualization
- Node.js (Next.js API Routes)
- Python FastAPI microservice for oxygen calculations (optional)
- Firebase Firestore for database
- Firebase Authentication for user management
- Firebase Storage for image uploads
- Google Gemini AI for intelligent data aggregation
- Node.js 18+ and npm
- Python 3.11+ (optional, for calculation microservice)
- Firebase Project: For authentication, database, and storage
- Google Gemini API Key: For intelligent data fetching
git clone https://github.com/manasdutta04/vayura.git
cd vayuranpm install- Create a Firebase project at Firebase Console
- Enable Authentication (Email/Password and Google providers)
- Create a Firestore Database (start in production mode)
- Create a Cloud Storage bucket
- Download service account key: Project Settings > Service Accounts > Generate New Private Key
- Save the JSON file as
firebase-service-account.jsonin the project root
Create a .env.local file in the root directory:
# Firebase Configuration
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
# Firebase Admin SDK (Server-side)
FIREBASE_ADMIN_PROJECT_ID=your_project_id
FIREBASE_ADMIN_CLIENT_EMAIL=your_service_account_email
FIREBASE_ADMIN_PRIVATE_KEY=your_private_key
# Google Gemini API
GEMINI_API_KEY=your_gemini_api_key
# OpenWeatherMap (Optional, for AQI fallback)
OPENWEATHERMAP_API_KEY=your_openweathermap_key
# Base URL
NEXT_PUBLIC_BASE_URL=http://localhost:3000-
Deploy Firestore indexes:
- Copy the index URL from
firestore.indexes.jsonerrors - Or deploy via Firebase Console
- Copy the index URL from
-
Deploy Firestore security rules:
- Copy rules from
firestore.rulesto Firebase Console > Firestore > Rules
- Copy rules from
-
Seed initial data:
npx tsx scripts/seed-districts.ts
npx tsx scripts/seed-forest-cover-data.tsnpm run devVisit http://localhost:3000 to see the application.
Vayura uses a transparent, scientifically-based formula:
Population × 550 L/day × 365 days → kg/year
- AQI Factor (1.0 - 1.75×): Higher pollution increases respiratory demand
- Soil Degradation (1.0 - 1.6×): Poor soil = less natural O₂ sources
- Disaster Loss (1.05 - 1.5×): Frequent disasters destroy vegetation
Base Demand × AQI Factor × Soil Factor × Disaster Factor
- Base: 110 kg/year per mature tree
- Adjusted by soil quality (healthier soil = healthier trees)
- Lifespan calculation: 50 years average × 110 kg/year
Oxygen Deficit ÷ Adjusted Tree Supply
All assumptions and data sources are displayed in the UI for full transparency.
Vayura uses a multi-tier data fetching approach:
- Primary: Google Gemini AI - Intelligently aggregates data from multiple government sources
- Secondary: OpenWeatherMap API - Real-time AQI data
- Fallback: Built-in government published data and statistical estimates
See DATA_SOURCES.md for complete data source documentation.
vayura/
├── src/
│ ├── app/ # Next.js pages and API routes
│ │ ├── api/ # Backend API endpoints
│ │ │ ├── districts/ # District search and details
│ │ │ ├── plant/ # Tree planting submission
│ │ │ ├── contribution/ # User contributions
│ │ │ └── leaderboard/ # State rankings
│ │ ├── dashboard/ # Main dashboard
│ │ ├── contribution/ # User contributions page
│ │ ├── leaderboard/ # Leaderboard page
│ │ └── plant/ # Plant a tree page
│ ├── components/ # React components
│ │ └── ui/ # Reusable UI components
│ ├── lib/ # Utility functions and shared code
│ │ ├── types/ # TypeScript type definitions
│ │ ├── data-sources/ # Environmental data integrations
│ │ ├── firebase.ts # Firebase client config
│ │ ├── firebase-admin.ts # Firebase Admin SDK
│ │ └── utils/ # Helper functions
│ └── middleware.ts # Next.js middleware
├── scripts/ # Database seeding scripts
├── services/
│ └── oxygen-calculator/ # Python FastAPI microservice (optional)
├── public/ # Static assets
│ ├── logo.png # Application logo
│ └── favicon/ # Favicon files
├── firestore.indexes.json # Firestore index definitions
├── firestore.rules # Firestore security rules
└── package.json
We welcome contributions! This is an open-source project and your help makes it better.
- Fork the repository on GitHub
- Clone your fork locally
- Create a branch for your feature (
git checkout -b feature/amazing-feature) - Make your changes following our coding standards
- Test thoroughly before committing
- Commit with clear messages (
git commit -m 'Add amazing feature') - Push to your fork (
git push origin feature/amazing-feature) - Open a Pull Request on GitHub
See CONTRIBUTING.md for detailed guidelines.
- Data Sources: Add more government data integrations
- Features: New functionality and improvements
- Documentation: Improve docs and add examples
- Bug Fixes: Report and fix issues
- UI/UX: Design improvements and accessibility
- Testing: Add tests and improve coverage
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2026 Manas Dutta
Important: Vayura provides educational estimates based on available data and scientific models. The oxygen calculations and environmental metrics are:
- Not medical advice: Do not use for health decisions
- Not policy guidance: Consult experts for governance decisions
- Subject to data availability: Accuracy depends on source data quality
- Estimates only: Real-world conditions vary
Always verify critical information with official sources and domain experts.
- WHO: Human oxygen consumption standards
- USDA Forest Service: Tree oxygen production research
- EPA: Air Quality Index methodology
- Government of India: Census, FSI, NDMA, CPCB data
- OpenWeatherMap: Air quality data API
- Google Gemini: AI-powered data aggregation
- The open-source community: For inspiration and support
- GitHub Repository: https://github.com/manasdutta04/vayura
- Issues: GitHub Issues
- Contributions: See CONTRIBUTING.md
Made with care for a greener India
"Every tree counts. Every breath matters."