Development Setup
Complete guide to setting up your development environment for WPKernel.
🚨 TL;DR - Quick Start
👉 Runbook - Common development tasks and workflows.
For experienced developers who want the critical information fast, read that first. This page has the complete, detailed setup instructions.
Prerequisites
Required Software
Install these tools before proceeding:
Node.js (v22.20.0 LTS)
Use nvm for version management:
# Install nvm (if not already installed)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node 22
nvm install 22.20.0
nvm use 22.20.0
nvm alias default 22.20.0
# Verify
node --version # Should show v22.20.0pnpm (v9.12.3+)
npm install -g pnpm
# Verify
pnpm --version # Should show 9.12.3 or laterDocker Desktop
Download and install from docker.com/products/docker-desktop.
# Verify
docker --version # Should show 20.10+ or laterGit
# macOS (via Homebrew)
brew install git
# Verify
git --versionRepository Setup
Clone and Install
# Clone the repository
git clone https://github.com/wpkernel/wpkernel.git
cd wp-kernel
# Install dependencies (this may take a few minutes)
pnpm installVerify Installation
# Build all packages
pnpm build
# Run lint
pnpm lint
# Expected output: zero errorsWordPress Environment
WPKernel uses @wordpress/env for local WordPress instances.
Two Environments
- Development (localhost:8888) - For manual testing
- Testing (localhost:8889) - For E2E tests with fixtures
Start WordPress
Quick Start (Recommended)
Start WordPress with seed data:
pnpm wp:freshThis command:
- Starts Docker containers
- Seeds test users, applications, and jobs
- Activates the showcase plugin
Manual Start
# Start without seed data
pnpm wp:start
# Seed data separately
pnpm wp:seedAccess WordPress
- Development Site: http://localhost:8888
- Admin Dashboard: http://localhost:8888/wp-admin
- Testing Site: http://localhost:8889
- Credentials:
admin/password
Stop WordPress
pnpm wp:stopReset WordPress
If you need a clean slate:
# Stop and destroy all data
pnpm wp:destroy
# Start fresh
pnpm wp:freshDevelopment Workflow
Terminal Setup
Open three terminal windows/tabs:
Terminal 1: Watch Build
pnpm devThis watches all packages and rebuilds on file changes.
Terminal 2: WordPress
pnpm wp:startKeep WordPress running for manual testing.
Terminal 3: Tests
# Unit tests (watch mode)
pnpm test --watch
# Or run once
pnpm test
# E2E tests (WordPress must be running)
pnpm e2eMaking Changes
Create a branch:
bashgit checkout -b feature/my-featureMake changes: Edit files in
packages/*/src/Verify builds: Watch terminal 1 for build errors
Write tests: Add tests for new functionality
Run tests:
bashpnpm test # Unit tests pnpm e2e # E2E tests pnpm test:coverage # With coverageLint:
bashpnpm lint # Check pnpm lint:fix # Auto-fixUpdate CHANGELOG.md:
Add entry to affected packages' CHANGELOG.md:
markdown## 0.x.0 [Unreleased] ### Added - Custom invalidation support for resourcesCommit:
bashgit add . git commit -m "feat(resources): add custom invalidation"Push and PR:
bashgit push origin feature/my-feature # Open PR on GitHub
Package Structure
packages/
├── kernel/ # Core framework
│ ├── src/
│ │ ├── resource/ # Resources
│ │ ├── actions/ # Actions
│ │ ├── events/ # Events
│ │ └── index.ts
│ └── package.json
├── ui/ # UI components
│ ├── src/
│ └── package.json
├── e2e-utils/ # Test utilities
│ ├── src/
│ └── package.json
└── showcase-plugin/ # Example plugin
├── app/ # Application code
│ ├── resources/
│ ├── actions/
│ ├── views/
│ └── jobs/
└── includes/ # PHP codeEnvironment Variables
CI Flag
Set CI=true to run in CI mode (affects Playwright webServer):
export CI=true
pnpm e2eNode Version
Ensure you're using Node 22:
node --version # Should be v22.20.0If not, use nvm:
nvm use 22IDE Setup
VS Code (Recommended)
Install these extensions:
- ESLint (dbaeumer.vscode-eslint)
- Prettier (esbenp.prettier-vscode)
- TypeScript (ms-vscode.vscode-typescript-next)
- WordPress Snippets (wordpresstoolbox.wordpress-toolbox)
Settings
Create .vscode/settings.json:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.workingDirectories": [{ "pattern": "packages/*" }]
}Troubleshooting
Port Conflicts
If ports 8888 or 8889 are already in use:
# Find what's using the port
lsof -i :8888
# Kill the process
kill -9 <PID>
# Or use different ports (edit .wp-env.json)Docker Issues
# Restart Docker Desktop
# Or reset wp-env
pnpm wp:destroy
pnpm wp:freshBuild Errors
# Clean and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm install
pnpm buildTest Failures
# Reset test environment
pnpm wp:seed:reset
pnpm e2eNext Steps
Now that your environment is set up:
- Runbook - Common development tasks
- Coding Standards - Style guide
- Testing - Writing tests
- Pull Requests - Submitting changes
