Quick Start
Get your FlatWP site up and running in under 10 minutes!
Prerequisites
Before you begin, make sure you have:
- Node.js 20.0+ installed (Download)
- WordPress 6.0+ running with admin access
- Package manager: npm, yarn, or pnpm (we recommend pnpm)
- A code editor (VS Code recommended)
Check out WordPress.org for installation guides. Local development options include:
- Local by Flywheel - Easy local WordPress (recommended)
- MAMP - macOS/Windows local server
- XAMPP - Cross-platform solution
Step 1: Clone the Starter Template
Clone the FlatWP starter repository:
# Clone the repository
git clone https://github.com/flatwp/flatwp-starter.git my-flatwp-site
cd my-flatwp-site
Or use the GitHub template (cleaner, no git history):
npx degit flatwp/flatwp-starter my-flatwp-site
cd my-flatwp-site
Step 2: Install Dependencies
Install the required packages (this takes about 2 minutes):
# Using pnpm (recommended - faster)
pnpm install
# Or using npm
npm install
# Or using yarn
yarn install
pnpm is faster and uses less disk space than npm. Install it with: npm install -g pnpm
Step 3: Configure Environment Variables
Create a .env.local file in the project root:
cp .env.example .env.local
Edit .env.local with your WordPress details:
# WordPress GraphQL endpoint
NEXT_PUBLIC_WORDPRESS_API_URL=https://your-wordpress-site.com/graphql
# Secret for revalidation webhooks
REVALIDATION_SECRET=your-random-secret-here
# Preview mode secret
PREVIEW_SECRET=another-random-secret
Generate secure secrets using:
openssl rand -base64 32
Step 4: Set Up WordPress
Install Required Plugins
1. Install WPGraphQL
- Log in to your WordPress admin dashboard
- Go to Plugins → Add New
- Search for "WPGraphQL"
- Click Install Now, then Activate
2. Install FlatWP Companion Plugin
The FlatWP plugin connects WordPress to Next.js and provides ACF blocks:
- Download
flatwp-react-plugin.zipfrom GitHub Releases - Go to Plugins → Add New → Upload Plugin
- Choose the ZIP file and click Install Now
- Click Activate
3. Build the Plugin Dashboard (Important!)
The plugin needs to be built before it works:
# SSH into your WordPress server or use local terminal
cd /path/to/wp-content/plugins/flatwp-react/admin-react
# Install and build (first time only)
npm install
npm run build
Configure Plugin Settings
- In WordPress, find the new FlatWP menu item (lightning bolt icon)
- Click on it to open the dashboard
- Click Settings tab
- Enter your configuration:
Next.js Site URL: http://localhost:3000
Revalidation Secret: [paste your secret from .env.local]
Preview Secret: [paste your preview secret from .env.local]
- Check Enable Webhooks
- Click Save Settings
- Look for a green checkmark showing "Connected"
Step 5: Generate GraphQL Types
Generate TypeScript types from your WordPress GraphQL schema:
# Using pnpm
pnpm graphql:codegen
# Or using npm
npm run graphql:codegen
This creates type-safe interfaces in graphql/generated/. You'll see output like:
✔ Parse Configuration
✔ Generate outputs
Step 6: Start Development Server
Run the development server:
# Using pnpm
pnpm dev
# Or using npm
npm run dev
Open http://localhost:3000 in your browser. You should see your FlatWP site! 🎉
The development server runs on port 3000 by default. If you need to change it, edit package.json.
Step 7: Create Your First Page
Let's create a simple "About" page to see everything working:
In WordPress
- Go to Pages → Add New
- Title: "About Us"
- Scroll down to Page Builder
- Click "Add Content Block"
- Select "Hero - Centered"
- Fill in:
- Heading: "About Our Company"
- Subheading: "We build amazing things"
- Button Text: "Contact Us"
- Button URL: "/contact"
- Click Publish
View Your Page
- Go to
http://localhost:3000in your browser - Your new "About Us" page should appear automatically
- Click on it to see the hero block you created! ✨
✅ Success Checklist
Make sure everything is working:
- Next.js site loads at
http://localhost:3000 - WordPress pages appear in navigation
- Page Builder blocks render correctly
- FlatWP dashboard shows green "Connected" status
- Making changes in WordPress updates the Next.js site
- No errors in browser console (F12)
If everything is checked, congratulations! Your FlatWP site is running! 🎉
Common Issues & Solutions
If you encounter issues, see our detailed Troubleshooting Guide for more solutions.
GraphQL Endpoint Not Found
Error: "Failed to fetch from WordPress GraphQL endpoint"
Solutions:
- Verify WPGraphQL plugin is activated in WordPress
- Check your
.env.localhas the correctNEXT_PUBLIC_WORDPRESS_API_URL - Test the endpoint in browser:
https://your-wordpress-site.com/graphql - Make sure WordPress site is accessible from your computer
CORS Errors
Error: "Access-Control-Allow-Origin blocked"
Solution: Add to WordPress wp-config.php (above "That's all, stop editing!"):
// Allow Next.js to access WordPress
header('Access-Control-Allow-Origin: http://localhost:3000');
header('Access-Control-Allow-Credentials: true');
For production, replace localhost:3000 with your actual domain.
GraphQL Types Not Generated
Error: "Cannot find module './graphql/generated'"
Solution:
# Make sure WordPress is running
# Then generate types
pnpm graphql:codegen
If it fails, check:
- WordPress site is accessible
- WPGraphQL plugin is activated
.env.localhas correct URL
FlatWP Dashboard Shows "Disconnected"
Problem: Red status in WordPress FlatWP dashboard
Solutions:
- Make sure Next.js dev server is running (
pnpm dev) - Check secrets match between WordPress and
.env.local - Verify Next.js URL is correct in WordPress settings
- Test the revalidation endpoint:
curl -X POST http://localhost:3000/api/revalidate \
-H "Content-Type: application/json" \
-d '{"secret":"your-secret","paths":["/"]}'
Plugin Dashboard Not Loading
Problem: White screen when clicking FlatWP menu
Solutions:
- Make sure you ran
npm run buildin the plugin'sadmin-reactfolder - Check browser console (F12) for JavaScript errors
- Verify file permissions on the
distfolder - Try deactivating and reactivating the plugin
Next Steps
Now that your FlatWP site is running, here's what to explore:
Immediate Next Steps
- ACF Setup Guide - Learn how to use all 8 content block types
- Customization - Change colors, fonts, and components
- WordPress Plugin - Explore the React dashboard features
When You're Ready
- Configuration - Advanced settings and optimization
- Deployment - Deploy your site to production
- Architecture - Understand how everything works
Quick Tips
Daily Development
# Start working
pnpm dev
# After WordPress changes
pnpm graphql:codegen
# Build for production
pnpm build
Common Commands
# Development
pnpm dev # Start dev server (port 3000)
pnpm build # Build for production
pnpm start # Run production build locally
# Code Quality
pnpm lint # Check code quality
pnpm type-check # TypeScript validation
pnpm graphql:codegen # Update WordPress types
# Utilities
pnpm clean # Clear build cache
Project Structure
my-flatwp-site/
├── app/ # Next.js pages and routes
│ ├── (pages)/ # Page routes
│ ├── api/ # API endpoints
│ └── blog/ # Blog section
├── components/ # React components
│ ├── blocks/ # ACF block components
│ ├── ui/ # UI components
│ └── ... # Other components
├── lib/ # Utilities and helpers
│ └── wordpress/ # WordPress client & adapters
├── graphql/ # GraphQL queries
│ └── generated/ # Auto-generated types
├── public/ # Static files (images, etc.)
├── .env.local # Your secrets (not in git)
└── next.config.ts # Next.js configuration
Learning Resources
Documentation
- Full Docs: flatwp.com/docs
- ACF Guide: /docs/acf-setup
- Examples: Check
components/blocks/for block examples
Community
- Questions: GitHub Discussions
- Bug Reports: GitHub Issues
- Updates: Follow @flatwp on Twitter
Video Tutorials (Coming Soon)
- Setting up your first site
- Creating custom blocks
- Deploying to production
- Advanced customization
Need Help?
Got stuck? Here's how to get help:
- Check this guide - Reread the troubleshooting section
- Search docs - Use the search bar at the top
- Ask the community - Post in GitHub Discussions
- Report bugs - Open an issue on GitHub
Happy building! 🚀