Wasm Labs

WordPress in the browser

A WordPress page running entirely in your browser

Get started

Description

WebAssembly brings existing projects to a new level. Our team compiled PHP, SQLite and WordPress to Wasm to run it directly in your browser. Yo ucan navigate articles and even add comments to the different posts.

Website

https://wordpress.wasmlabs.dev

Languages

  • JavaScript
  • PHP

About the project

WordPress is a well-knwon platform to build websites. It powers many websites around the world. As it states in their website, 43% of the web is built with it.

WordPress is written in PHP, a popular language for the web. Even though it was much more popular in the past, it's still actively maintained and used.

Thinking about running an entire WordPress application without a server sounds impossible. You need to have a PHP interpreter in place as well as a database to store the data. In Wasm Labs we wanted to take this challenge and leverage the work by Oraoto and Sean Morris to run a full WordPress application in the browser.

These are the steps we followed:

  • Apply any required patch on PHP to ensure we cover all required features from WordPress
  • Apply some modifications to WordPress so it uses SQLite
  • Compile the PHP interpreter and SQLite to Wasm with Emscripten, one of the first C/C++ to Wasm compiler toolchains
  • Mount all the WordPress codebase using Emscripten filesystem
  • Capture all request events in the browser using a worker. Then, we process the headers (Cookies, Redirects, etc) and send the request to the PHP Wasm module

After overcoming all these challenges, we were able to run WordPress entirely on the browser! You can try it on https://wordpress.wasmlabs.dev

Learn more

To continue learning about running WordPress in the browser, we recommend you to check the following links:

Do you want to stay up to date with WebAssembly and our projects?