This MVP was built in record time to demonstrate the RAKSHA concept: an AI-powered crop disease detection system that helps farmers protect their harvests.
- Node.js + Express: Lightweight, fast, and perfect for API services
- TypeScript: Type safety prevents bugs and improves developer experience
- Multer: Industry-standard library for handling file uploads
- In-memory storage: No database needed for MVP, keeps it simple
- Next.js 15: Modern React framework with App Router for excellent performance
- TypeScript: Consistent type safety across the stack
- TailwindCSS: Rapid UI development with utility classes
- Custom animations: Premium feel with CSS animations and gradients
We implemented a mock AI service for several strategic reasons:
- Speed: Allows frontend/backend integration without waiting for AI model
- Determinism: Consistent results for testing and demo purposes
- Flexibility: Easy to swap for real AI later without changing the API contract
- Cost: No API credits needed during development
- Why: For MVP, we don't need to store historical analyses
- Trade-off: Can't track user history, trends, or build a knowledge base
- Next step: Add PostgreSQL or MongoDB to store analyses for analytics
- Why: Enables rapid development and testing
- Trade-off: Not production-ready for actual disease detection
- Next step: Integrate real AI (see options below)
- Why: Simplifies MVP, reduces scope
- Trade-off: Anyone can use the service, no user personalization
- Next step: Add Firebase Auth or NextAuth.js for user management
- Why: Images processed in-memory only
- Trade-off: Can't review past images or build training datasets
- Next step: Store images in AWS S3 or Google Cloud Storage
- Why: English-only for MVP
- Trade-off: May limit adoption in non-English speaking regions
- Next step: Add i18n with translations for Hindi, Spanish, etc.
Option 1: Use Existing API
- PlantVillage API or similar service
- Pros: Quick integration, maintained by experts
- Cons: Ongoing costs, dependency on third party
Option 2: Train Custom Model
- Use TensorFlow or PyTorch with PlantVillage dataset
- Pros: Full control, no API costs
- Cons: Requires ML expertise, GPU resources
Option 3: Cloud Vision AI
- Google Cloud Vision with custom AutoML model
- AWS Rekognition Custom Labels
- Pros: Scalable, managed infrastructure
- Cons: Ongoing costs, vendor lock-in
Recommended: Start with Option 1 for quick validation, then move to Option 2 for production scale.
- Add PostgreSQL for storing analyses
- Track accuracy metrics and user feedback
- Build dashboard for farmers to see history
- Generate insights (common diseases, seasonal trends)
- React Native or Flutter app
- Direct camera integration
- Offline analysis capability (on-device model)
- Push notifications for treatment reminders
- Multi-crop support (currently optimized for generic crops)
- Regional disease patterns and alerts
- Treatment effectiveness tracking
- Community features (farmers helping farmers)
- Integration with agricultural supply chains
- Add caching layer (Redis) for repeated queries
- CDN for static assets
- Horizontal scaling with load balancer
- Rate limiting and API quotas
- Monitoring and alerting (Datadog, New Relic)
- Mock AI: Current responses are deterministic, not actual disease detection
- No validation: Backend doesn't validate if image actually contains a crop
- Single image: Can't analyze multiple images or video
- No geolocation: Could enhance recommendations based on local conditions
- Limited disease database: Only 6 diseases in mock data
- Current: Memory-based, can handle ~100 concurrent requests
- Bottleneck: Image processing and AI inference
- Solution: Queue system (Bull/BullMQ) for async processing
- Scaling: Deploy to AWS Lambda or Google Cloud Run for auto-scaling
- CORS: Configured for development, needs production URLs
- File uploads: Limited to 10MB and image types only
- No auth: Open to abuse in current form
- Next steps:
- Add rate limiting (express-rate-limit)
- Implement API keys for production
- Add user authentication
- Scan uploaded images for malware
- Quick: Railway, Render, or Heroku (1-click deploy)
- Production: AWS ECS, Google Cloud Run, or DigitalOcean App Platform
- Environment: Set
NODE_ENV=productionand configure CORS properly
- Recommended: Vercel (built by Next.js team, zero-config)
- Alternatives: Netlify, AWS Amplify, Cloudflare Pages
- Build:
npm run buildgenerates optimized static + SSR bundle
- Docker: Included Dockerfiles can be used with docker-compose
- Kubernetes: For enterprise scale with auto-scaling
Hosting (handling 10K requests/month):
- Backend: $7-15/month (Render, Railway)
- Frontend: $0 (Vercel free tier)
- Database: $5-15/month (small PostgreSQL instance)
AI Service (varies widely):
- PlantVillage API: ~$0.01-0.05 per image
- Google Cloud Vision: ~$1.50 per 1000 images
- Custom model: Hardware costs only
Total: ~$50-100/month for 10K analyses
- Unit tests: Add Jest for backend service logic
- Integration tests: Test API endpoints with Supertest
- E2E tests: Playwright or Cypress for frontend flows
- Load testing: Artillery or k6 for performance benchmarking
If building on this:
- Keep the service abstraction clean (easy to swap AI)
- Maintain type safety across the stack
- Document API changes in
docs/api.md - Follow the existing code style
- Test with multiple crop images before deploying
This MVP provides a strong foundation. The architecture is designed for easy extension and scaling. Focus on getting real AI integrated first, then iterate based on farmer feedback.
Built with ❤️ for farmers worldwide 🌱