- Overview
- Features
- Technical Specifications
- Project Structure
- How to Run the Project
- Future Enhancements
- Live Deployment
Farmlytics is a web-based platform that enables farmers to efficiently monitor, manage, and analyze their field data. By integrating Google Gemini AI, the system provides actionable insights to support decision-making. The platform is designed with a user-friendly interface and advanced features like AI-driven analysis, data visualization, and subscription-based premium services.
- Secure Login and Signup:
- Implements token-based authentication using JWT (JSON Web Tokens).
- Protects sensitive routes using middleware for authentication and role validation.
- Role-Based Access Control:
- Provides differentiated access for roles such as Admin and Farmer.
- Allows Admins to manage all users and farmers to manage their own data.
- Dashboard for Field Operations:
- Enables farmers to add, update, and delete field data.
- Provides input fields such as field name, location (latitude/longitude), crop type, and area size.
- Field Overview:
- Displays an overview of all fields managed by the user.
- Includes 7 different chart types to represent various data related to the field, such as soil health trends, investment to profit, harvesting period etc ...
- Google Gemini AI:
- Leverages Google Gemini AI for soil health and crop health analysis.
- Outputs actionable insights such as crop yield predictions and soil condition.
- Insight Display:
- Presents AI-generated insights on the farmer’s dashboard.
- Interactive Charts:
- Visualizes field data including crop yield trends and health statistics.
- Used recharts libray for data visualization.
- Subscription Management:
- Integrated Stripe payement gateway.
- Transaction History:
- Maintains a record of all payments and subscriptions in the mongo database for user reference.
- Test Payment Gateway:
- Use the test card number 4242 4242 4242 4242 with expiry 11/25 and CVC 123 for testing payments
- Mobile-Friendly UI:
- Ensures optimal user experience across devices.
- Utilized Tailwind CSS for styling
- Node.js and Express.js with typescript:
- Develops the RESTful API for the system with type safety.
- MongoDB with Mongoose:
- Stores data in a NoSQL database.
- Uses Mongoose for schema definitions and data validation.
- Authentication Middleware:
- Secures API endpoints and validates user roles.
- Stripe for payment gateway:
- Payment checkout dont with stripe with sessions.
- React.js with typescript:
- Builds the dynamic and interactive user interface.
- State Management:
- Just used context API since its not that complex Application.
- Recharts:
- Recgarts used for data visualization both in admin and farmer dashboard
- Frontend Deployment:
- Deployed the React app on Vercel for fast and scalable hosting.
- Backend Deployment:
- Hosted the Node.js server on Render Platform.
backend/
|-- controllers/
| |--userController.ts
| |--fieldController.ts
| |--aiInsightController.ts
| |--paymentController.ts
|-- middleware/
| |--verifyToken.ts
| |--isAdmin.ts
| |--verifyNewField.ts
| |--errorHandler.ts
| |--verifyAdminRegister.ts
|-- models/
| |--fieldModel.ts
| |--userModel.ts
| |--transactionModel.ts
|-- routes/
| |--userRoute.ts
| |--fieldRoute.ts
| |--aiInsightRoute.ts
| |--paymentRoute.ts
|-- lib/
| |--utils.ts
|-- server.ts
|-- package.json
frontend/
|-- src/
| |-- components/
| |-- pages/
| |-- context/
| |-- App.tsx
| |-- tailwind
|-- package.json
- Node.js
- MongoDB
- npm
-
Clone the repository:
git clone https://github.com/vasa-r/sensegrass-assignment
-
Install dependencies for backend and frontend:
cd server npm install cd ../client npm install
-
Set up environment variables:
- Backend
.envfile:JWT_SECRET = your jwt secret REFERRAL_CODE = 'farmlytics' - for admin user signup PORT = 3000 IS_PRODUCTION = false MONGO_URI = your mongo uri GOOGLEAI_API = google api key for gemini AI STRIPE_SECRET = stripe api key BASE_URL = http://localhost:5173
- Frontend
.envfile:VITE_API_BASE_URL = http://localhost:3000 ITE_STRIPE_PK = stripe public key
- Backend
-
Run the backend server:
cd backend npm start -
Run the frontend server:
cd frontend npm run dev -
Access the application:
- Frontend:
http://localhost:5173 - Backend:
http://localhost:3000
- Frontend:
-
Test Payment Gateway:
- Use the test card number 4242 4242 4242 4242 with expiry 11/25 and CVC 123 for testing payments
- Frontend: Vercel URL
- Backend: Render