This guide walks you through every step required to go from zero to a running WP SSR site. You will install a fresh Bedrock project, configure environment variables, drop in the mu-plugin, boot the Kernel with service providers, register web routes, and finally build the React/Vite frontend. The whole process takes about ten minutes on a local machine with PHP 8.1, Composer, and Node.js already installed.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Ahondev/portfolio-v2/llms.txt
Use this file to discover all available pages before exploring further.
Install Roots Bedrock
Bedrock is the Composer-managed WordPress boilerplate that provides the The resulting directory tree looks like this:
web/app/mu-plugins/ autoloader, vlucas/phpdotenv, and a clean folder structure. Create a new project with:Configure the environment
Copy
.env.example to .env and fill in all required values. WP SSR reads several custom variables at boot time in addition to the standard Bedrock ones:Install the mu-plugin
Copy the Then install the plugin’s PHP dependencies:Your
wp-ssr directory into web/app/mu-plugins/. Bedrock’s autoloader will pick it up automatically — no manual plugin activation required.web/app/mu-plugins/ directory should now look like:ACF Pro must be installed and activated before this step. The Kernel checks for
acf_add_options_page() at construction time and calls wp_die() if it is absent.Boot the Kernel in wp-ssr.php
The plugin bootstrap file (Each provider’s
wp-ssr.php) is the single entry point for the framework. It first boots Roots Acorn for the theme, then calls Kernel::configure() to register all service providers in order:register() method runs first (across all providers), then each boot() method fires in the order the providers are listed. The Kernel also hooks WebRouter::init() onto wp_loaded and ApiRouter::init() onto rest_api_init — you do not need to do this manually.Register web routes
Open The corresponding controller methods call The string passed as the first argument to API routes are mounted under
configuration/routes/web.php. This file is required by WebRouter::init() on every request. Define routes using the Route facade:$this->view() to render a response:$this->view() (e.g. 'home', 'services') becomes window.__wp_view__ in the browser. Your React SPA uses this string to resolve which view component to mount.You can also register API routes in configuration/routes/api.php using the ApiRoute facade:/api/v1/ (rewritten from /wp-json/api/v1/ by AppServiceProvider).Build the React frontend
The React/Vite SPA lives in This writes the compiled bundle and a Vite writes a The
web/client/. Install dependencies and produce a production build:dist/.vite/manifest.json to web/client/dist/. The Vite class in the framework reads this manifest to inject cache-busted <script> and <link> tags into the HTML shell.During development, start the Vite dev server:web/client/public/hot file containing the dev server URL. The framework detects this file and switches to injecting HMR assets automatically — no configuration needed.package.json includes React 19, TanStack Query, React Router DOM, Radix UI primitives, Tailwind CSS v4, and Zod — a complete modern frontend stack ready to use.Visit the site
Navigate to your WordPress install (e.g. If
http://localhost). If everything is configured correctly you will see the React SPA rendered inside the HTML shell produced by src/SSR/client.php.Open the browser developer tools and check the <head> — you should see:window.__wp_view__ is present and matches a view name in your React router, the SPA has successfully booted. The WordPress admin is available at /admin (rewritten from /wp/wp-login.php by AppServiceProvider).