MW
Tutorial

Setting up a Block Development Environment

Install Node.js, scaffold your first block plugin with @wordpress/create-block, and connect it to a local WordPress install — in 30 minutes.

intermediate 35 min May 13, 2026
Basic familiarity with the command line Admin access to a WordPress install (local or staging)

SETTING UP A BLOCK DEVELOPMENT…

This tutorial sets up everything you need to start writing block code. By the end you’ll have a working my-first-block plugin running in a local WordPress install.

What we’re building

A minimal block plugin scaffolded with the official WordPress CLI tool. We’re not building a custom block in this tutorial — that’s Part 3. Here we get the development environment right so writing the block in Part 3 is the fun bit.

Step 1 — Install Node.js

WordPress block development uses Node.js for tooling (build, lint, test). Install the LTS version from nodejs.org or via your package manager.

Terminal — verify Node + npm
$ node --version
v20.10.0
$ npm --version
10.2.3

Step 2 — Get a local WordPress install

If you don’t already have one, pick the lightest tool:

  • wp-nownpx @wp-now/wp-now start spins up WordPress with no install. Great for quick experiments.
  • Local by Flywheel — GUI, free, full WP install with admin UI for SSL/SSH/etc.
  • DDEV — Docker-based, scriptable, used by agencies. Heavier but reproducible.

For this series, we use wp-now because it’s the lowest-friction option.

Terminal — start a one-command WordPress
$ mkdir my-block-project && cd my-block-project
$ npx @wp-now/wp-now start
Setting up WordPress... WordPress is running at http://localhost:8881

Open http://localhost:8881/wp-admin/ (login: admin / password by default) — you have WordPress.

Step 3 — Scaffold a block plugin

The @wordpress/create-block tool creates a complete plugin skeleton with the build pipeline, sample block code, and package.json scripts pre-configured.

Terminal — scaffold a block
$ cd wp-content/plugins
$ npx @wordpress/create-block my-first-block
Creating a new WordPress plugin in the my-first-block directory. Installing dependencies (this may take a few minutes)... Done!
$ cd my-first-block && ls
block.json build/ package.json readme.txt src/ my-first-block.php node_modules/ package-lock.json

The CLI gives you a fully working block plugin. Let’s look at what it generated.

Step 4 — Tour the generated files

my-first-block/
my-first-block.php plugin bootstrap — registers the block server-side
block.json block metadata (manifest)
package.json npm scripts (start, build, lint)
readme.txt wp.org plugin readme
src/
index.js block registration in JS
edit.js the React component for the editor
save.js the saved HTML output (static save)
style.scss styles for the front-end
editor.scss styles for the editor only
build/
index.js compiled output (generated, gitignored)

Four files matter most:

  • my-first-block.php — the plugin’s PHP entry. Tells WordPress “here’s a plugin” and calls register_block_type() against block.json.
  • block.json — the manifest. Lists the block name, title, category, supported features, attributes, file paths.
  • src/index.js — the JavaScript entry. Calls registerBlockType() from @wordpress/blocks with the edit + save components.
  • src/edit.js / src/save.js — the React components.

Step 5 — Start the dev server

npm run start watches src/ and recompiles to build/ on save.

Terminal — start the dev build
$ npm run start
> wp-scripts start asset main.js 9.74 KiB [emitted] webpack compiled successfully

Leave that running. In another terminal (or your editor) you’ll edit files; webpack rebuilds on save automatically.

Step 6 — Activate the plugin

Go to wp-admin → Plugins. You’ll see “My First Block” in the list. Click Activate.

Open the editor

In wp-admin, go to Posts → Add New (or open any existing post).

Find your block

Click the + in the editor and search for “My First Block”. It appears under a default “Widgets” category.

Insert + view

Click the block to insert it. You’ll see the placeholder content from src/edit.js (the default scaffolded text). Confirm — your dev environment works end-to-end.

Verification

If npm run start is running and you can insert your block in a post, you’re set up correctly. Common stumbling blocks:

SymptomFix
Plugin doesn’t appear in wp-adminPlugin folder must be in wp-content/plugins/ — check pwd
Build fails on saveNode version too old; need 18+
Block doesn’t appear in inserterHard-refresh the editor; you may have a stale browser cache
block.json errors in consoleRun npm run build once after create-block finishes — sometimes the initial build is needed

What’s next

You have a working block development environment. Part 3 writes our first real custom block — a callout component with editable title and body, replacing the scaffolded placeholder with code you understand line-by-line.

You've completed this tutorial!

Get the next one in your inbox. Practical tips, no fluff.

Subscribe

Get weekly notes in your inbox

Practical tips, tutorials and resources. No spam.