snapwp
v0.3.0
Published
A better way to build headless WordPress applications.
Keywords
Readme
🫰 SnapWP
A better way to build headless WordPress applications.
What is SnapWP?
SnapWP is a composable framework of JavaScript libraries for building headless WordPress applications.
🎨 It uses WordPress's Block Themes as the default source of truth for both design and content on the frontend.
🛠️ It provides an additive and adaptable DX layer / API / tooling that lets developers granularly override just the parts of their app they care about.
SnapWP treats headless WordPress as a progressive enhancement, providing a "turn-key" experience for parity with traditional WordPress sites, so you can focus on building the unique and custom features that make your project stand out.
[!WARNING] 🐉 There be dragons! This project is in active development and considered experimental. Some features may be incomplete, unstable, or subject to change. Learn more in the SnapWP monorepo.
Prerequisites
- Node.js: v20+ (with
npmandnpxinstalled). - A WordPress backend configured with SnapWP Helper.
Commands
npx snapwp
To create a new headless WordPress app using SnapWP, follow these steps:
Run the scaffolding wizard:
npx snapwp [options]Available options:
--skip-install: Skip installing npm dependencies during project creation.
Answer the CLI prompts:
Enter the path to the directory where you want to create the app, e.g.
./my-headless-appCreate an Environment File:
- Paste the .env contents from
Dashboard > WPGraphQL > Settings > SnapWP Helperinto the file created.
- Adjust any environment variables as needed.
- Save the file and close the editor.
- Paste the .env contents from
Return to the terminal and press
Enterto continue the setup process.
Start your headless WordPress app:
- Navigate to the newly created app.
- Run
npm install. - Run
npm run dev(for development) ornpm run build && npm run start(for production) - Visit the
NEXT_PUBLIC_FRONTEND_URLfrom.env(updated in Step 2), in your browser to see SnapWP in action!
Contributing
This package is part of SnapWP's monorepo and is actively maintained by rtCamp. Packages are published to npm from the packages directory, and can be used standalone in the headless WordPress ecosystem or as part of SnapWP's framework.
Contributions are welcome and encouraged! To learn more about contributing to this package or SnapWP as a whole, please read the Contributing Guide.
For development guidelines, please refer to our Development Guide.
