Skip to content

🌾 Simple farm inventory management system built with PHP & MySQL. Admin and farmer portals for tracking products and generating reports.

Notifications You must be signed in to change notification settings

dianaangan/AgriTrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AgriTrack 🌾

A comprehensive farm inventory management system built with PHP and MySQL. Features dual-portal architecture for seamless collaboration between farmers and administrators.

PHP MySQL License


πŸ“‹ Table of Contents

🎯 Overview

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

✨ Features

πŸ‘¨β€πŸŒΎ Farmer Portal

  • 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 Portal

  • 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

πŸ› οΈ Tech Stack

  • 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

πŸ—οΈ Architecture

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

πŸ“¦ Installation

Prerequisites

  • XAMPP (or similar PHP/MySQL stack)
  • PHP 8.0 or higher
  • MySQL 8.0 or higher
  • Web browser (Chrome, Firefox, Safari, or Edge)

Step-by-Step Setup

  1. Clone the repository

    git clone https://github.com/dianaangan/AgriTrack.git
    cd AgriTrack
  2. Set up the database

    • Open config/database.php and update your MySQL credentials:
      $host = 'localhost';
      $dbname = 'your_database_name';
      $username = 'your_username';
      $password = 'your_password';
  3. 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.php are correct
  4. Create upload directory

    mkdir -p uploads/products

    Ensure the directory has write permissions for the web server.

  5. Start the server

    • Launch XAMPP and start Apache and MySQL services
    • Access the application at http://localhost/AgriTrack/farmer/landing.php

βš™οΈ Configuration

Default Admin Account

The system automatically creates a default admin account on first initialization:

  • Email: admin@agritrack.com
  • Password: admin123

⚠️ Important: Change the default password immediately in a production environment.

Custom Admin Account

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.

πŸš€ Usage

For Farmers

  1. Register a new account at the farmer landing page
  2. Log in to access your dashboard
  3. Add products to your inventory with images
  4. Track stock levels and update as needed
  5. Generate reports to analyze your inventory

For Administrators

  1. Log in using the admin portal
  2. View platform-wide statistics and metrics
  3. Manage farmer accounts (edit, delete, search)
  4. Monitor global inventory across all farmers
  5. Access comprehensive platform reports

πŸ“ Project Structure

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

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Make your changes and test thoroughly
  4. Commit your changes (git commit -m 'Add some AmazingFeature')
  5. Push to the branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

Development Guidelines

  • 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

πŸ“ Notes

  • 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).

πŸ“„ License

This project is open source and available under the MIT License.

πŸ‘€ Author

Diana Angan

πŸ™ Acknowledgments

  • 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!

About

🌾 Simple farm inventory management system built with PHP & MySQL. Admin and farmer portals for tracking products and generating reports.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published