A starter repository for WordPress websites for organisers, campaigns and anyone else who finds it useful.
This folder structure uses the Bedrock pattern, a modern WordPress stack.
- Docker installed
- PHP and Composer installed locally. If not, you can use them in containers provided, prefixing all Composer commands below with
docker compose run composer <command>
- Clone This Repository
- Search and replace all instances of
wordpress-starter-templateandWordpressStarterTemplatewith the name of the new project, in kebab and camel case respectfully. Also rename the theme folderweb/app/themes/wordpress-starter-templateto the name of the new project. - If you have PHP and Composer installed locally you can run from this directory
composer install. Otherwise runcomposer installvia Docker withdocker compose run composer install. - Copy
.env.exampleto.env, runningcp .env.example .env. The example file contains variables required for this Docker Compose setup but modify details appropriately as per the Bedrock documentation as required. - Start up all containers with:
docker compose up
- Build the theme (see Theme), then install WordPress, activate the theme and load the page fixtures in
scripts/fixtures:
scripts/setup.sh http://localhost:8082 "WordPress Starter Template"
- You can access the site at http://localhost:8082, and log in with
admin/admin.
If ports 8082 or 3308 are already in use by another project, set WEB_HOST_PORT and DB_HOST_PORT in .env, and update the port in WP_HOME to match.
Run the smoke test with the site title and URL. Extra path=text arguments check a page contains some text:
scripts/smoke-test.sh "WordPress Starter Template" http://localhost:8082 "/blocks/=wp-block-wordpress-starter-template-example"
CI builds the theme, runs setup.sh and runs the smoke test against a fresh install, then:
scripts/test-plugins.shactivates every plugin and checks the site still works- the browser tests (
npm run test:e2efrom the theme folder, see Theme) load the front end, the block editor and the Site Editor with every plugin active, and fail on JavaScript errors, failed requests, PHP error output and blocks the editor can't load scripts/check-php-log.shfails if PHP logged any errors or warnings along the way
A second job, .github/workflows/production.yml, installs the site the way deploy.yml deploys it: Composer without dev packages, the production theme build, WP_ENV=production and every plugin active, including Wordfence. It then runs the plugin, smoke, browser and PHP log checks against that.
These cover what a dependency bump can break, so a Renovate pull request that passes CI can be merged with confidence. See What CI checks for dependency updates.
The theme in web/app/themes/wordpress-starter-template is built with webpack, TypeScript, Sass and PostCSS, and needs Node 24 (see .nvmrc). From the theme folder:
npm ciinstalls dependenciesnpm run devstarts the webpack dev server on port 9000, which the theme loads assets from whenWP_ENVisdevelopment. It also writes tobuild/, where blocks load their scripts and styles from.npm run buildbuilds assets tobuild/for other environmentsnpm run typechecktype-checks with TypeScript 7npm testbuilds the theme into temporary folders and checks the output: every file eachblock.jsonloads, WordPress packages left to WordPress, and TypeScript, Sass and PostCSS compiled as configurednpm run test:e2eruns the browser tests against the site atSITE_URL(defaulthttp://localhost:8082), starting the dev server if it isn't running. SetE2E_DEV_SERVER=falsefor a site that isn't in development, which loads the production build instead. Runnpx playwright install chromiumonce first. They log in asadmin/admin, so run them against the local site afterscripts/setup.sh.npm run lintchecks lint and formatting with ESLint and Prettier, as CI does, andnpm run lint:fixfixes what it can
TypeScript 7 does not yet have a compiler API, which ts-loader and typescript-eslint need. As recommended in the TypeScript 7 release notes, the typescript package is aliased to @typescript/typescript6 for those tools, and TypeScript 7 is installed as @typescript/native, which provides tsc. Once TypeScript 7.1 ships an API and those tools support it, the alias can be removed.
Each custom block is a folder in blocks/. Copy blocks/example to start one:
block.jsondefines the block and points at its built files inbuild/blocks/<name>/index.tsxis the editor script, written in TypeScript and JSXrender.phprenders the block on the serverstyle.scssstyles the block on the front end and in the editorview.ts(optional) is front-end JavaScript, loaded throughviewScriptinblock.json
webpack builds and functions.php registers every block folder automatically. @wordpress/* and React imports use WordPress's own copies at runtime. Add new blocks to scripts/fixtures/blocks.html so they show at /blocks/ and are covered by CI. See CLAUDE.md for theme conventions.
This template comes with some useful development tools for use within WordPress itself.
Crucial. Save off block themes that you are making in the full site editor to the theme on disk. Add fonts direct from the WordPress backend, including Google Fonts.
Create WordPress patterns from within the WordPress backend. They are automatically saved to the theme on disk, with appropriate metadata and can also be modified in this way.
Generate a lot of dummy content to see how the website looks and feels with full content in it.
Again for creating dummy data, this allows quick duplication of posts to fill things out.
Renovate opens pull requests for Composer, npm, Docker and GitHub Actions updates. Each kind is covered by these checks:
| Update | Checked by |
|---|---|
WordPress (roots/wordpress) |
Smoke test, browser tests of the front end, block editor and Site Editor, PHP log, in development and production |
Plugins (wp-plugin/*) |
test-plugins.sh, browser tests with every plugin active, PHP log. Wordfence only runs in the production job, as development turns it off |
PHP libraries (vlucas/phpdotenv, roots/wp-config, …) |
Smoke test, browser tests, PHP log |
| Pest, Pint | The CI workflow runs them |
Build tools (webpack and its loaders and plugins, Sass, PostCSS, postcss-preset-env, ts-loader) |
npm test, browser tests |
| webpack-dev-server | Browser tests, which load theme assets from it |
| TypeScript, React and type packages | npm run typecheck, build, browser tests |
| ESLint, typescript-eslint and their plugins | npm run lint (also checks formatting with Prettier) |
| Docker images, GitHub Actions | The workflows themselves |
- Run
composer outdatedto verify any dependencies that require updating. - Run
composer bumpto bump minor versions and save results tocomposer.json. - Update within
composer.json. For example thewordpresspackage. - Run
composer update. - Commit the result.
WP-CLI is installed in the wordpress container.
docker compose run wordpress wp <command>
Note WP-CLI will not work on the host machine, as WordPress configuration refers to databases within the Docker network, not the host machine.
Run docker compose run composer require wp-plugin/plugin-name.
Documentation for Bedrock is available at https://roots.io/bedrock/docs/.
The following are instructions on how to setup a new site on Kinsta.
You will need to have "Company developer" or above permissions in order to create a site.
These are exhaustive manual instructions, but should not be required after initial setup.
- Log in to your Kinsta account and create a new site.
- Select “Don’t install WordPress” and choose the London data center.
- The provisioning process will take about 10 minutes.
Once the site is created, you will have both Live and Staging environments. Start with the Live environment, and you can later create a Staging environment as needed.
You will use the same SSH key to connect to Kinsta and pull from GitHub.
-
Generate an SSH Key Pair (if you don’t already have one)
-
On your local machine, generate a new SSH key pair:
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"This will create two files: id_rsa (private key) and id_rsa.pub (public key).
- In Kinsta, navigate to Sites > Live Environment > Info.
- Under SSH Access, click “Add SSH Key” and paste the contents of the id_rsa.pub file.
- Go to your GitHub profile > Settings > SSH and GPG keys.
- Click New SSH key, paste the contents of the id_rsa.pub file, and save it.
You need to set up SSH forwarding so that you can connect to Kinsta and GitHub using the same key.
-
Open or create the ~/.ssh/config file and add the following block:
Host <your_site>_live User <Kinsta SSH username from Live Environment> Hostname <Kinsta SSH hostname> Port <Kinsta SSH port> IdentityFile <path_to_your_private_key> ForwardAgent yes -
Replace the placeholders (<your_site>, , , , <path_to_your_private_key>) with the actual details from the SFTP/SSH section of your Live Environment in Kinsta’s dashboard.
-
Start the SSH agent and add your GitHub SSH key:
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa
-
SSH into the Live environment with the following command:
ssh <your_site>_live -
Test the GitHub SSH connection by running:
ssh -T git@github.com
After accepting the host authenticity, you should see a confirmation message from GitHub.
-
Remove the Existing public Directory Once logged into the Live environment, remove the default public directory:
rm -r public -
Clone Your WordPress Theme from GitHub
git clone git@github.com:<your_repo>.git public -
Install Dependencies with Composer Navigate to the public directory and install the dependencies:
cd public composer install --no-dev -
Set Up the .env File Copy the .env.example file to .env:
cp .env.example .envModify the .env file as per the Bedrock documentation. Update the database and other environment details You can find database credentials in the Kinsta dashboard under Database Access. Set the WP_HOME to http://localhost.
-
Install WordPress
Run the following command to install WordPress and create the necessary database tables:
wp core install --url=<Kinsta Primary Domain URL> --title=<Site Title> --admin_user=<Admin Username> --admin_email=<Admin Email>This command will output the password for the new admin user. Save this password for later.
-
Ask Kinsta support (via Intercom chat) to update the NGINX configuration to point to public/web.
-
Follow Kinsta’s guide to point your domain to the Kinsta environment.
-
Set Up SSL and Force HTTPS
• Go to the Tools section in the Kinsta dashboard for the live environment.
• Generate a new Let’s Encrypt SSL certificate.
• Enable Force HTTPS by selecting “Force all traffic to the primary domain”.
-
In the Kinsta Domains section, make sure your primary domain is selected and marked as primary.
-
You can use the same SSH key you generated for both Kinsta and this repository's GitHub Actions deploy workflow.
-
Ensure the public key (id_rsa.pub) has been added to the SSH Access section for the Live environment in the Kinsta dashboard (as shown in the previous steps).
-
Add the SSH Key as a Secret in GitHub
• In your repository, go to Settings > Secrets and variables > Actions.
• Click New repository secret and create the following secrets:
• SSH_PRIVATE_KEY: Paste the contents of your id_rsa (private key).
• SSH_USER_HOST: Enter the username and hostname from Kinsta’s SFTP/SSH details
• SSH_PORT: Enter the SSH port number from Kinsta’s SFTP/SSH details