AgriChain is a beginner-friendly full-stack agriculture management app built with a Spring Boot REST API and a React frontend. It provides CRUD management for Farmers, Fields, and Crops, a secure authenticated UI using JWT, and a dashboard with charts.
- Farmers
- CRUD operations: create, list, update, delete
- Search/filter support in the frontend (by name and region)
- Fields
- CRUD operations
- Links to farmers via
farmerId(no relational DB for domain data)
- Crops
- CRUD operations
- Links to fields via
fieldId
- Dashboard
- Total counts (farmers, fields, crops)
- Charts:
- Farmers by region
- Crops by type
- Auth (JWT)
POST /auth/registerfor registering usersPOST /auth/loginfor logging in and getting a JWT token- Protected API routes (all endpoints except
/auth/**) - React stores the token in
localStorageand sends it asAuthorization: Bearer <token>
- Backend: Java 17, Spring Boot, Spring Security, JWT (
io.jsonwebtoken), H2 (in-memory for users), Swagger (springdoc-openapi), Lombok - Frontend: React, Axios, React Router, Chart.js (
react-chartjs-2)
backend/- Spring Boot REST APIfrontend/- React frontend (create-react-app)
- Open a terminal at the repo root
- Run:
- Windows:
cd backend.\mvnw.cmd spring-boot:run
- macOS/Linux:
cd backend./mvnw spring-boot:run
- Windows:
- Backend runs at:
http://localhost:8080 - Swagger UI:
http://localhost:8080/swagger-ui.html
- Run:
cd frontendnpm installnpm start
- Frontend runs at:
http://localhost:3000
- The backend wraps most responses using
ApiResponse<T>with:message,data,status
- After login, the React app attaches the token automatically using an Axios interceptor:
Authorization: Bearer <token>
Add screenshots here (for example):
- Farmers page table + search/filter
- Login/register page
- Dashboard charts (farmers by region, crops by type)
- Swagger UI screenshot
- Add persistent storage for domain entities (instead of in-memory lists)
- Role-based authorization (e.g., Admin vs User) on APIs
- Add more dashboard visualizations and date-based filtering
- Improve validation and error UX across all pages
- Add automated tests (backend unit/integration + frontend component tests)