5 min read

Why Valet Is My Preferred Local Stack for WordPress and Astro

Why a lightweight Valet setup works well for WordPress and Astro projects when you want fast startup times and less container overhead

Why Valet Is My Preferred Local Stack for WordPress and Astro

If you’ve spent any time juggling WordPress sites and Astro projects on your local machine, you know the pain. Docker containers eating up RAM, waiting for environments to spin up, and dealing with config files that seem to multiply overnight.

About a year ago, I simplified everything by switching to Laravel Valet for my local development workflow — and I haven’t looked back. Here’s why this lightweight tool has become the backbone of how I build with both WordPress and Astro, and how you can set it up yourself.

The Problem with Heavy Local Stacks

For years, my local development setup was a patchwork. I ran Local by Flywheel for WordPress projects, Docker containers for headless setups, and npm run dev on various ports for my Astro sites. It worked, but it was clunky.

Starting up a project meant waiting for containers to boot. Running three or four WordPress sites alongside an Astro frontend meant my MacBook fan sounded like a jet engine. And context-switching between tools — each with its own mental model and quirks — added friction that slowed me down.

What I wanted was simple: something that just runs. Fast startup, minimal resource usage, and a workflow that gets out of my way so I can focus on building.

Enter Valet.

What Makes Valet So Good for This Workflow

For the uninitiated, Laravel Valet is a minimalist development environment for macOS. It uses Nginx, PHP, and dnsmasq to automatically serve any project in a designated directory with a .test domain. No config files, no virtual machines, no containers.

Here’s the magic: you “park” a directory, and every folder inside it instantly becomes a working site. Drop a WordPress installation into ~/Sites/client-project, and it’s live at client-project.test. That’s it.

Setting Up Valet for WordPress

Getting WordPress running on Valet takes about five minutes. First, make sure you have Homebrew, PHP, and Composer installed, then:

# Install MySQL (or MariaDB if you prefer)
brew install mysql
brew services start mysql

# Install Valet globally
composer global require laravel/valet

# Run the Valet installer
valet install

# Park your sites directory
cd ~/Sites
valet park

Now any folder inside ~/Sites is automatically served. To set up a new WordPress project, I use WP-CLI to keep things fast:

cd ~/Sites
mkdir awesome-client && cd awesome-client

# Download WordPress core
wp core download

# Create the database and configure wp-config.php
mysql -u root -e "CREATE DATABASE awesome_client;"
wp config create --dbname=awesome_client --dbuser=root --dbpass=""

# Install WordPress
wp core install \
  --url="awesome-client.test" \
  --title="Awesome Client" \
  --admin_user=admin \
  --admin_password=password \
  --admin_email=dev@fatpasty.com

Visit awesome-client.test in your browser, and you’ve got a fully running WordPress site. No Docker compose files, no port conflicts, no waiting. The whole process takes under a minute.

Need SSL? One command:

valet secure awesome-client

Now it’s running at https://awesome-client.test with a trusted local certificate. Try doing that with a Docker setup without a headache.

Running Astro Alongside WordPress

This is where things get really interesting. If you’re using Astro as a static frontend or in SSR mode — maybe pulling content from WordPress via the REST API or WPGraphQL — Valet handles the proxy beautifully.

Astro’s dev server runs on its own port (usually 4321). Rather than juggling URLs with port numbers, I use Valet’s proxy command to give my Astro project a clean .test domain too:

cd ~/Sites
mkdir client-frontend && cd client-frontend

# Scaffold a new Astro project
npm create astro@latest .

# Start the Astro dev server
npm run dev

# In another terminal, proxy it through Valet
valet proxy client-frontend http://localhost:4321

Now my Astro site is accessible at client-frontend.test, and my WordPress backend is at awesome-client.test. Both have clean URLs, both support HTTPS if I need it, and there’s zero container overhead.

Here’s a quick example of fetching WordPress posts from the Astro frontend — the kind of setup this workflow is perfect for:

---
// src/pages/blog.astro
const response = await fetch(
  "https://awesome-client.test/wp-json/wp/v2/posts?per_page=10&_embed"
);
const posts = await response.json();
---

<html lang="en">
  <head>
    <title>Blog | Client Site</title>
  </head>
  <body>
    <h1>Latest Posts</h1>
    <ul>
      {posts.map((post) => (
        <li>
          <a href={`/blog/${post.slug}`}>
            <h2 set:html={post.title.rendered} />
          </a>
          <div set:html={post.excerpt.rendered} />
        </li>
      ))}
    </ul>
  </body>
</html>

Because both services are running on .test domains with trusted SSL, you avoid the mixed-content warnings and CORS headaches that plague port-based setups. Everything just feels like production.

The Day-to-Day Benefits

After a year of using this setup, here’s what I appreciate most:

Startup time is essentially zero. Valet runs as a background service. There’s no “booting up” an environment. Open your terminal, start coding. Your WordPress sites are already live.

Resource usage is negligible. Nginx and dnsmasq use almost no memory compared to Docker containers. I routinely have five or six WordPress sites “running” simultaneously without any performance impact on my machine.

Context switching is minimal. Whether I’m working on a WordPress theme, a headless WordPress API, or an Astro frontend, the workflow is the same: navigate to the folder, do the work, view it in the browser.

It plays nicely with everything else. Valet doesn’t care what else you’re running. Node processes, Python scripts, other servers — they all coexist peacefully. The proxy feature means you can route any local server through a .test domain.

One thing worth mentioning: Valet is macOS only. If you’re on Linux, Valet Linux is a community fork that offers a similar experience. Windows users might look at Laragon for a comparable lightweight approach.

Conclusion: Simplicity Wins

The best local development tool is the one that stays invisible. Valet does exactly that — it removes the ceremony around running local sites so you can spend your energy on what matters: building great WordPress sites, crafting fast Astro frontends, and shipping work.

If you’re tired of waiting for containers to spin up, fighting with Docker networking, or maintaining complex config files just to run a WordPress site locally, give Valet a try. Pair it with WP-CLI for WordPress management and Valet’s proxy for your Astro dev server, and you’ve got a local stack that’s fast, light, and remarkably productive.

Next steps to try:

  1. Install Valet and park your projects directory
  2. Set up a WordPress site with WP-CLI in under a minute
  3. Proxy an Astro dev server to a .test domain
  4. Run valet secure on everything and enjoy local HTTPS without the pain

Your laptop fan will thank you.