A comprehensive React application for predicting aflatoxin contamination in maize grain using machine learning. Built with Vite, React Router, Tailwind CSS, and enterprise-grade architecture.
- Institutions: Schools, prisons, bulk buyers
- Processors: Food processing companies
- Laboratories: Testing and research facilities
- Administrators: System management and analytics
- Real-time aflatoxin contamination prediction
- Integration with ML API endpoint
- Confidence scoring and risk assessment
- Batch tracking and historical data
- Real-time statistics and metrics
- Recent test history and trends
- Quick action shortcuts
- Performance indicators
- Prevention strategies and best practices
- Storage guidelines and techniques
- Testing procedures and protocols
- Regulatory compliance information
- Responsive design for all devices
- Roboto font for professional appearance
- Gradient backgrounds and glass morphism
- Micro-animations and smooth transitions
- Node.js 18.0 or higher
- npm or yarn package manager
- Git
- Clone the repository
git clone https://github.com/your-username/aflaguard-pro.git
cd aflaguard-pro- Install dependencies
npm install
# or
yarn install- Set up environment variables
cp .env.example .envEdit .env with your configuration:
VITE_API_URL=https://model-api-capstone.onrender.com
VITE_APP_NAME=AflaGuard Pro
VITE_APP_VERSION=1.0.0- Run the development server
npm run dev
# or
yarn dev- Open your browser Navigate to http://localhost:3000
aflaguard-pro/
βββ public/ # Static assets
βββ src/
β βββ components/ # React components
β β βββ ui/ # Reusable UI components
β β βββ layout/ # Layout components
β β βββ auth/ # Authentication components
β β βββ dashboard/ # Dashboard components
β β βββ prediction/ # Prediction components
β β βββ learning/ # Learning center components
β βββ contexts/ # React contexts
β βββ hooks/ # Custom hooks
β βββ pages/ # Page components
β βββ utils/ # Utility functions
β βββ App.jsx # Main app component
β βββ main.jsx # App entry point
β βββ index.css # Global styles
βββ index.html # HTML template
βββ package.json
βββ vite.config.js
βββ tailwind.config.js
The application integrates with your aflatoxin prediction API:
POST https://model-api-capstone.onrender.com/predict
Content-Type: application/json
{
"moisture_maize_grain": 20,
"Immaturegrains": 6.91,
"Discolored_grains": 4.12,
"broken_kernels_percent_maize_grain": 3.66,
"foreign_matter_percent_maize_grain": 0.13,
"pest_damaged": 7.82,
"rotten": 2.4,
"Liveinfestation": 1,
"abnormal_odours_maize_grain": 0
}{
"prediction": "safe",
"confidence": 0.952,
"risk_level": "low",
"recommendations": ["Store in dry conditions", "Monitor regularly"]
}- Primary: Blue (#2563eb) - Trust, reliability
- Secondary: Green (#22c55e) - Safety, natural
- Warning: Amber (#f59e0b) - Caution, attention
- Danger: Red (#ef4444) - Risk, alerts
- Font Family: Roboto (300, 400, 500, 700, 900)
- Headings: Bold, clear hierarchy
- Body Text: Readable, accessible contrast
- Cards: Rounded corners, subtle shadows
- Buttons: Multiple variants with loading states
- Forms: Validation, error handling, accessibility
- Navigation: Responsive, role-based menus
- User selects organization type
- Fills personal and company information
- Local storage for session management
- Role-based dashboard access
- Client-side authentication with localStorage
- Role-based access control
- Input validation and sanitization
- API error handling and timeout management
- Secure form handling
- Bulk testing capabilities
- Cost optimization tools
- Quality assurance reports
- Supply chain tracking
- Premium market access features
- Quality certification tools
- Brand protection measures
- Compliance documentation
- Model validation tools
- Data contribution features
- Research collaboration
- Advanced analytics
npm install -g vercel
vercel --prodnpm run build
# Deploy dist folder to Netlifynpm run build
# Upload dist folder to your hosting providerVITE_API_URL=https://your-api-domain.com
VITE_APP_NAME=AflaGuard Pro
VITE_APP_VERSION=1.0.0npm run lint
# or
yarn lintnpm run build
# or
yarn buildnpm run preview
# or
yarn previewnpm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint