Skip to content

Latest commit

 

History

46 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ Barí — WordPress Project Framework

Barí is a self-contained, opinionated WordPress development framework built around Docker. It provides a fully controlled, reproducible local and production-ready WordPress stack designed for teams that want to build WordPress sites without depending on centralised SaaS infrastructure. It is intended as a white-label base for corporate and client WordPress projects.

What it is

Barí combines a Docker-based infrastructure layer with a custom WordPress theme and a shell script CLI that abstracts all container operations behind simple proxy commands. The result is a consistent, version-controlled environment where every developer on a team runs the same stack with one command.

The stack consists of:

  • Nginx — Reverse proxy with HTTPS, URL rewriting for the isolated WordPress core directory, and a transparent production uploads proxy for local development
  • PHP-FPM — A custom-built WordPress image with WP-CLI, Composer, Xdebug, Redis, and image processing extensions pre-installed
  • MariaDB — The relational database, fully configured via environment variables
  • Redis — Available for object caching
  • Mailpit — Captures all outgoing email and provides a web UI, preventing any email from reaching real inboxes during development

All configuration — database credentials, WordPress constants, SMTP, memory limits, debug flags — is injected via a .env file. There is no hardcoded configuration in the codebase.

How it's structured

bari/
├── app/          → WordPress application (plugins, themes, content)
├── bin/          → CLI proxy scripts (composer, wp, install, certs, version…)
├── config/       → Infrastructure config (Dockerfile, Nginx, PHP, Webpack)
├── src/          → Frontend source (JS + SCSS, compiled into app/dist/)
├── compose.yml   → Docker service orchestration
└── sample.env    → Environment variable template

WordPress core lives in app/wp/ — isolated from app/web/ (the content directory) following a Bedrock-like pattern. Nginx rewrites all wp-admin, wp-includes, and wp-*.php paths to /wp/. This keeps core upgrades clean and keeps content directories outside of the core directory.

PHP dependencies (plugins, themes) are managed via Composer + WPackagist. No manual plugin downloads. Premium plugins can be served from a private Satispress instance configured in .env.

The theme

The custom theme (app/web/themes/theme/) is a Gutenberg-native theme built around block templates, template parts, theme.json, style variations, and a hook-based OOP setup under the App\ namespace. WordPress block templates own the page shell; Gutenberg block content renders through WordPress's normal do_blocks() flow.

The block editor is configured via theme.json, which defines the controlled design system: colour palette, typography, spacing/layout settings, block styles, and style variation foundations. Editors work within these constraints rather than through ad hoc theme templates.

Timber/Twig is installed globally through Composer for compatibility and for custom plugins that need server-side-rendered views. It should not be treated as the primary theme rendering architecture.


The CLI

Every day-to-day operation has a shell script in bin/ that proxies transparently into the correct Docker container:

./bin/install         # Full environment provisioning from scratch
./bin/start           # Start the stack (after initial install)
./bin/wp plugin list  # Run WP-CLI commands
./bin/composer install  # Run Composer
./bin/certs           # Regenerate SSL certs
./bin/version 7.0     # Install a specific WordPress core version

Frontend assets are built directly from the project root using pnpm (no bin/ wrapper):

pnpm start   # Development — watch mode with source maps
pnpm build   # Production — minified, optimised, no source maps

Compiled assets are written to app/dist/ and enqueued by the theme automatically.


The bari-cli Plugin

The app/web/plugins/bari-cli/ plugin ships two WP-CLI command groups that are available via ./bin/wp:

wp migration — Database Migration Engine

./bin/wp migration create "create orders table"
./bin/wp migration migrate
./bin/wp migration rollback
./bin/wp migration status

Migration files live in app/web/plugins/bari-cli/migrations/ by default and extend AbstractMigration with up() and down() methods. See documentation/06-php-wordpress.md for full details.

wp pattern — Gutenberg Block Pattern Management

./bin/wp pattern create sections/hero
./bin/wp pattern export 42 sections/hero --title="Hero – Full Width"
./bin/wp pattern list

Patterns are stored in app/web/themes/theme/app/Patterns/ and auto-registered by the theme. See documentation/06-php-wordpress.md for full details.


Full Documentation

Detailed documentation for each layer of the project is in the docs/ directory:

Document Contents
documentation/01-architecture.md Full directory map and architectural decisions
documentation/02-infrastructure.md Docker services, Dockerfile, Nginx, PHP config
documentation/03-environment.md Complete .env variable reference
documentation/04-quick-start.md Step-by-step setup guide
documentation/05-cli-scripts.md All bin/ scripts documented
documentation/06-php-wordpress.md Composer setup, plugin dependencies, core isolation, bari-cli
documentation/07-theme.md Gutenberg-native theme architecture, block templates, hook classes
documentation/08-frontend-build.md Webpack, SCSS structure, design tokens
documentation/09-known-issues.md Resolved issues log

Quick Start

cp sample.env .env          # Configure your environment
# Edit .env: set SITE_NAME, HOST_NAME, APP_DOMAINS, admin credentials
./bin/install               # Provisions the full stack

License

GPL-2.0-or-later. Free to use, modify, redistribute, and package as a white-label foundation for client projects.

About

The Bari framework

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages