A complete web-based grocery store management system built with PHP, MySQL, HTML, CSS, and JavaScript. Features inventory management, customer tracking, order processing, and sales reporting.
- Features
- Technology Stack
- Installation
- Database Schema
- API Endpoints
- Usage
- Project Structure
- Screenshots
- Contributing
- License
- User registration and login
- Password hashing with bcrypt
- Session management
- User role management
- Add, edit, delete products
- Stock quantity tracking
- Product categorization
- Low stock alerts
- Customer profiles
- Purchase history
- Contact information
- Order tracking
- Shopping cart functionality
- Order creation and management
- Invoice generation
- Sales reporting
- Sales reports
- Inventory reports
- Customer analytics
- Revenue tracking
Frontend:
- HTML5
- CSS3 (with Bootstrap 5)
- JavaScript (ES6+)
- Font Awesome Icons
Backend:
- PHP 8.0+
- MySQL 8.0
- RESTful API Architecture
Security:
- Prepared statements (SQL injection prevention)
- Password hashing
- Input sanitization
- CSRF protection
- XAMPP/WAMP/LAMP stack
- PHP 8.0 or higher
- MySQL 8.0 or higher
- Web browser with JavaScript enabled
-
Clone the Repository
git clone https://github.com/yourusername/grocery-store-management.git cd grocery-store-management -
Setup Database
# Import database schema mysql -u root -p grocery_store < database/schema.sql
-
Configure Database Connection Edit
config/database.php:define('DB_HOST', 'localhost'); define('DB_USER', 'your_username'); define('DB_PASS', 'your_password'); define('DB_NAME', 'grocery_store');
-
Start Server
# Using XAMPP/WAMP: # Start Apache and MySQL services # Or using PHP built-in server: php -S localhost:8000
-
Access Application Open browser and navigate to:
http://localhost/grocery-store-management/
erDiagram
CUSTOMERS ||--o{ ORDERS : "places"
ORDERS ||--|{ ORDER_ITEMS : "contains"
PRODUCTS ||--o{ ORDER_ITEMS : "includes"
CATEGORIES ||--o{ PRODUCTS : "categorizes"
USERS ||--o{ SESSIONS : "has"
CUSTOMERS {
int customer_id PK
varchar name
varchar email UK
varchar phone
text address
}
PRODUCTS {
int product_id PK
varchar name
text description
decimal price
int quantity
int category_id FK
}
- users: User authentication (
user_id,username,password_hash,email) - products: Inventory management (
product_id,name,price,quantity) - customers: Customer data (
customer_id,name,email,phone) - orders: Order records (
order_id,customer_id,total_amount,status) - order_items: Order details (
order_item_id,order_id,product_id,quantity)
- Navigate to login page
- Use default credentials:
- Username:
admin - Password:
admin123
- Username:
- Change password after first login
- Go to Products section
- Click "Add Product" to add new items
- Use edit/delete buttons for management
- Set stock quantities and prices
- Select customer from database
- Add products to cart
- Set quantities
- Complete checkout process
- Generate invoice
- Navigate to Reports section
- Select report type (Sales, Inventory, Customers)
- Set date range filters
- Export reports as needed
grocery-store-management/
βββ index.php # Main dashboard
βββ config/
β βββ database.php # Database configuration
βββ api/ # REST API endpoints
β βββ products.php
β βββ customers.php
β βββ orders.php
β βββ auth.php
βββ includes/ # PHP classes and functions
β βββ Database.php
β βββ Product.php
β βββ Customer.php
β βββ Order.php
βββ css/ # Stylesheets
β βββ style.css
β βββ bootstrap.min.css
βββ js/ # JavaScript files
β βββ script.js
βββ database/ # Database schema and seeds
β βββ schema.sql
β βββ sample_data.sql
βββ images/ # Product images and assets
βββ products/
# Install PHP dependencies (if any)
composer install
# Set up development environment
cp config/database.example.php config/database.php
# Run tests
phpunit tests/- Bootstrap for responsive UI components
- Font Awesome for icons
- PHP community for excellent documentation
- MySQL for robust database management
- Download from https://www.apachefriends.org
- Install with these components:
- β Apache
- β MySQL
- β PHP
- β phpMyAdmin
- Open XAMPP Control Panel
- Start Apache and MySQL
- Download project files
- Extract to:
C:\xampp\htdocs\grocery_store\
- Go to
http://localhost/phpmyadmin/ - Create database:
grocery_store - Import
database/schema.sql
- URL:
http://localhost/grocery_store/ - Login: admin / admin123
- π¦ Product Management
- π₯ Customer Management
- π Order Processing
- π Sales Reports