An open API service indexing awesome lists of open source software.

https://github.com/reandimo/wordpress-vite-boilerplate

Wordpress + Vite Stack for Development
https://github.com/reandimo/wordpress-vite-boilerplate

acf acf-blocks bedrock ftp ftp-sync woocommerce wordpress wordpress-bedrock

Last synced: 17 days ago
JSON representation

Wordpress + Vite Stack for Development

Awesome Lists containing this project

README

          


WordPress
Vite
Docker

WordPress Vite Boilerplate


Bedrock + Docker + Vite + Block Theme (FSE)

Interactive setup, ACF Blocks v3, TypeScript, SCSS, and remote sync via SSH/FTP.


PHP
TypeScript
SCSS
License


Quick Start ยท
Dev Modes ยท
Setup Guide ยท
Theme Dev ยท
ACF Blocks

---

## The Problem

```
๐Ÿ˜ฉ Classic WordPress โœจ With This Boilerplate
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Edit via FTP or cPanel editor Edit locally, auto-sync to server
No HMR, manual browser refresh Vite HMR โ€” instant CSS/JS updates
Vanilla CSS / jQuery spaghetti TypeScript + SCSS + BEM
No version control structure Bedrock + Docker + Composer
"Works on my machine" Same stack everywhere
Create blocks with copy-paste PHP ACF Blocks v3 with field groups
```

Think **`shopify theme dev`**, but for WordPress.

---

## ๐Ÿ“ฆ Requirements

- [Node.js](http://nodejs.org/) >= 18
- [Git](https://git-scm.com/) (includes Git Bash on Windows)

Everything else is checked automatically by the setup script.

---

## ๐Ÿš€ Quick Start

```bash
# Clone
git clone https://github.com/reandimo/wordpress-vite-boilerplate.git my-project
cd my-project

# Run the interactive setup
node setup.js

# Follow the on-screen instructions โœจ
```

The setup script detects your OS, asks for your preferences, checks dependencies, and configures everything. See the [Setup Guide](docs/setup-guide.md) for details.

---

## ๐Ÿ”€ Dev Modes

The setup wizard lets you choose how you want to develop:

```
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ โ”‚
โ”‚ ๐Ÿณ docker Full local stack โ”‚
โ”‚ PHP, Nginx, MariaDB, MailHog, phpMyAdmin โ”‚
โ”‚ โ”‚
โ”‚ ๐Ÿ”„ remote-sync Edit locally, sync to remote โ”‚
โ”‚ SSH (rsync) or FTP (lftp) โ”‚
โ”‚ โ”‚
โ”‚ โšก both Docker local + remote sync โ”‚
โ”‚ Best of both worlds โ”‚
โ”‚ โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
```

---

## ๐Ÿ”„ Sync Protocols

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ SSH (rsync) โ”‚ FTP (lftp) โ”‚
โ”‚ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• โ”‚ โ•โ•โ•โ•โ•โ•โ•โ•โ• โ”‚
โ”‚ โœ” Delta transfer โ”‚ โœ” Universal access โ”‚
โ”‚ โœ” Encrypted โ”‚ โœ” No server setup โ”‚
โ”‚ โœ” Passwordless โ”‚ โœ” Works everywhere โ”‚
โ”‚ โœ” ~200 bytes/edit โ”‚ โœ˜ Full file upload โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ โ˜… Recommended โ”‚ โ—‹ Fallback option โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

Powered by [**wp-dev-sync**](https://github.com/reandimo/wp-dev-sync) CLI:

```bash
npm run sync # Watch + auto-sync
npm run sync:push # One-time upload
npm run sync:pull # One-time download
npm run tunnel # Public URL for previews
npm run setup:remote # Preflight check
```

---

## ๐Ÿ“– Documentation

| | Page | What you'll learn |
|:--|:-----|:------------------|
| ๐Ÿง™ | [Setup Guide](docs/setup-guide.md) | Interactive setup walkthrough and config options |
| ๐Ÿณ | [Docker Development](docs/docker-development.md) | Local stack, services, and daily workflow |
| ๐Ÿ”„ | [Remote Sync](docs/remote-sync.md) | SSH/FTP sync, watch mode, tunnels |
| ๐ŸŽจ | [Theme Development](docs/theme-development.md) | Vite, HMR, SCSS, TypeScript, asset pipeline |
| ๐Ÿงฑ | [ACF Blocks](docs/acf-blocks.md) | Creating custom blocks with ACF v3 |
| ๐Ÿš€ | [Deployment](docs/deployment.md) | Production builds and server deployment |
| ๐ŸชŸ | [Windows Setup](docs/windows-setup.md) | Windows-specific config and troubleshooting |

---

## ๐Ÿ—๏ธ Project Structure

```
project/
โ”œโ”€โ”€ setup.js # Interactive setup (run once)
โ”œโ”€โ”€ docker-compose.yml # Docker services
โ”œโ”€โ”€ docker/ # PHP 8.2-fpm + Nginx configs
โ”œโ”€โ”€ app/ # Bedrock root
โ”‚ โ”œโ”€โ”€ composer.json # โ”œโ”€ WP core + plugins (wpackagist)
โ”‚ โ”œโ”€โ”€ config/ # โ”œโ”€ WordPress config (environments)
โ”‚ โ””โ”€โ”€ web/app/themes// # โ””โ”€ Your Block Theme โฌ‡
โ””โ”€โ”€ package.json # Root scripts (sync, tunnel, setup)
```

## ๐ŸŽจ Theme Structure

```
app/web/app/themes//
โ”‚
โ”œโ”€โ”€ blocks/ # ACF Blocks v3
โ”‚ โ””โ”€โ”€ example-cta/ # โ””โ”€ block.json + render.php
โ”‚
โ”œโ”€โ”€ includes/ # PHP classes (PSR-4)
โ”‚ โ”œโ”€โ”€ ACF/ # โ”œโ”€ Field groups
โ”‚ โ”œโ”€โ”€ Helpers/ViteHelper.php # โ”œโ”€ Vite asset loading
โ”‚ โ””โ”€โ”€ Theme/ThemeSetup.php # โ””โ”€ Theme bootstrap
โ”‚
โ”œโ”€โ”€ parts/ # Template parts
โ”‚ โ”œโ”€โ”€ header.html # โ”œโ”€ Site header
โ”‚ โ””โ”€โ”€ footer.html # โ””โ”€ Site footer
โ”‚
โ”œโ”€โ”€ templates/ # FSE block templates
โ”‚ โ”œโ”€โ”€ index.html # โ”œโ”€ Default
โ”‚ โ”œโ”€โ”€ page.html # โ”œโ”€ Pages
โ”‚ โ”œโ”€โ”€ single.html # โ”œโ”€ Posts
โ”‚ โ””โ”€โ”€ 404.html # โ””โ”€ Not found
โ”‚
โ”œโ”€โ”€ resources/
โ”‚ โ”œโ”€โ”€ fonts/ # Custom fonts โ†’ copied to public/
โ”‚ โ”œโ”€โ”€ scripts/frontend/main.ts # TS entry point
โ”‚ โ””โ”€โ”€ styles/
โ”‚ โ”œโ”€โ”€ base/ # โ”œโ”€ Variables, media queries
โ”‚ โ”œโ”€โ”€ components/ # โ”œโ”€ Reusable component styles
โ”‚ โ”œโ”€โ”€ sections/ # โ”œโ”€ Block/section styles
โ”‚ โ””โ”€โ”€ frontend/main.scss # โ””โ”€ SCSS entry point
โ”‚
โ”œโ”€โ”€ theme.json # Design tokens + block settings
โ”œโ”€โ”€ vite.config.js # Vite 5 + HMR config
โ””โ”€โ”€ functions.php # PSR-4 autoloader + bootstrap
```

---

## ๐Ÿงฑ ACF Blocks v3

Create custom blocks with a simple workflow:

```bash
# 1. Create block files
blocks/my-block/block.json # Block definition
blocks/my-block/render.php # Block template

# 2. Add ACF fields
includes/ACF/MyBlock.php # Field group

# 3. Register
functions.php โ†’ $acf_files[] # Add 'MyBlock'
ThemeSetup.php โ†’ $blocks[] # Add 'my-block'

# 4. Style
resources/styles/sections/_my-block.scss
```

See the included `blocks/example-cta/` for a complete reference.

---

## โšก Vite + HMR

```bash
# Inside theme directory
npm run dev # Start dev server (localhost:5173)
npm run build # Build once
npm run production # Optimized production build
```

- **Dev:** Vite dev server with HMR for instant CSS/JS updates
- **Build:** Assets compiled to `public/` with manifest.json
- **Fonts:** Automatically copied from `resources/fonts/` to `public/fonts/`
- **Docker:** `host.docker.internal` lets the PHP container reach Vite on your host

---

## ๐Ÿณ Docker Services

```bash
docker compose up -d # Start everything
docker compose down # Stop everything
docker compose exec php sh # Shell into PHP container
docker compose exec php wp cache flush # WP-CLI
```

| Service | Port | Description |
|:--------|:-----|:------------|
| Nginx | `8080` | Web server |
| PHP-FPM | `9000` | PHP 8.2 |
| MariaDB | `3306` | Database |
| MailHog | `8025` | Email testing |
| phpMyAdmin | `8081` | Database GUI |

---


๐Ÿ“– Full Setup Guide
ย ยทย 
๐Ÿ› Report Bug
ย ยทย 
๐Ÿ’ก Request Feature


Built by Renan Diaz ยท GPL-2.0-or-later