A GIS monitoring system for Baikal region forests using satellite data. Full-stack TypeScript application with:
- Express backend with PostgreSQL database
- React + Vite + TypeScript + Tailwind CSS frontend (SPA)
- React Router for client-side navigation
- Leaflet interactive map integration
- NASA FIRMS fire hotspot integration
- Global Forest Watch deforestation data
- Spectral indices calculations (NDVI, NBR, EVI, etc.)
- Jest testing framework
├── backend/ # Backend (Express + TypeScript)
│ ├── server.ts # Main Express server (port 3000)
│ ├── config/
│ │ ├── database.ts # PostgreSQL connection pool
│ │ └── titiler.ts # TiTiler service config
│ ├── models/
│ │ └── forestArea.ts # Forest area & change interfaces
│ ├── routes/
│ │ ├── analytics.ts # Forest analytics endpoints
│ │ ├── monitoring.ts # Monitoring data endpoints
│ │ ├── stac.ts # STAC API proxy endpoints
│ │ └── titiler.ts # TiTiler proxy endpoints
│ ├── services/
│ │ ├── databaseService.ts # Database operations
│ │ ├── spectralIndices.ts # NDVI, NBR, EVI calculators
│ │ ├── firmsService.ts # NASA FIRMS integration
│ │ ├── globalForestWatch.ts # GFW API integration
│ │ ├── stacService.ts # STAC API client
│ │ └── titilerService.ts # TiTiler API client
│ └── utils/
│ ├── devAlerts.ts # Development alerts/warnings system
│ └── stubs.ts # Stub functions for unimplemented features
├── frontend/ # Frontend (React + Vite + TypeScript + Tailwind)
│ ├── index.html # HTML entry point
│ ├── src/
│ │ ├── main.tsx # React entry point
│ │ ├── App.tsx # Main app with React Router
│ │ ├── style.css # Tailwind CSS styles
│ │ ├── components/
│ │ │ ├── Layout.tsx # Main layout with Header/Footer
│ │ │ ├── Header.tsx # Navigation header
│ │ │ └── Footer.tsx # Page footer
│ │ ├── pages/
│ │ │ ├── HomePage.tsx # Map page with statistics
│ │ │ ├── AnalyticsPage.tsx # Analytics dashboard
│ │ │ └── WikiPage.tsx # Wiki with modals
│ │ ├── api/ # API client modules
│ │ ├── types/
│ │ └── utils/
│ ├── vite.config.ts
│ ├── tsconfig.json
│ └── tailwind.config.js
├── database/ # Database migrations
│ ├── migrations/ # SQL migration files
│ └── seeds/ # Seed data
├── docs/ # Documentation
├── tests/ # Jest test files
├── jest.config.js
└── package.json
- Backend:
npm run dev- Express API on port 3000 - Frontend:
npm run dev:client- Vite React dev server on port 5000 - Tests:
npm test- Run Jest tests - Database:
npm run db:setup- Run migrations and seeds - Both: Two workflows run simultaneously
/- Home page with map and statistics/analytics- Analytics dashboard/wiki- Wiki with educational content
forest_areas- Forest polygons with metadataforest_changes- Detected changes (fire, logging, disease)satellite_scenes- Satellite imagery metadataspectral_indices- Calculated vegetation indicesmonitoring_zones- Special monitoring areasalerts- System alerts and notificationsfire_hotspots- NASA FIRMS fire datareports- Generated analysis reportsforest_types,change_types,satellites- Lookup tables
GET /health- Health checkGET /api/monitoring/forest-areas- Forest areas listGET /api/monitoring/forest-areas/geojson- Forest areas as GeoJSONGET /api/monitoring/forest-changes- Forest change eventsGET /api/monitoring/forest-changes/geojson- Changes as GeoJSONGET /api/monitoring/fire-hotspots- Fire hotspot dataGET /api/monitoring/fire-hotspots/firms- NASA FIRMS live dataGET /api/monitoring/monitoring-zones- Monitoring zonesGET /api/monitoring/alerts- System alertsGET /api/monitoring/statistics- Summary statisticsGET /api/monitoring/spectral-indices/info- Index formulasPOST /api/monitoring/spectral-indices/calculate- Calculate indexGET /api/monitoring/gfw/tree-cover-loss- GFW deforestation dataGET /api/monitoring/lookup/:table- Lookup table dataGET /api/titiler/*- TiTiler proxy endpointsGET /api/stac/*- STAC API proxy endpoints
Implemented in src/services/spectralIndices.ts:
- NDVI - Normalized Difference Vegetation Index
- NBR - Normalized Burn Ratio
- NDWI - Normalized Difference Water Index
- EVI - Enhanced Vegetation Index
- SAVI - Soil Adjusted Vegetation Index
- NDMI - Normalized Difference Moisture Index
- dNBR - Differenced NBR for burn severity
- NASA FIRMS - Fire hotspot data (VIIRS/MODIS)
- Global Forest Watch - Tree cover loss data
- TiTiler - COG tile server (pending external service)
- STAC API - Satellite catalog (pending external service)
DATABASE_URL- PostgreSQL connection (VPS:postgresql://tulubyev:PASSWORD@172.28.0.1:5432/forest_db)EXTERNAL_DATABASE_URL- optional remote PostgreSQL (takes precedence, enables SSL)NASA_FIRMS_API_KEY- NASA FIRMS API key (optional)GFW_API_KEY- Global Forest Watch API key (optional)STAC_API_URL- STAC API endpointTITILER_URL- TiTiler service endpoint
Production: https://forestwatch.ru — Docker container behind Traefik on VPS 90.156.168.149 (/var/www/forestwatch).
cp .env.example .envand fill inDATABASE_URLand API keysbash deploy.sh— git pull,docker compose -f docker-compose.prod.yml up -d --build, waits for/health
- Backend: Node.js, Express, TypeScript, PostgreSQL
- Frontend: React, Vite, TypeScript, Tailwind CSS, Leaflet, React Router
- Maps: Leaflet with OSM, ESRI, OpenTopoMap, CartoDB base layers
- Testing: Jest, ts-jest
- Database: PostgreSQL 16 on VPS (forest_db)
See docs/ folder for detailed documentation:
docs/README.md- Project overviewdocs/DEVELOPMENT.md- Development guidelinesdocs/ARCHITECTURE.md- System architecturedocs/DATA_SOURCES.md- FIRMS, GFW, ООПТ/Overpass: особенности API и принятые решения
- Database schema with 10 tables
- Seed data for Baikal region
- React SPA with React Router
- Leaflet map integration
- Spectral indices calculator
- NASA FIRMS service
- Global Forest Watch service
- Monitoring API endpoints
- GeoJSON export endpoints
- TypeScript migration (React frontend)
- TiTiler COG preview (requires external TiTiler)
- STAC API search (requires external STAC catalog)
- Export functionality (PDF, Excel reports)
- ML predictions for fire risk
- Real-time alert notifications