# Project export: TerraIntelligence

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 12.0
- Tagline: We built an autonomous drone that collects data to chemically mapping the world. It collects data like temperature, humidity, pH, uses ML to analyze it, and provides farmers data-driven insights.
- Devpost: https://devpost.com/software/terraintelligence
- GitHub: https://github.com/RadonUmar/TerraIntelligence
- Video: https://www.youtube.com/embed/PZtfdUXTspM?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 0 GitHub contributor(s) — 

## Devpost submission (written by the team)

### Inspiration

Agriculture is one of the most data-rich yet data-scarce industries. A majority of farmers rely on intuition rather than data when making decisions about when, what, and how to farm. We wanted to build a system that brings real-time environmental intelligence to the field. The idea sprouted from how drones can capture so much stunning visual data, but weren't really used to collect other sensor data that are vital to driving decisions about agriculture.

### What it does

TerraIntelligence is an AI-powered drone and IoT network for precision agriculture. It collects real-time environmental and geospatial data — including temperature, humidity, soil pH, water level, altitude, and distance — through onboard and ground sensors. That data is automatically streamed to a Firebase Realtime Database, visualized on a web dashboard, and used to map crop health trends or irrigation needs. The system can: Capture and tag images with precise location metadata (lat, lon, altitude) Stream live sensor readings to a web interface in real time Build a historical log of conditions across multiple zones Help identify patterns for water optimization, soil balance, or early signs of crop stress

### How we built it

On the hardware layer, we used an ESP32 microcontroller connected to a DHT11 temperature-humidity sensor and ultrasonic water level module. The board connects to WiFi and pushes JSON-formatted data directly to Firebase RTDB. Additionally, we used a motor to launch and bring back up the payload (the ESP32 + sensor module) whenever it needed to collect data from a probing site. From there, the data is fetched by ML models designed to extract meaningful insights from the source data points. We used the NASA API and conducted literature review to decipher how this data can be used and why it’s meaningful for farmers. From there, we built a web dashboard that doesn’t just visualize data — it lets farmers actually interact with it. The dashboard fetches data from Firebase in real time, displaying it through live-updating charts and a leaflet.js map showing sensor locations and environmental readings. But we wanted to go beyond numbers and graphs, so we integrated AI-driven interaction. Farmers can: Download all their field data as CSV files for offline use or research. Talk to the dashboard directly using a VAPI voice agent, which allows natural, hands-free interaction: perfect for use out in the field. Ask questions about their data, powered by Claude, such as “Which area had the lowest moisture this week?” or “Show me pH trends for Zone 3.” The AI parses Firebase data and generates insightful, contextual responses on the spot.

### Challenges we ran into

One of the biggest challenges was getting all of these different endpoints to work: we had data coming in from multiple sensors that had to be sent to the database, then analyzed by various ML models looking for various different signals, and finally sent to the frontend for users to interact with. We solved this through breaking down each component, and integrating together once each module worked as it needed to. Another major engineering problem was balancing the payload and ensuring that the drone would be able to support

### Accomplishments we're proud of

We're proud of building the probe dropping mechanism on the drone, and all the data that it was able to collect. We also really liked how we were able to visualize and use multiple ML models to extract so much powerful data.

### What's next

Getting farmers to actually use this. We have the mechanics, we have the software, we just need to find the people who need this.

## README (from the GitHub repository)

# TerraIntelligence Marketplace

A unified marketplace platform hosting multiple AI-powered geospatial analysis applications.

## Project Structure

```
TerraIntelligence/
├── terra-intelligence-landing/  # Main landing page (Port 3000)
├── drone-sensor-dashboard-farm/  # AgriVision - Farm monitoring (Port 3001)
├── drone-sensor-dashboard-fire/  # HydroSense AI - Fire monitoring (Port 3002)
└── start-all.sh                  # Script to run all apps
```

## Getting Started

### Prerequisites

- Node.js 18+ installed
- npm or yarn package manager

### Installation

1. Install dependencies for all projects:

```bash
# Install landing page dependencies
cd terra-intelligence-landing
npm install

# Install farm dashboard dependencies
cd ../drone-sensor-dashboard-farm
npm install

# Install fire dashboard dependencies
cd ../drone-sensor-dashboard-fire
npm install
```

### Running the Application

#### Option 1: Run all apps at once (Recommended)

From the root directory (`TerraIntelligence/`):

```bash
chmod +x start-all.sh
./start-all.sh
```

This will start:
- Landing page at http://localhost:3000
- Farm dashboard at http://localhost:3001
- Fire dashboard at http://localhost:3002

Press `Ctrl+C` to stop all servers.

#### Option 2: Run apps individually

Open three terminal windows:

**Terminal 1 - Landing Page:**
```bash
cd terra-intelligence-landing
npm run dev
```

**Terminal 2 - Farm Dashboard:**
```bash
cd drone-sensor-dashboard-farm
npm run dev
```

**Terminal 3 - Fire Dashboard:**
```bash
cd drone-sensor-dashboard-fire
npm run dev
```

## Available Applications

### TerraChem AI
**Status:** Coming Soon
Soil chemistry and nutrient analysis

### AgriVision
**Status:** Available
**Link:** http://localhost:3000/farm
Crop and vegetation health monitoring

### HydroSense AI
**Status:** Available
**Link:** http://localhost:3000/fire
Water distribution and flow analysis

## Development

- The landing page uses Next.js rewrites to proxy requests to the farm and fire dashboards
- Each application runs on its own port but can be accessed through the main landing page
- The landing page provides a unified interface to access all tools

## Technologies Used

- Next.js 16
- React 18
- TypeScript
- Tailwind CSS
- Lucide React (icons)


## Detected evidence (automated analysis)

Indexed codebase: 341 recognized source files, 1183 KB.
- Anthropic (technology) — detected in the code
- CSS (language) — detected in the code
- Firebase (technology) — detected in the code
- JavaScript (language) — detected in the code
- Next.js (technology) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- AI coding agent: Claude Code — evidence: commit authorship or trailers

## Codebase structure (from repository index)

### Files (120 of 374)

```
.DS_Store
.gitignore
drone-sensor-dashboard-farm/.env.local.example
drone-sensor-dashboard-farm/.gitignore
drone-sensor-dashboard-farm/app/actions/claude.ts
drone-sensor-dashboard-farm/app/actions/mapbox.ts
drone-sensor-dashboard-farm/app/actions/recommendations.ts
drone-sensor-dashboard-farm/app/globals.css
drone-sensor-dashboard-farm/app/layout.tsx
drone-sensor-dashboard-farm/app/page.tsx
drone-sensor-dashboard-farm/app/upload-data/page.tsx
drone-sensor-dashboard-farm/components.json
drone-sensor-dashboard-farm/components/ai-panel.tsx
drone-sensor-dashboard-farm/components/map-view.tsx
drone-sensor-dashboard-farm/components/metrics-filter.tsx
drone-sensor-dashboard-farm/components/popup-card.tsx
drone-sensor-dashboard-farm/components/theme-provider.tsx
drone-sensor-dashboard-farm/components/ui/accordion.tsx
drone-sensor-dashboard-farm/components/ui/alert-dialog.tsx
drone-sensor-dashboard-farm/components/ui/alert.tsx
drone-sensor-dashboard-farm/components/ui/aspect-ratio.tsx
drone-sensor-dashboard-farm/components/ui/avatar.tsx
drone-sensor-dashboard-farm/components/ui/badge.tsx
drone-sensor-dashboard-farm/components/ui/breadcrumb.tsx
drone-sensor-dashboard-farm/components/ui/button-group.tsx
drone-sensor-dashboard-farm/components/ui/button.tsx
drone-sensor-dashboard-farm/components/ui/calendar.tsx
drone-sensor-dashboard-farm/components/ui/card.tsx
drone-sensor-dashboard-farm/components/ui/carousel.tsx
drone-sensor-dashboard-farm/components/ui/chart.tsx
drone-sensor-dashboard-farm/components/ui/checkbox.tsx
drone-sensor-dashboard-farm/components/ui/collapsible.tsx
drone-sensor-dashboard-farm/components/ui/command.tsx
drone-sensor-dashboard-farm/components/ui/context-menu.tsx
drone-sensor-dashboard-farm/components/ui/dialog.tsx
drone-sensor-dashboard-farm/components/ui/drawer.tsx
drone-sensor-dashboard-farm/components/ui/dropdown-menu.tsx
drone-sensor-dashboard-farm/components/ui/empty.tsx
drone-sensor-dashboard-farm/components/ui/field.tsx
drone-sensor-dashboard-farm/components/ui/form.tsx
drone-sensor-dashboard-farm/components/ui/hover-card.tsx
drone-sensor-dashboard-farm/components/ui/input-group.tsx
drone-sensor-dashboard-farm/components/ui/input-otp.tsx
drone-sensor-dashboard-farm/components/ui/input.tsx
drone-sensor-dashboard-farm/components/ui/item.tsx
drone-sensor-dashboard-farm/components/ui/kbd.tsx
drone-sensor-dashboard-farm/components/ui/label.tsx
drone-sensor-dashboard-farm/components/ui/menubar.tsx
drone-sensor-dashboard-farm/components/ui/navigation-menu.tsx
drone-sensor-dashboard-farm/components/ui/pagination.tsx
drone-sensor-dashboard-farm/components/ui/popover.tsx
drone-sensor-dashboard-farm/components/ui/progress.tsx
drone-sensor-dashboard-farm/components/ui/radio-group.tsx
drone-sensor-dashboard-farm/components/ui/resizable.tsx
drone-sensor-dashboard-farm/components/ui/scroll-area.tsx
drone-sensor-dashboard-farm/components/ui/select.tsx
drone-sensor-dashboard-farm/components/ui/separator.tsx
drone-sensor-dashboard-farm/components/ui/sheet.tsx
drone-sensor-dashboard-farm/components/ui/sidebar.tsx
drone-sensor-dashboard-farm/components/ui/skeleton.tsx
drone-sensor-dashboard-farm/components/ui/slider.tsx
drone-sensor-dashboard-farm/components/ui/sonner.tsx
drone-sensor-dashboard-farm/components/ui/spinner.tsx
drone-sensor-dashboard-farm/components/ui/switch.tsx
drone-sensor-dashboard-farm/components/ui/table.tsx
drone-sensor-dashboard-farm/components/ui/tabs.tsx
drone-sensor-dashboard-farm/components/ui/textarea.tsx
drone-sensor-dashboard-farm/components/ui/toast.tsx
drone-sensor-dashboard-farm/components/ui/toaster.tsx
drone-sensor-dashboard-farm/components/ui/toggle-group.tsx
drone-sensor-dashboard-farm/components/ui/toggle.tsx
drone-sensor-dashboard-farm/components/ui/tooltip.tsx
drone-sensor-dashboard-farm/components/ui/use-mobile.tsx
drone-sensor-dashboard-farm/components/ui/use-toast.ts
drone-sensor-dashboard-farm/components/voice-interface.tsx
drone-sensor-dashboard-farm/data/nodes.json
drone-sensor-dashboard-farm/FIREBASE_SETUP.md
drone-sensor-dashboard-farm/hooks/use-mobile.ts
drone-sensor-dashboard-farm/hooks/use-toast.ts
drone-sensor-dashboard-farm/lib/firebase-service.ts
drone-sensor-dashboard-farm/lib/firebase.ts
drone-sensor-dashboard-farm/lib/types.ts
drone-sensor-dashboard-farm/lib/utils.ts
drone-sensor-dashboard-farm/next.config.mjs
drone-sensor-dashboard-farm/package.json
drone-sensor-dashboard-farm/postcss.config.mjs
drone-sensor-dashboard-farm/QUICKSTART.md
drone-sensor-dashboard-farm/RECOMMENDATIONS_FEATURE.md
drone-sensor-dashboard-farm/scripts/migrate-to-firebase.ts
drone-sensor-dashboard-farm/scripts/test-claude.ts
drone-sensor-dashboard-farm/scripts/test-firebase.ts
drone-sensor-dashboard-farm/scripts/test-recommendations.ts
drone-sensor-dashboard-farm/scripts/upload-all-data.ts
drone-sensor-dashboard-farm/styles/globals.css
drone-sensor-dashboard-farm/tsconfig.json
drone-sensor-dashboard-farm/VAPI_INTEGRATION_PLAN.md
drone-sensor-dashboard-farm/VAPI_SETUP.md
drone-sensor-dashboard-fire/.env.local.example
drone-sensor-dashboard-fire/.gitignore
drone-sensor-dashboard-fire/app/actions/claude.ts
drone-sensor-dashboard-fire/app/actions/mapbox.ts
drone-sensor-dashboard-fire/app/actions/recommendations.ts
drone-sensor-dashboard-fire/app/globals.css
drone-sensor-dashboard-fire/app/layout.tsx
drone-sensor-dashboard-fire/app/page.tsx
drone-sensor-dashboard-fire/components.json
drone-sensor-dashboard-fire/components/ai-panel.tsx
drone-sensor-dashboard-fire/components/map-view.tsx
drone-sensor-dashboard-fire/components/metrics-filter.tsx
drone-sensor-dashboard-fire/components/popup-card.tsx
drone-sensor-dashboard-fire/components/theme-provider.tsx
drone-sensor-dashboard-fire/components/ui/accordion.tsx
drone-sensor-dashboard-fire/components/ui/alert-dialog.tsx
drone-sensor-dashboard-fire/components/ui/alert.tsx
drone-sensor-dashboard-fire/components/ui/aspect-ratio.tsx
drone-sensor-dashboard-fire/components/ui/avatar.tsx
drone-sensor-dashboard-fire/components/ui/badge.tsx
drone-sensor-dashboard-fire/components/ui/breadcrumb.tsx
drone-sensor-dashboard-fire/components/ui/button-group.tsx
drone-sensor-dashboard-fire/components/ui/button.tsx
[254 more files omitted for size]
```

### Dependencies

- drone-sensor-dashboard-farm/package.json: @anthropic-ai/sdk@^0.67.0, @emotion/is-prop-valid@latest, @hookform/resolvers@^3.10.0, @mapbox/mapbox-gl-draw@latest, @radix-ui/react-accordion@1.2.2, @radix-ui/react-alert-dialog@1.1.4, @radix-ui/react-aspect-ratio@1.1.1, @radix-ui/react-avatar@1.1.2, @radix-ui/react-checkbox@1.1.3, @radix-ui/react-collapsible@1.1.2, @radix-ui/react-context-menu@2.2.4, @radix-ui/react-dialog@1.1.4, @radix-ui/react-dropdown-menu@2.1.4, @radix-ui/react-hover-card@1.1.4, @radix-ui/react-label@2.1.1, @radix-ui/react-menubar@1.1.4, @radix-ui/react-navigation-menu@1.2.3, @radix-ui/react-popover@1.1.4, @radix-ui/react-progress@1.1.1, @radix-ui/react-radio-group@1.2.2, @radix-ui/react-scroll-area@latest, @radix-ui/react-select@2.1.4, @radix-ui/react-separator@1.1.1, @radix-ui/react-slider@1.2.2, @radix-ui/react-slot@1.1.1, @radix-ui/react-switch@1.1.2, @radix-ui/react-tabs@1.1.2, @radix-ui/react-toast@1.2.4, @radix-ui/react-toggle@1.1.1, @radix-ui/react-toggle-group@1.1.1, @radix-ui/react-tooltip@1.1.6, @tailwindcss/postcss@^4.1.9, @types/mapbox__mapbox-gl-draw@^1.4.9, @types/node@^22, @types/react@^19, @types/react-dom@^19, @vapi-ai/web@^2.5.0, @vercel/analytics@latest, autoprefixer@^10.4.20, class-variance-authority@^0.7.1, clsx@^2.1.1, cmdk@1.0.4, date-fns@4.1.0, dotenv@^17.2.3, embla-carousel-react@8.5.1, firebase@^12.4.0, framer-motion@latest, input-otp@1.4.1, lucide-react@^0.454.0, mapbox-gl@latest, next@16.0.0, next-themes@^0.4.6, postcss@^8.5, react@^18.3.1, react-day-picker@9.8.0, react-dom@^18.3.1, react-hook-form@^7.60.0, react-resizable-panels@^2.1.7, recharts@2.15.4, sonner@^1.7.4, tailwind-merge@^2.5.5, tailwindcss@^4.1.9, tailwindcss-animate@^1.0.7, tsx@^4.20.6, tw-animate-css@1.3.3, typescript@^5, vaul@^0.9.9, zod@3.25.76
- drone-sensor-dashboard-fire/package.json: @anthropic-ai/sdk@^0.67.0, @emotion/is-prop-valid@latest, @hookform/resolvers@^3.10.0, @mapbox/mapbox-gl-draw@latest, @radix-ui/react-accordion@1.2.2, @radix-ui/react-alert-dialog@1.1.4, @radix-ui/react-aspect-ratio@1.1.1, @radix-ui/react-avatar@1.1.2, @radix-ui/react-checkbox@1.1.3, @radix-ui/react-collapsible@1.1.2, @radix-ui/react-context-menu@2.2.4, @radix-ui/react-dialog@1.1.4, @radix-ui/react-dropdown-menu@2.1.4, @radix-ui/react-hover-card@1.1.4, @radix-ui/react-label@2.1.1, @radix-ui/react-menubar@1.1.4, @radix-ui/react-navigation-menu@1.2.3, @radix-ui/react-popover@1.1.4, @radix-ui/react-progress@1.1.1, @radix-ui/react-radio-group@1.2.2, @radix-ui/react-scroll-area@latest, @radix-ui/react-select@2.1.4, @radix-ui/react-separator@1.1.1, @radix-ui/react-slider@1.2.2, @radix-ui/react-slot@1.1.1, @radix-ui/react-switch@1.1.2, @radix-ui/react-tabs@1.1.2, @radix-ui/react-toast@1.2.4, @radix-ui/react-toggle@1.1.1, @radix-ui/react-toggle-group@1.1.1, @radix-ui/react-tooltip@1.1.6, @tailwindcss/postcss@^4.1.9, @types/mapbox__mapbox-gl-draw@^1.4.9, @types/node@^22, @types/react@^19, @types/react-dom@^19, @vapi-ai/web@^2.5.0, @vercel/analytics@latest, autoprefixer@^10.4.20, class-variance-authority@^0.7.1, clsx@^2.1.1, cmdk@1.0.4, date-fns@4.1.0, dotenv@^17.2.3, embla-carousel-react@8.5.1, firebase@^12.4.0, framer-motion@latest, input-otp@1.4.1, lucide-react@^0.454.0, mapbox-gl@latest, next@16.0.0, next-themes@^0.4.6, postcss@^8.5, react@^18.3.1, react-day-picker@9.8.0, react-dom@^18.3.1, react-hook-form@^7.60.0, react-resizable-panels@^2.1.7, recharts@2.15.4, sonner@^1.7.4, tailwind-merge@^2.5.5, tailwindcss@^4.1.9, tailwindcss-animate@^1.0.7, tsx@^4.20.6, tw-animate-css@1.3.3, typescript@^5, vaul@^0.9.9, zod@3.25.76
- drone-sensor-dashboard-water/package.json: @anthropic-ai/sdk@^0.67.0, @emotion/is-prop-valid@latest, @hookform/resolvers@^3.10.0, @mapbox/mapbox-gl-draw@latest, @radix-ui/react-accordion@1.2.2, @radix-ui/react-alert-dialog@1.1.4, @radix-ui/react-aspect-ratio@1.1.1, @radix-ui/react-avatar@1.1.2, @radix-ui/react-checkbox@1.1.3, @radix-ui/react-collapsible@1.1.2, @radix-ui/react-context-menu@2.2.4, @radix-ui/react-dialog@1.1.4, @radix-ui/react-dropdown-menu@2.1.4, @radix-ui/react-hover-card@1.1.4, @radix-ui/react-label@2.1.1, @radix-ui/react-menubar@1.1.4, @radix-ui/react-navigation-menu@1.2.3, @radix-ui/react-popover@1.1.4, @radix-ui/react-progress@1.1.1, @radix-ui/react-radio-group@1.2.2, @radix-ui/react-scroll-area@latest, @radix-ui/react-select@2.1.4, @radix-ui/react-separator@1.1.1, @radix-ui/react-slider@1.2.2, @radix-ui/react-slot@1.1.1, @radix-ui/react-switch@1.1.2, @radix-ui/react-tabs@1.1.2, @radix-ui/react-toast@1.2.4, @radix-ui/react-toggle@1.1.1, @radix-ui/react-toggle-group@1.1.1, @radix-ui/react-tooltip@1.1.6, @tailwindcss/postcss@^4.1.9, @types/mapbox__mapbox-gl-draw@^1.4.9, @types/node@^22, @types/react@^19, @types/react-dom@^19, @vapi-ai/web@^2.5.0, @vercel/analytics@latest, autoprefixer@^10.4.20, class-variance-authority@^0.7.1, clsx@^2.1.1, cmdk@1.0.4, date-fns@4.1.0, dotenv@^17.2.3, embla-carousel-react@8.5.1, firebase@^12.4.0, framer-motion@latest, input-otp@1.4.1, lucide-react@^0.454.0, mapbox-gl@latest, next@16.0.0, next-themes@^0.4.6, postcss@^8.5, react@^18.3.1, react-day-picker@9.8.0, react-dom@^18.3.1, react-hook-form@^7.60.0, react-resizable-panels@^2.1.7, recharts@2.15.4, sonner@^1.7.4, tailwind-merge@^2.5.5, tailwindcss@^4.1.9, tailwindcss-animate@^1.0.7, tsx@^4.20.6, tw-animate-css@1.3.3, typescript@^5, vaul@^0.9.9, zod@3.25.76
- package.json: firebase-admin@^13.5.0
- terra-intelligence-landing/package.json: @radix-ui/react-slot@^1.2.3, @tailwindcss/postcss@^4.1.9, @types/node@^22, @types/react@^19, @types/react-dom@^19, class-variance-authority@^0.7.1, clsx@^2.1.1, lucide-react@^0.454.0, next@16.0.0, postcss@^8.5, react@^18.3.1, react-dom@^18.3.1, tailwind-merge@^3.3.1, tailwindcss@^4.1.9, typescript@^5
- terraintelligence-landing-main/package.json: @hookform/resolvers@^3.10.0, @radix-ui/react-accordion@1.2.2, @radix-ui/react-alert-dialog@1.1.4, @radix-ui/react-aspect-ratio@1.1.1, @radix-ui/react-avatar@1.1.2, @radix-ui/react-checkbox@1.1.3, @radix-ui/react-collapsible@1.1.2, @radix-ui/react-context-menu@2.2.4, @radix-ui/react-dialog@1.1.4, @radix-ui/react-dropdown-menu@2.1.4, @radix-ui/react-hover-card@1.1.4, @radix-ui/react-label@2.1.1, @radix-ui/react-menubar@1.1.4, @radix-ui/react-navigation-menu@1.2.3, @radix-ui/react-popover@1.1.4, @radix-ui/react-progress@1.1.1, @radix-ui/react-radio-group@1.2.2, @radix-ui/react-scroll-area@1.2.2, @radix-ui/react-select@2.1.4, @radix-ui/react-separator@1.1.1, @radix-ui/react-slider@1.2.2, @radix-ui/react-slot@1.1.1, @radix-ui/react-switch@1.1.2, @radix-ui/react-tabs@1.1.2, @radix-ui/react-toast@1.2.4, @radix-ui/react-toggle@1.1.1, @radix-ui/react-toggle-group@1.1.1, @radix-ui/react-tooltip@1.1.6, @tailwindcss/postcss@^4.1.9, @types/node@^22, @types/react@^19, @types/react-dom@^19, @vercel/analytics@latest, autoprefixer@^10.4.20, class-variance-authority@^0.7.1, clsx@^2.1.1, cmdk@1.0.4, date-fns@4.1.0, embla-carousel-react@8.5.1, input-otp@1.4.1, lucide-react@^0.454.0, next@16.0.0, next-themes@^0.4.6, postcss@^8.5, react@19.2.0, react-day-picker@9.8.0, react-dom@19.2.0, react-hook-form@^7.60.0, react-resizable-panels@^2.1.7, recharts@2.15.4, sonner@^1.7.4, tailwind-merge@^2.5.5, tailwindcss@^4.1.9, tailwindcss-animate@^1.0.7, tw-animate-css@1.3.3, typescript@^5, vaul@^0.9.9, zod@3.25.76

### Recent commits (newest first)

- Initial commit: TerraIntelligence project setup

## Key source files (fetched from GitHub, selected and truncated for size)

### generate-sensor-data-instructions.md

```markdown
# Sensor Data Generation Guide

I've created a comprehensive data generation system for your three dashboards. Here's what's been set up:

## 📍 Location Summary

### 💧 Water Quality Sensors (12 locations)
**San Francisco Bay Area water bodies:**
- **Golden Gate Bridge area** (3 sensors): North, South, and West positions
- **Ocean Beach** (3 sensors): North, Central, and South along the coast
- **SF Bay** (2 sensors): Central and East bay locations
- **Lake Merced** (2 sensors): North and South (freshwater)
- **Aquatic Park** (1 sensor): Near Fisherman's Wharf
- **China Beach** (1 sensor): Between Seacliff and Lands End

### 🌾 Agricultural Sensors (12 locations)
**Famous farming regions across the US:**
- **Salinas Valley, CA** (3 sensors): The "Salad Bowl of the World"
- **Iowa** (2 sensors): Corn capital
- **Napa Valley, CA** (2 sensors): Wine country vineyards
- **Central Valley, CA** (2 sensors): Fruits and nuts
- **Willamette Valley, OR** (2 sensors): Berry farms
- **Yakima Valley, WA** (1 sensor): Apple orchards

### 🔥 Wildfire Monitoring Sensors (12 locations)
**High-risk forest areas in California:**
- **Angeles National Forest** (3 sensors): Near Los Angeles
- **San Bernardino National Forest** (2 sensors): East of LA
- **Cleveland National Forest** (2 sensors): San Diego area
- **Lake Tahoe/Sierra Nevada** (2 sensors): Mountain forests
- **Santa Monica Mountains** (2 sensors): Malibu area
- **Mendocino National Forest** (1 sensor): Northern California

## 📊 Data Structure

### Water Quality Metrics
```javascript
{
  node_id: "water_node_01",
  lat: 37.8199,
  lon: -122.4783,
  timestamp: "2025-10-26T14:xx:xx.xxxZ",
  water_temp: 18.5,        // °C (14-22 for SF waters)
  ph: 8.2,                  // 7.8-8.6 for saltwater, 7.0-8.0 for freshwater
  turbidity: 12.3,          // NTU (5-20 typical)
  dissolved_oxygen: 8.5,    // mg/L (7-10 healthy levels)
  conductivity: 48500,      // μS/cm (45000-55000 saltwater, 200-500 freshwater)
  image_url: "https://storage.googleapis.com/water-sensors/node_01.jpg",
  region_id: "golden_gate_north",
  sensor_type: "water"
}
```

### Agricultural Metrics
```javascript
{
  node_id: "farm_node_01",
  lat: 36.6777,
  lon: -121.6555,
  timestamp: "2025-10-26T14:xx:xx.xxxZ",
  temp: 24.5,              // °C (18-30)
  humidity: 62.3,          // % (40-75)
  soil_ph: 6.8,            // 6.0-7.5 for crops
  image_url: "https://storage.googleapis.com/farm-sensors/node_01.jpg",
  region_id: "salinas_valley_north",
  sensor_type: "agriculture"
}
```

### Fire Monitoring Metrics
```javascript
{
  node_id: "fire_node_01",
  lat: 34.3705,
  lon: -118.1453,
  timestamp: "2025-10-26T14:xx:xx.xxxZ",
  temp: 32.8,              // °C (22-40, hot climate)
  humidity: 28.5,          // % (15-45, drier conditions)
  soil_ph: 6.2,            // 5.5-7.0 for forest soil
  image_url: "https://storage.googleapis.com/fire-sensors/node_01.jpg",
  region_id: "angeles_forest_west",
  sensor_type: "fire"
}
```

## 🗂️ Firebase Col
[truncated — 1521 more characters]
```

### drone-sensor-dashboard-farm/QUICKSTART.md

```markdown
# Quick Start Guide - Firebase Integration

## What Changed?

Your app now fetches sensor data from Firebase Firestore instead of the hardcoded `data/nodes.json` file.

## Setup Steps (5 minutes)

### 1. Create Firebase Project
1. Go to https://console.firebase.google.com/
2. Create a new project
3. Enable Firestore Database (Build > Firestore Database)

### 2. Configure Environment Variables
```bash
# Copy the template
cp .env.local.example .env.local

# Edit .env.local and add your Firebase credentials
# (Get these from Firebase Console > Project Settings > General > Your apps)
```

### 3. Migrate Your Data
```bash
# Upload your existing nodes.json to Firebase
npm run migrate
```

### 4. Run Your App
```bash
npm run dev
```

That's it! Your app is now connected to Firebase.

## Database Structure

### Two Collections:

#### 1. `sensor_nodes` (Main collection)
Stores all sensor data with these fields:
- `node_id` - Unique identifier
- `lat`, `lon` - GPS coordinates
- `timestamp` - ISO 8601 timestamp
- `temp` - Temperature in °C
- `humidity` - Humidity percentage
- `soil_ph` - Soil pH level
- `image_url` - Image URL
- `region_id` - Region identifier

#### 2. `node_images` (Optional - for separate image uploads)
If your webserver uploads images separately, store them here:
- `node_id` - Links to sensor_nodes
- `image_url` - Direct image URL
- `uploaded_at` - Upload timestamp
- `file_size`, `mime_type` - Image metadata

## For Your Webserver

To send data from your webserver to Firebase, use the Firebase Admin SDK:

```javascript
// Example: Add sensor reading
const admin = require('firebase-admin');
const db = admin.firestore();

await db.collection('sensor_nodes').doc('node_07').set({
  node_id: 'node_07',
  lat: 37.871,
  lon: -122.257,
  timestamp: new Date().toISOString(),
  temp: 24.1,
  humidity: 48.3,
  soil_ph: 6.5,
  image_url: 'https://example.com/node_07.jpg',
  region_id: 'berkeley_hills_zone_a'
});
```

See `FIREBASE_SETUP.md` for complete webserver integration details.

## Features

### Real-time Updates
The dashboard automatically updates when new data is added to Firebase - no page refresh needed!

### Benefits
- Live data updates
- Scalable storage
- No need to redeploy when data changes
- Multiple devices can write to the same database
- Cloud backup and redundancy

## Need Help?

Check `FIREBASE_SETUP.md` for:
- Detailed setup instructions
- Security rules configuration
- Webserver integration examples
- Troubleshooting guide
- API reference

```

### package.json

```
{
  "devDependencies": {
    "firebase-admin": "^13.5.0"
  }
}

```

### terra-intelligence-landing/package.json

```
{
  "name": "terra-intelligence-landing",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev -p 3000",
    "build": "next build",
    "start": "next start -p 3000",
    "lint": "next lint"
  },
  "dependencies": {
    "@radix-ui/react-slot": "^1.2.3",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "lucide-react": "^0.454.0",
    "next": "16.0.0",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "tailwind-merge": "^3.3.1"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4.1.9",
    "@types/node": "^22",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "postcss": "^8.5",
    "tailwindcss": "^4.1.9",
    "typescript": "^5"
  }
}

```

### terraintelligence-landing-main/package.json

```
{
  "name": "my-v0-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "build": "next build",
    "dev": "next dev -p 3000",
    "lint": "eslint .",
    "start": "next start -p 3000"
  },
  "dependencies": {
    "@hookform/resolvers": "^3.10.0",
    "@radix-ui/react-accordion": "1.2.2",
    "@radix-ui/react-alert-dialog": "1.1.4",
    "@radix-ui/react-aspect-ratio": "1.1.1",
    "@radix-ui/react-avatar": "1.1.2",
    "@radix-ui/react-checkbox": "1.1.3",
    "@radix-ui/react-collapsible": "1.1.2",
    "@radix-ui/react-context-menu": "2.2.4",
    "@radix-ui/react-dialog": "1.1.4",
    "@radix-ui/react-dropdown-menu": "2.1.4",
    "@radix-ui/react-hover-card": "1.1.4",
    "@radix-ui/react-label": "2.1.1",
    "@radix-ui/react-menubar": "1.1.4",
    "@radix-ui/react-navigation-menu": "1.2.3",
    "@radix-ui/react-popover": "1.1.4",
    "@radix-ui/react-progress": "1.1.1",
    "@radix-ui/react-radio-group": "1.2.2",
    "@radix-ui/react-scroll-area": "1.2.2",
    "@radix-ui/react-select": "2.1.4",
    "@radix-ui/react-separator": "1.1.1",
    "@radix-ui/react-slider": "1.2.2",
    "@radix-ui/react-slot": "1.1.1",
    "@radix-ui/react-switch": "1.1.2",
    "@radix-ui/react-tabs": "1.1.2",
    "@radix-ui/react-toast": "1.2.4",
    "@radix-ui/react-toggle": "1.1.1",
    "@radix-ui/react-toggle-group": "1.1.1",
    "@radix-ui/react-tooltip": "1.1.6",
    "@vercel/analytics": "latest",
    "autoprefixer": "^10.4.20",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "1.0.4",
    "date-fns": "4.1.0",
    "embla-carousel-react": "8.5.1",
    "input-otp": "1.4.1",
    "lucide-react": "^0.454.0",
    "next": "16.0.0",
    "next-themes": "^0.4.6",
    "react": "19.2.0",
    "react-day-picker": "9.8.0",
    "react-dom": "19.2.0",
    "react-hook-form": "^7.60.0",
    "react-resizable-panels": "^2.1.7",
    "recharts": "2.15.4",
    "sonner": "^1.7.4",
    "tailwind-merge": "^2.5.5",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^0.9.9",
    "zod": "3.25.76"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4.1.9",
    "@types/node": "^22",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "postcss": "^8.5",
    "tailwindcss": "^4.1.9",
    "tw-animate-css": "1.3.3",
    "typescript": "^5"
  }
}
```

### drone-sensor-dashboard-fire/package.json

```
{
  "name": "my-v0-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "build": "next build",
    "dev": "next dev -p 3002",
    "lint": "eslint .",
    "start": "next start -p 3002",
    "migrate": "tsx scripts/migrate-to-firebase.ts",
    "test-firebase": "tsx scripts/test-firebase.ts",
    "test-claude": "tsx scripts/test-claude.ts",
    "test-recommendations": "tsx scripts/test-recommendations.ts"
  },
  "dependencies": {
    "@anthropic-ai/sdk": "^0.67.0",
    "@emotion/is-prop-valid": "latest",
    "@hookform/resolvers": "^3.10.0",
    "@mapbox/mapbox-gl-draw": "latest",
    "@radix-ui/react-accordion": "1.2.2",
    "@radix-ui/react-alert-dialog": "1.1.4",
    "@radix-ui/react-aspect-ratio": "1.1.1",
    "@radix-ui/react-avatar": "1.1.2",
    "@radix-ui/react-checkbox": "1.1.3",
    "@radix-ui/react-collapsible": "1.1.2",
    "@radix-ui/react-context-menu": "2.2.4",
    "@radix-ui/react-dialog": "1.1.4",
    "@radix-ui/react-dropdown-menu": "2.1.4",
    "@radix-ui/react-hover-card": "1.1.4",
    "@radix-ui/react-label": "2.1.1",
    "@radix-ui/react-menubar": "1.1.4",
    "@radix-ui/react-navigation-menu": "1.2.3",
    "@radix-ui/react-popover": "1.1.4",
    "@radix-ui/react-progress": "1.1.1",
    "@radix-ui/react-radio-group": "1.2.2",
    "@radix-ui/react-scroll-area": "latest",
    "@radix-ui/react-select": "2.1.4",
    "@radix-ui/react-separator": "1.1.1",
    "@radix-ui/react-slider": "1.2.2",
    "@radix-ui/react-slot": "1.1.1",
    "@radix-ui/react-switch": "1.1.2",
    "@radix-ui/react-tabs": "1.1.2",
    "@radix-ui/react-toast": "1.2.4",
    "@radix-ui/react-toggle": "1.1.1",
    "@radix-ui/react-toggle-group": "1.1.1",
    "@radix-ui/react-tooltip": "1.1.6",
    "@vapi-ai/web": "^2.5.0",
    "@vercel/analytics": "latest",
    "autoprefixer": "^10.4.20",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "1.0.4",
    "date-fns": "4.1.0",
    "embla-carousel-react": "8.5.1",
    "firebase": "^12.4.0",
    "framer-motion": "latest",
    "input-otp": "1.4.1",
    "lucide-react": "^0.454.0",
    "mapbox-gl": "latest",
    "next": "16.0.0",
    "next-themes": "^0.4.6",
    "react": "^18.3.1",
    "react-day-picker": "9.8.0",
    "react-dom": "^18.3.1",
    "react-hook-form": "^7.60.0",
    "react-resizable-panels": "^2.1.7",
    "recharts": "2.15.4",
    "sonner": "^1.7.4",
    "tailwind-merge": "^2.5.5",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^0.9.9",
    "zod": "3.25.76"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4.1.9",
    "@types/mapbox__mapbox-gl-draw": "^1.4.9",
    "@types/node": "^22",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "dotenv": "^17.2.3",
    "postcss": "^8.5",
    "tailwindcss": "^4.1.9",
    "tsx": "^4.20.6",
    "tw-animate-css": "1.3.3",
    "typescript": "^5"
  }
}

```

### drone-sensor-dashboard-water/package.json

```
{
  "name": "my-v0-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "build": "next build",
    "dev": "next dev -p 3003",
    "lint": "eslint .",
    "start": "next start -p 3003",
    "migrate": "tsx scripts/migrate-to-firebase.ts",
    "test-firebase": "tsx scripts/test-firebase.ts",
    "test-claude": "tsx scripts/test-claude.ts",
    "test-recommendations": "tsx scripts/test-recommendations.ts"
  },
  "dependencies": {
    "@anthropic-ai/sdk": "^0.67.0",
    "@emotion/is-prop-valid": "latest",
    "@hookform/resolvers": "^3.10.0",
    "@mapbox/mapbox-gl-draw": "latest",
    "@radix-ui/react-accordion": "1.2.2",
    "@radix-ui/react-alert-dialog": "1.1.4",
    "@radix-ui/react-aspect-ratio": "1.1.1",
    "@radix-ui/react-avatar": "1.1.2",
    "@radix-ui/react-checkbox": "1.1.3",
    "@radix-ui/react-collapsible": "1.1.2",
    "@radix-ui/react-context-menu": "2.2.4",
    "@radix-ui/react-dialog": "1.1.4",
    "@radix-ui/react-dropdown-menu": "2.1.4",
    "@radix-ui/react-hover-card": "1.1.4",
    "@radix-ui/react-label": "2.1.1",
    "@radix-ui/react-menubar": "1.1.4",
    "@radix-ui/react-navigation-menu": "1.2.3",
    "@radix-ui/react-popover": "1.1.4",
    "@radix-ui/react-progress": "1.1.1",
    "@radix-ui/react-radio-group": "1.2.2",
    "@radix-ui/react-scroll-area": "latest",
    "@radix-ui/react-select": "2.1.4",
    "@radix-ui/react-separator": "1.1.1",
    "@radix-ui/react-slider": "1.2.2",
    "@radix-ui/react-slot": "1.1.1",
    "@radix-ui/react-switch": "1.1.2",
    "@radix-ui/react-tabs": "1.1.2",
    "@radix-ui/react-toast": "1.2.4",
    "@radix-ui/react-toggle": "1.1.1",
    "@radix-ui/react-toggle-group": "1.1.1",
    "@radix-ui/react-tooltip": "1.1.6",
    "@vapi-ai/web": "^2.5.0",
    "@vercel/analytics": "latest",
    "autoprefixer": "^10.4.20",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "1.0.4",
    "date-fns": "4.1.0",
    "embla-carousel-react": "8.5.1",
    "firebase": "^12.4.0",
    "framer-motion": "latest",
    "input-otp": "1.4.1",
    "lucide-react": "^0.454.0",
    "mapbox-gl": "latest",
    "next": "16.0.0",
    "next-themes": "^0.4.6",
    "react": "^18.3.1",
    "react-day-picker": "9.8.0",
    "react-dom": "^18.3.1",
    "react-hook-form": "^7.60.0",
    "react-resizable-panels": "^2.1.7",
    "recharts": "2.15.4",
    "sonner": "^1.7.4",
    "tailwind-merge": "^2.5.5",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^0.9.9",
    "zod": "3.25.76"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4.1.9",
    "@types/mapbox__mapbox-gl-draw": "^1.4.9",
    "@types/node": "^22",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "dotenv": "^17.2.3",
    "postcss": "^8.5",
    "tailwindcss": "^4.1.9",
    "tsx": "^4.20.6",
    "tw-animate-css": "1.3.3",
    "typescript": "^5"
  }
}

```

### drone-sensor-dashboard-farm/package.json

```
{
  "name": "my-v0-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "build": "next build",
    "dev": "next dev -p 3001",
    "lint": "eslint .",
    "start": "next start -p 3001",
    "migrate": "tsx scripts/migrate-to-firebase.ts",
    "test-firebase": "tsx scripts/test-firebase.ts",
    "test-claude": "tsx scripts/test-claude.ts",
    "test-recommendations": "tsx scripts/test-recommendations.ts",
    "upload-all-data": "tsx scripts/upload-all-data.ts"
  },
  "dependencies": {
    "@anthropic-ai/sdk": "^0.67.0",
    "@emotion/is-prop-valid": "latest",
    "@hookform/resolvers": "^3.10.0",
    "@mapbox/mapbox-gl-draw": "latest",
    "@radix-ui/react-accordion": "1.2.2",
    "@radix-ui/react-alert-dialog": "1.1.4",
    "@radix-ui/react-aspect-ratio": "1.1.1",
    "@radix-ui/react-avatar": "1.1.2",
    "@radix-ui/react-checkbox": "1.1.3",
    "@radix-ui/react-collapsible": "1.1.2",
    "@radix-ui/react-context-menu": "2.2.4",
    "@radix-ui/react-dialog": "1.1.4",
    "@radix-ui/react-dropdown-menu": "2.1.4",
    "@radix-ui/react-hover-card": "1.1.4",
    "@radix-ui/react-label": "2.1.1",
    "@radix-ui/react-menubar": "1.1.4",
    "@radix-ui/react-navigation-menu": "1.2.3",
    "@radix-ui/react-popover": "1.1.4",
    "@radix-ui/react-progress": "1.1.1",
    "@radix-ui/react-radio-group": "1.2.2",
    "@radix-ui/react-scroll-area": "latest",
    "@radix-ui/react-select": "2.1.4",
    "@radix-ui/react-separator": "1.1.1",
    "@radix-ui/react-slider": "1.2.2",
    "@radix-ui/react-slot": "1.1.1",
    "@radix-ui/react-switch": "1.1.2",
    "@radix-ui/react-tabs": "1.1.2",
    "@radix-ui/react-toast": "1.2.4",
    "@radix-ui/react-toggle": "1.1.1",
    "@radix-ui/react-toggle-group": "1.1.1",
    "@radix-ui/react-tooltip": "1.1.6",
    "@vapi-ai/web": "^2.5.0",
    "@vercel/analytics": "latest",
    "autoprefixer": "^10.4.20",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "1.0.4",
    "date-fns": "4.1.0",
    "embla-carousel-react": "8.5.1",
    "firebase": "^12.4.0",
    "framer-motion": "latest",
    "input-otp": "1.4.1",
    "lucide-react": "^0.454.0",
    "mapbox-gl": "latest",
    "next": "16.0.0",
    "next-themes": "^0.4.6",
    "react": "^18.3.1",
    "react-day-picker": "9.8.0",
    "react-dom": "^18.3.1",
    "react-hook-form": "^7.60.0",
    "react-resizable-panels": "^2.1.7",
    "recharts": "2.15.4",
    "sonner": "^1.7.4",
    "tailwind-merge": "^2.5.5",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^0.9.9",
    "zod": "3.25.76"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4.1.9",
    "@types/mapbox__mapbox-gl-draw": "^1.4.9",
    "@types/node": "^22",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "dotenv": "^17.2.3",
    "postcss": "^8.5",
    "tailwindcss": "^4.1.9",
    "tsx": "^4.20.6",
    "tw-animate-css": "1.3.3",
    "typescript": "^5"
  }
}

```

### terraintelligence-landing-main/app/layout.tsx

```typescript
import type React from "react"
import type { Metadata } from "next"
import { Geist, Geist_Mono } from "next/font/google"
import { Analytics } from "@vercel/analytics/next"
import "./globals.css"

const _geist = Geist({ subsets: ["latin"] })
const _geistMono = Geist_Mono({ subsets: ["latin"] })

export const metadata: Metadata = {
  title: "TerraIntelligence Marketplace",
  description: "Discover AI Tools for Geospatial Analysis",
  generator: "v0.app",
}

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode
}>) {
  return (
    <html lang="en">
      <body className={`font-sans antialiased`}>
        {children}
        <Analytics />
      </body>
    </html>
  )
}

```

### terra-intelligence-landing/app/layout.tsx

```typescript
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
  title: "TerraIntelligence Marketplace - AI-Powered Geospatial Analytics",
  description: "Discover cutting-edge AI tools for environmental and geospatial analytics. Transform your data into actionable insights with our comprehensive suite of intelligent applications.",
  keywords: ["AI", "geospatial", "analytics", "environmental", "agriculture", "fire detection", "soil analysis"],
  authors: [{ name: "TerraIntelligence" }],
  openGraph: {
    title: "TerraIntelligence Marketplace",
    description: "AI-Powered Geospatial Intelligence Platform",
    type: "website",
  },
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" className={inter.className}>
      <body className="antialiased">{children}</body>
    </html>
  );
}

```

[332 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]