AgroVisionSecureAI+ is a secure visual AI agent for farmers to monitor crops, compare field images, identify objects (plants, pests, weeds), segment affected areas, and generate clear reports. Access is protected by Auth0 for AI Agents, ensuring users only see their own data and analysis results.
This project demonstrates the three pillars of Auth0 for AI Agents:
- Authenticate: Secure user authentication with role-based access.
- Control: Fine-grained AI tool access through token validation.
- Limit: User data isolation and comprehensive audit trails.
- Secure authentication: Auth0 login with role-based access (farmer, inspector, admin).
- Image analysis: Upload and analyze crop images with AI-powered insights.
- Multi-analysis types: Classification, object detection, image segmentation, comparison.
- Results dashboard: Confidence scores, detected areas, visual results, and graphs.
- History tracking: Analysis backup with dates, scores, and comparison tools.
- Admin dashboard: User management and system monitoring for administrators.
- Frontend: React 18, Vite, TypeScript, Tailwind CSS, Auth0 React SDK.
- Backend: PHP 8.0+, REST API with Auth0 JWT verification.
- Database: SQLite with user isolation and role-based access.
- AI integration: Hugging Face Inference API (ResNet-50, DETR, Mask2Former, CLIP).
- Hosting: Ready for Vercel (frontend) and Render/Railway (backend).
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ React SPA │────│ PHP REST API │────│ Hugging Face API │
│ (Auth0 Login) │ │ (JWT Validation) │ │ (AI Models) │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│
┌────────▼────────┐
│ SQLite DB │
│ (User Isolation)│
└─────────────────┘
- Node.js 18+ and npm.
- PHP 8.0+ and Composer.
- Auth0 account with AI Agents configuration.
- Hugging Face API token.
cd frontend
npm install
cp .env.example .env
# Configure your Auth0 credentials in .env
npm run devcd backend
composer install
cp .env.example .env
# Configure Auth0 and Hugging Face credentials in .env
composer run serveVITE_AUTH0_DOMAIN=your-auth0-domain.auth0.com
VITE_AUTH0_CLIENT_ID=your-client-id
VITE_API_BASE_URL=http://localhost:8000/apiAUTH0_DOMAIN=your-auth0-domain.auth0.com
AUTH0_CLIENT_ID=your-client-id
AUTH0_CLIENT_SECRET=your-client-secret
AUTH0_AUDIENCE=https://agrovision-api.auth0.com
HUGGING_FACE_API_TOKEN=your-hf-token
ALLOWED_ORIGINS=http://localhost:5173- Classification: microsoft/resnet-50 - Identifies crop types and health status.
- Object detection: facebook/detr-resnet-50 - Detects pests, plants, tools.
- Segmentation: facebook/mask2former - Segments vegetation vs. diseased areas.
- Comparison: openai/clip-vit-base-patch32 - Compares field changes over time.
GET /health- Health check.GET /user/profile- Current user profile.POST /analyze- Upload and analyze images.GET /analysis/history- User's analysis history.GET /analysis/{id}- Specific analysis details.DELETE /analysis/{id}- Delete analysis.GET /admin/users- All users (admin only).GET /admin/analyses- All analyses (admin only).
- Authentication: Auth0 JWT token verification on all endpoints.
- Authorization: Role-based access control (farmer/inspector/admin).
- Data isolation: Users can only access their own analyses.
- Token vault: Secure token management with Auth0.
- Audit logs: Track user connections and AI analyses.
- CORS protection: Configurable allowed origins.
- Start frontend dev server:
npm run dev(in frontend/). - Start backend server:
composer run serve(in backend/). - Build frontend:
npm run build(in frontend/). - Run frontend preview:
npm run preview(in frontend/).
AgroVisionSecureAI+/
├── frontend/ # React SPA
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Route pages
│ │ ├── services/ # API service layer
│ │ ├── types/ # TypeScript definitions
│ │ └── hooks/ # Custom React hooks
│ └── public/ # Static assets
├── backend/ # PHP REST API
│ ├── src/ # PHP classes
│ ├── public/ # Web server entry point
│ ├── config/ # Configuration files
│ └── uploads/ # User uploaded images
└── database/ # SQLite database files
This project demonstrates all three pillars of Auth0 for AI Agents:
- Authenticate: Secure user login with role-based access.
- Control: Fine-grained permissions for AI tools and resources.
- Limit: User data isolation and audit capabilities.
Use case: Smart, sustainable, and secure agriculture through AI-powered crop monitoring with enterprise-grade security.
npm run build
# Deploy dist/ folder to Vercel# Configure environment variables
# Set document root to public/
# Install PHP 8.0+ and ComposerThis project is built for the Auth0 AI Agents Challenge 2025.