India's First Real-Time Groundwater Intelligence Platform
Empowering farmers, policymakers, and researchers with AI-powered water predictions and actionable insights.
Subterra is a mobile-first, AI-powered groundwater management platform designed for India. It connects to 5,260+ DWLR (Digital Water Level Recorder) stations across the country and uses machine learning to predict water levels up to 30 days ahead.
| Feature | Description |
|---|---|
| 30-Day Predictions | ML-powered water level forecasting using Temporal Fusion Transformer |
| Real-Time Monitoring | Live data from India-WRIS DWLR network |
| Crop Planner | AI-optimized irrigation schedules based on predicted water availability |
| Water Budget Tool | Calculate sustainable usage limits with ML predictions |
| Community View | See nearby wells and collective water usage trends |
| Multilingual | Support for 10+ Indian languages |
| Offline Mode | Works without internet, syncs when connected |
| SMS Alerts | Low-connectivity users get critical updates via SMS |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT LAYER β
βββββββββββββββββββββββ¬ββββββββββββββββββββββ¬ββββββββββββββββββββββββββ€
β Flutter App β React PWA β Research Portal β
β (Android/iOS) β (Web Frontend) β (Researchers) β
βββββββββββ¬ββββββββββββ΄ββββββββββ¬ββββββββββββ΄ββββββββββ¬ββββββββββββββββ
β β β
ββββββββββββββββ¬βββββββ΄βββββββββββ¬βββββββββββ
β GraphQL API β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND (Node.js) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Controllers β Services β GraphQL Resolvers β Middleware β
βββββββββ¬ββββββββ΄ββββββ¬βββββββ΄βββββββββββ¬ββββββββββ΄βββββββββ¬βββββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ
β Firestore β β Redis β β India-WRIS β β ML Service β
β (Storage) β β (Cache) β β API β β (TFT Inference) β
βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββ¬βββββββββββ
β
ββββββββββββΌβββββββββββ
β Gemini API β
β (AI Insights) β
βββββββββββββββββββββββ
We chose TFT because groundwater prediction isn't just about looking at past water levels. It's about understanding complex relationships between:
- Historical water levels
- Rainfall patterns
- Temperature and humidity
- Seasonal cycles
- Geographic location
TFT handles all of this beautifully. See docs/ML_MODEL.md for full details.
| Aspect | Details |
|---|---|
| Lookback Window | 90 days of history |
| Forecast Horizon | 30 days ahead |
| Output | Quantile predictions (10th, 50th, 90th percentile) |
| Features | Water level, rainfall, temperature, location, well depth |
| Model Size | ~2MB |
subterra/
βββ backend/ # Node.js + Express + GraphQL API
β βββ src/
β β βββ config/ # Firebase, Redis configuration
β β βββ controllers/ # Business logic controllers
β β βββ services/ # External API integrations
β β βββ graphql/ # Schema and resolvers
β β βββ middleware/ # Auth, logging, error handling
β βββ ml/ # Python ML components
β βββ train_tft.py # TFT training script
β βββ inference/ # FastAPI inference service
β βββ checkpoints/ # Trained model weights
β βββ data/ # Training dataset
β
βββ frontend/ # React PWA (Web interface)
β βββ src/
β βββ pages/ # Page components
β βββ components/ # Reusable UI components
β βββ lib/ # GraphQL queries, utilities
β
βββ lib/ # Flutter app (Mobile)
β βββ core/ # App core (theme, routes)
β βββ data/ # Data layer (APIs, models)
β βββ features/ # Feature modules
β
βββ docs/ # Documentation
βββ ML_MODEL.md # TFT model documentation
βββ DATA_PIPELINE.md # How we collect and process data
βββ API_REFERENCE.md # GraphQL API documentation
βββ ARCHITECTURE.md # System architecture
- Node.js 18+
- Python 3.10+
- Docker (optional)
- Firebase project (for Firestore)
- Redis (for caching)
git clone https://github.com/your-repo/subterra.git
cd subterracd backend
npm install
cp .env.example .env
# Edit .env with your API keys
npm run devcd backend/ml
pip install -r requirements_train.txt
python inference/service.py
# Runs on http://localhost:8000cd frontend
npm install
npm run dev
# Runs on http://localhost:5173docker-compose up --build# API Keys
GEMINI_API_KEY=your_gemini_api_key
MSG91_AUTH_KEY=your_msg91_key
MSG91_SENDER_ID=SBTRRA
# Firebase
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_CLIENT_EMAIL=your_client_email
FIREBASE_PRIVATE_KEY=your_private_key
# Redis
REDIS_URL=redis://localhost:6379
# ML Service
ML_SERVICE_URL=http://localhost:8000| Source | Data Type | Update Frequency |
|---|---|---|
| India-WRIS | DWLR water levels | Every 6 hours |
| NASA POWER | Rainfall, temperature | Daily |
| Firestore | User data, alerts | Real-time |
| Home | Map | Crop Planner | Water Budget |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
- ML Model Details - How TFT works and why we chose it
- Data Pipeline - How we collect and process data
- API Reference - GraphQL queries and mutations
- Architecture - System design with diagrams
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- India-WRIS for providing open access to DWLR data
- NASA POWER for weather data
- All the farmers and communities who inspired this project




