grocery-website

Grocery Website

A website to demonstrate e-commerce for a Grocery Store, built with plain PHP and MySQL (Bootstrap 3 / jQuery front end, no framework or build step for the PHP code).

Prerequisites

Setup

  1. Clone the repository and serve the project root, e.g. with PHP’s built-in server:
    php -S localhost:8000
    
  2. Create the database schema by importing grocery.sql into MySQL. This drops and recreates the grocery database with the customer, product_details, cart, and address_details tables.
  3. Copy php/config.example.php to php/config.php and fill in real values:
    • DB_HOST / DB_USER / DB_PASSWORD / DB_NAME — your local MySQL connection.
    • SENDGRID_API_KEY — used by the contact form (php/mail.php).
    • RECAPTCHA_SECRET — a Google reCAPTCHA v2 secret key, used by registration and checkout.
    • ADMIN_PASSWORD_HASH — the password for /admin, generated with:
      php -r "echo password_hash('yourpassword', PASSWORD_DEFAULT);"
      

      php/config.php is gitignored — never commit real secrets to this file’s tracked counterpart.

  4. Product data can be bulk-loaded from the admin panel (/admin, login required) via CSV upload — see product_details.csv for the expected format.

License

MIT — see LICENSE.