Contributing
Thank you for your interest in contributing to ProductBay! This guide will help you set up a local development environment.
Prerequisites
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 18+ | JavaScript runtime |
| Bun | Latest | Package manager & script runner |
| Composer | 2+ | PHP dependency manager |
| PHP | 7.4+ (8.0+ recommended) | Backend language |
| WordPress | 6.0+ | CMS platform |
| WooCommerce | 6.1+ | E-commerce dependency |
You'll also need a local WordPress development environment such as XAMPP, LAMP, LocalWP, or similar.
Setup
1. Clone the Repository
cd wp-content/plugins
git clone https://github.com/forhadkhan/productbay.git
cd productbay2. Install Dependencies
Install JavaScript dependencies:
bun installInstall PHP dependencies:
composer install3. Configure Environment
Copy the example environment file:
cp .env.example .envEdit .env and set the appropriate values for your local setup.
4. Start Development
bun startThis runs both Webpack (for JS/TS compilation) and Tailwind CLI (for CSS) in parallel watch mode. Changes hot-reload automatically.
5. Build for Production
bun run buildThis creates optimized, minified assets in the assets/ directory.
Project Structure
productbay/
├── app/ # PHP backend (Admin, Api, Core, Data, Frontend, Http)
├── src/ # React/TypeScript frontend source
├── assets/ # Compiled JS/CSS output
├── languages/ # Translation files
├── scripts/ # Build helper scripts
├── docs/ # This documentation site (VitePress)
├── vendor/ # Composer dependencies
└── node_modules/ # JavaScript dependenciesCoding Standards
PHP
- Follow WordPress PHP Coding Standards
- Run PHPCS:
./vendor/bin/phpcs - Use
snake_casefor functions/variables,PascalCasefor classes - Add PHPDoc blocks to all classes and methods
- Sanitize all inputs, escape all outputs
JavaScript / TypeScript
- TypeScript strict mode (ES2020)
- Use
@wordpress/i18nfor translatable strings - Path alias:
@/*→src/* - Use CVA + clsx + tailwind-merge for dynamic class names
CSS
- Tailwind CSS v4 with utility-first approach
- All styles scoped to
#productbay-root - Frontend table classes prefixed with
productbay-
Internationalization (i18n)
All user-facing strings must be translatable:
PHP:
__( 'Text', 'productbay' ) // Return translated string
_e( 'Text', 'productbay' ) // Echo translated stringReact/TypeScript:
import { __ } from '@wordpress/i18n';
const label = __( 'Text', 'productbay' );Generate translation files:
bun run i18n:make-pot # Extract strings to .pot
bun run i18n:make-json # Convert .po to .json for ReactReporting Issues
Found a bug or have a suggestion? Please open an issue on the GitHub Issue Tracker.
When reporting, include:
- A clear description of the problem
- Steps to reproduce
- Screenshots or error logs (if applicable)
- Your WordPress, WooCommerce, and PHP versions