A framework to build frontend apps on WordPress with routing, admin bar integration, and theme isolation.
Why? · Quick Start · Examples · WP Apps Site · Documentation · Manual Installation · Requirements
Scaffold a new plugin with one command:
composer create-project akirk/create-wp-app my-appWhich gives you this little wizard:
Creating WpApp plugin: my-app
----------------------------------------
Plugin name [My App]:
Namespace [MyApp]:
Author name []:
URL path [my-app]:
Setup type:
[m] Minimal - simple WpApp setup
[f] Full - with BaseApp structure
Choose [f]:
✓ Updated plugin-name.php
✓ Updated templates/index.php
✓ Updated src/App.php
✓ Renamed plugin-name.php to my-app.php
✓ Created .gitignore
✓ Updated composer.json
✓ Regenerated autoloader
✓ Updated README.md
✓ Cleaned up setup scripts
Done! Your plugin is ready.
Next steps:
Option A: Run locally with WordPress Playground
npx @wp-playground/cli@latest server --auto-mount=my-app --login
Option B: Install in WordPress
1. Move this folder to wp-content/plugins/
2. Activate the plugin in WordPress
3. Visit /my-app/ to see your app
Which gives you something like this:
Visit wpapps.kirk.at for a visual introduction to the WP Apps concept and a catalog of apps you can run on your own WordPress, including a travel app, a cookbook, and a family wiki.
The examples are available in the wp-app-examples repository. Try them instantly in your browser with WordPress Playground:
- Minimal App - The simplest possible WpApp
- Community App - Full-featured example with database, REST API, and admin integration
WordPress isn't just for blogs. It's a powerful foundation for web applications.
For developers:
- Built-in User Management - Authentication, roles, and permissions out of the box
- Admin Interface - Professional backend without building from scratch
- Security & Updates - Automatic security patches and proven practices
- Global Ready - Built-in i18n and multisite support
For users:
- Universal Hosting - Deploy anywhere WordPress runs, from shared hosting to cloud
- Familiar Environment - Manage your app alongside your existing WordPress site
- URL Routing - Pattern-based routing with WordPress rewrite rules
- Theme Isolation - Clean HTML output separate from your WordPress theme
- Admin Bar Integration - WordPress-style navigation for your app
- Admin Color Scheme Tokens - CSS variables from each user's WordPress admin color profile
- Access Control - WordPress capability-based authentication
- Offline PWA Support - App-scoped manifests and service workers for installable apps
- BaseApp Pattern - Structured architecture for complex applications
- BaseStorage Pattern - Database abstraction with schema management using
dbDelta
Run your plugin locally without a full WordPress installation:
npx @wp-playground/cli@latest server --auto-mount --loginThis starts a local WordPress instance with your plugin mounted and activated.
| Topic | Description |
|---|---|
| Getting Started | Installation, quick start, template functions |
| Configuration | All configuration options |
| Routing | URL patterns, parameters, templates |
| Masterbar | Admin bar customization |
| Access Control | Capabilities, roles, permissions |
| Offline PWA Support | Installable apps, manifests, service workers, and offline caching |
| BaseApp Pattern | Structured architecture for larger apps |
| Client-Side Encryption | Browser encryption runtime and encrypted-field app pattern |
| Abilities | Exposing your app to assistants, automation and other apps — and designing abilities worth calling |
| Tutorial | Step-by-step guide from minimal to full-featured |
Get AI assistance for WpApp development in Claude Code:
/plugin marketplace add akirk/wp-app
/plugin install wpapp@wp-appSee the minimal-app example — the simplest possible WpApp (3 lines of code).
See the community-app example — a full BaseApp pattern demonstration with:
- BaseStorage with schema management
- User progress tracking
- REST API endpoints
- Admin integration
composer require akirk/wp-appThe simplest possible WpApp requires just 3 lines:
<?php
/**
* Plugin Name: Minimal App
*/
require_once __DIR__ . '/vendor/autoload.php';
use WpApp\WpApp;
$app = new WpApp( __DIR__ . '/templates', 'minimal' );
$app->init();Create templates/index.php:
<!DOCTYPE html>
<html <?php wp_app_language_attributes(); ?>>
<head>
<title><?php wp_app_the_title( 'My App' ); ?></title>
<?php wp_app_head(); ?>
</head>
<body>
<?php wp_app_body_open(); ?>
<h1>Welcome to My App!</h1>
<?php wp_app_body_close(); ?>
</body>
</html>Your app is now available at /minimal!
When wp_app_enqueue_style(), wp_app_enqueue_script(), wp_app_add_inline_style(), or wp_app_add_inline_script() receive an app scope, the asset is attached to that app's scoped hook. This prevents assets from one WpApp from printing in another WpApp.
You can also pass an explicit app scope when registering assets before render time:
wp_app_enqueue_script( 'minimal-app', $script_url, [], '1.0.0', true, [ 'app' => 'minimal' ] );Use [ 'app' => 'global' ] for framework-level assets that should print for every WpApp.
Keep CSS and JavaScript in asset files and load them with the scoped enqueue helpers. Avoid writing inline <style> or <script> blocks, style attributes, and event-handler attributes in templates. For dynamic values, use HTML data attributes that an external script can read.
Apps and add-on plugins register themes with their own template directories on
the app-specific initialization filter. This runs on WordPress init, when it
is safe to translate the theme name:
add_filter(
'wp_app_init_minimal',
function ( $app ) {
$app->register_theme(
'compact',
__( 'Compact', 'my-plugin' ),
plugin_dir_path( __FILE__ ) . 'templates/compact'
);
return $app;
}
);WpApp adds a Themes submenu to the app's masterbar and remembers the current user's selection. The selected theme's templates take priority, while missing templates fall back to the app's regular template directory. See App Themes for add-on registration and theme-specific asset hooks.
- PHP 7.4 or higher
- WordPress 5.0 or higher
Run the test suite and WordPress coding standards checks:
composer test
composer phpcsGPL-2.0-or-later