This project is a sophisticated backend system that helps farmers monitor their agricultural land using satellite imagery. The system allows farmers to register their farms and set coordinates, which are then used to fetch and analyze satellite images from the Sentinel satellite system.
graph TD
A[Farmer's Mobile/Web App] --> B[Express Backend API]
B --> C[Authentication Service]
B --> D[Farm Management]
B --> E[Coordinate Processing]
E --> F[Redis Queue]
F --> G[Worker Service]
G --> H[Sentinel Satellite API]
H --> I[Image Processing]
I --> J[S3 Storage]
K[ML Model] --> I
-
👨🌾 Farmer Authentication
- Secure signup and login
- JWT-based authentication
- Password encryption
-
🌍 Farm Management
- Register multiple farms
- Set farm boundaries
- View farm details
-
📍 Coordinate System
- Set coordinates via GPS
- Offline support for poor network areas
- Automatic sync when network available
-
🛰️ Satellite Integration
- Real-time Sentinel satellite image fetching
- Automatic image processing
- Historical image storage
-
💾 Data Storage
- Secure image storage in S3
- Efficient metadata management
- Quick retrieval system
-
API Server (Express.js)
- Handles HTTP requests
- Manages authentication
- Coordinates data flow
-
Database (PostgreSQL + Prisma)
- Stores user data
- Manages farm information
- Tracks coordinates
-
Queue System (Redis + Bull)
- Manages background jobs
- Handles offline synchronization
- Processes satellite image requests
-
Worker Service
- Fetches satellite images
- Processes image data
- Updates job status
-
Storage System (AWS S3)
- Stores satellite images
- Manages file organization
- Handles secure access
- Node.js (v16 or higher)
- PostgreSQL
- Redis
- AWS Account
- Sentinel Hub Account
Create a `.env` file with:
```env
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
JWT_SECRET="your-secret-key"
REDIS_URL="redis://localhost:6379"
SENTINEL_CLIENT_ID="your-client-id" SENTINEL_CLIENT_SECRET="your-client-secret"
AWS_ACCESS_KEY_ID="your-access-key" AWS_SECRET_ACCESS_KEY="your-secret-key" AWS_S3_BUCKET="your-bucket-name" AWS_REGION="us-east-1" ```
-
Clone the repository: ```bash git clone https://github.com/yourusername/Cropcoders.git cd SIH ```
-
Install dependencies: ```bash npm install ```
-
Set up the database: ```bash npx prisma migrate dev ```
-
Start the services: ```bash
npm run dev
node worker.js ```
- Farmer registers and logs in through mobile/web app
- Creates farm and sets coordinates
- Coordinates are sent to backend (stored if offline)
- Backend queues coordinate processing
- Worker fetches satellite images
- Images are processed and stored
- Results are available to farmer
- JWT authentication
- Password hashing
- Rate limiting
- CORS protection
- Data encryption
- Secure file storage
The project includes Docker support for easy deployment: