A comprehensive farm inventory management system built with PHP and MySQL. Features dual-portal architecture for seamless collaboration between farmers and administrators.
- Overview
- Features
- Tech Stack
- Architecture
- Installation
- Configuration
- Usage
- Project Structure
- Contributing
AgriTrack is a full-stack web application designed to streamline farm inventory management operations. The system provides separate, secure portals for farmers and administrators, enabling efficient product tracking, stock management, and comprehensive reporting.
Key Highlights:
- π Role-based access control with separate authentication systems
- π Real-time analytics and reporting dashboards
- π· Product image upload and management
- π Advanced search and filtering capabilities
- π± Responsive, modern UI design
- Dashboard: Overview of inventory statistics, recent activities, and quick actions
- Inventory Management: Full CRUD operations for products with image uploads and thumbnails
- Stock Control: Quick stock management with visual indicators and alerts
- Reports: Comprehensive reports with category breakdowns, status filters, and export capabilities
- Profile Settings: Secure account management and profile customization
- Admin Dashboard: Platform-wide metrics, farmer statistics, and system overview
- Farmer Management: Complete user administration with search, sort, edit, and delete capabilities
- Global Inventory View: System-wide product inventory with advanced filtering options
- Platform Reports: Analytics across all farmers, top performers, and alert management
- Access Control: Secure admin authentication and session management
- Backend: PHP 8+ with PDO for database interactions
- Database: MySQL 8.0+ with InnoDB engine
- Frontend: HTML5, CSS3 (custom styling), Vanilla JavaScript
- Server: XAMPP / Apache with MySQL
- File Storage: Local filesystem for product images
The application follows a modular architecture with clear separation of concerns:
- MVC-inspired structure: Organized codebase with logical separation
- Dual-portal system: Independent authentication and routing for farmers and admins
- Session-based security: Secure login/logout with cache control headers
- Database abstraction: PDO-based data access layer
- Reusable components: Shared CSS and PHP includes for maintainability
- XAMPP (or similar PHP/MySQL stack)
- PHP 8.0 or higher
- MySQL 8.0 or higher
- Web browser (Chrome, Firefox, Safari, or Edge)
-
Clone the repository
git clone https://github.com/dianaangan/AgriTrack.git cd AgriTrack -
Set up the database
- Open
config/database.phpand update your MySQL credentials:$host = 'localhost'; $dbname = 'your_database_name'; $username = 'your_username'; $password = 'your_password';
- Open
-
Initialize the database
- The database tables will be created automatically when you first register a farmer or admin
- Make sure your database exists and the connection settings in
config/database.phpare correct
-
Create upload directory
mkdir -p uploads/products
Ensure the directory has write permissions for the web server.
-
Start the server
- Launch XAMPP and start Apache and MySQL services
- Access the application at
http://localhost/AgriTrack/farmer/landing.php
The system automatically creates a default admin account on first initialization:
- Email:
admin@agritrack.com - Password:
admin123
To create a custom admin account, execute this SQL query:
INSERT INTO admins (firstName, lastName, email, password)
VALUES ('Your', 'Name', 'admin@example.com', PASSWORD('your_secure_password'));Then log in at http://localhost/AgriTrack/admin/admin_login.php.
- Register a new account at the farmer landing page
- Log in to access your dashboard
- Add products to your inventory with images
- Track stock levels and update as needed
- Generate reports to analyze your inventory
- Log in using the admin portal
- View platform-wide statistics and metrics
- Manage farmer accounts (edit, delete, search)
- Monitor global inventory across all farmers
- Access comprehensive platform reports
AgriTrack/
βββ admin/ # Admin portal pages
β βββ admin_dashboard.php
β βββ admin_farmers.php
β βββ admin_inventory.php
β βββ admin_login.php
β βββ ...
βββ farmer/ # Farmer portal pages
β βββ landing.php
β βββ login.php
β βββ home.php
β βββ inventory.php
β βββ ...
βββ css/ # Shared stylesheets
β βββ home.css
β βββ inventory.css
β βββ admin.css
β βββ ...
βββ includes/ # Reusable PHP functions
β βββ database.php
β βββ farmer_functions.php
β βββ admin_functions.php
β βββ inventory_functions.php
βββ config/ # Configuration files
β βββ database.php # Database connection & schema
βββ uploads/ # Product images storage
β βββ products/
βββ index.php # Root redirect
βββ README.md
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Make your changes and test thoroughly
- Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Test all changes in both farmer and admin portals
- Maintain code consistency with existing style
- Include screenshots for UI-related changes
- Update documentation for new features
- Ensure backward compatibility
-
Image Storage: Product images are stored in
uploads/products/directory. Only file paths are stored in the database. Make sure to include this directory in your backups. -
Cache Control: The application implements cache-busting mechanisms (
?v=2) for assets to ensure proper updates across portals. -
Security: Always change default passwords and review security settings before deploying to production.
-
Browser Compatibility: Tested on modern browsers (Chrome, Firefox, Safari, Edge).
This project is open source and available under the MIT License.
Diana Angan
- GitHub: @dianaangan
- Built with modern PHP best practices
- Inspired by clean, minimalist UI design principles
- Created for efficient farm inventory management
β Star this repository if you find it helpful!