FlatWP
Headless WordPress Starter with Next.js
Modern headless WordPress with Next.js 15 frontend
GraphQL backend with WordPress plugin for enhanced features
ISR, image optimization, and perfect near-instant page loads
Easy theme customization with TailwindCSS and Shadcn/ui
Technologies Used
Project Gallery
dark ico orange
dark orange
flatwp blue
flatwp blue ico
FlatWP: Modern Headless WordPress
FlatWP is a cutting-edge headless WordPress starter that combines WordPress's powerful content management with Next.js's advanced rendering strategies for optimal performance. Built with Next.js 15, React 19, and TypeScript, it delivers near-instant page loads with intelligent caching and incremental static regeneration.
The Problem: WordPress Performance vs. Modern UX
Traditional WordPress sites face significant challenges:
- Slow Load Times: Server-rendered PHP pages with legacy architecture
- Poor Performance: Heavy themes and plugins impact Core Web Vitals
- Outdated Stack: Limited modern JavaScript framework integration
- Scalability Issues: Traditional hosting struggles with traffic spikes
- Developer Experience: Constrained by PHP templating limitations
The Solution: Headless WordPress with Next.js Power
FlatWP solves these challenges by decoupling WordPress content management from frontend delivery, leveraging Next.js 15's advanced capabilities for blazing-fast performance.
⚡ Near-Instant Page Loads
- ISR (Incremental Static Regeneration): Pages update without full rebuilds
- On-Demand Revalidation: Content updates trigger instant regeneration
- Edge Optimization: Static pages served from CDN for global performance
- Image Optimization: Automatic WebP conversion and lazy loading
- Code Splitting: Minimal JavaScript bundles for faster initial loads
🎨 Easy Theme Customization
- TailwindCSS v4: Utility-first styling for rapid customization
- Shadcn/ui Components: Beautiful, accessible UI components out of the box
- TypeScript Support: Type-safe development with autocomplete
- Component Library: Pre-built blocks for common WordPress patterns
- Dark Mode Ready: Built-in theme switching capabilities
🚀 Key Features & Capabilities
Next.js 15 with App Router
FlatWP leverages the latest Next.js features for optimal performance:
- React Server Components: Faster page loads with server-side rendering
- Streaming SSR: Progressive page rendering for better perceived performance
- Parallel Routes: Advanced routing for complex layouts
- Intercepting Routes: Modal and overlay support without page transitions
GraphQL Backend Integration
Deep GraphQL integration with WordPress for efficient data fetching:
- WPGraphQL: Powerful GraphQL API for WordPress content
- Automatic Type Generation: GraphQL Code Generator creates TypeScript types
- Custom Post Types: Full support for custom content structures
- ACF Flexible Content: Custom block layouts with Advanced Custom Fields
- Preview Mode: View draft content before publishing
WordPress Core Blocks & Gutenberg
Full Gutenberg compatibility with modern rendering:
- Core Block Support: All WordPress blocks render correctly
- Custom Block Styles: Extend blocks with Tailwind utilities
- Block Patterns: Reusable content layouts
- Dynamic Blocks: Server-side rendered blocks with data fetching
🔧 Technical Implementation
Modern Technology Stack
Built with cutting-edge web technologies:
// Next.js 15 with App Router
export default async function Page({ params }: PageProps) {
const { post } = await getPostBySlug(params.slug);
return (
<article className="prose dark:prose-invert">
<h1>{post.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.content }} />
</article>
);
}
ISR with On-Demand Revalidation
Intelligent caching strategy for optimal performance:
// Incremental Static Regeneration
export const revalidate = 3600; // Revalidate every hour
// On-demand revalidation from WordPress
export async function POST(request: Request) {
const { slug } = await request.json();
await revalidatePath(`/blog/${slug}`);
return Response.json({ revalidated: true });
}
GraphQL Type Safety
Automatic TypeScript generation from GraphQL schema:
// Generated types from GraphQL schema
import { GetPostQuery, GetPostQueryVariables } from '@/graphql/generated';
const { data } = await client.query<GetPostQuery, GetPostQueryVariables>({
query: GET_POST,
variables: { slug }
});
🎯 Performance Optimization
Core Web Vitals Excellence
- LCP < 2.5s: Fast Largest Contentful Paint through static generation
- FID < 100ms: Minimal JavaScript for quick First Input Delay
- CLS < 0.1: Stable layouts with proper image dimensions
- TTI < 3.8s: Fast Time to Interactive with progressive enhancement
Image Optimization
- Next.js Image Component: Automatic responsive images
- WebP Conversion: Modern format support with fallbacks
- Lazy Loading: On-demand image loading for faster initial page loads
- Blur Placeholders: Smooth image loading experience
Caching Strategy
- Static Generation: Pre-rendered pages for instant delivery
- ISR: Background regeneration keeps content fresh
- CDN Distribution: Global edge network for minimal latency
- API Response Caching: Optimized GraphQL query performance
🔌 FlatWP WordPress Plugin
Enhanced WordPress Functionality
The companion WordPress plugin provides:
- Deep GraphQL Integration: Extended WPGraphQL capabilities
- Custom Data Structures: Support for all custom post types
- Popular Plugin Integration: ACF, Yoast SEO, and form plugins
- Search Functionality: Built-in search API for frontend
- Block Rendering: Server-side block rendering for accurate display
Developer Experience
- TypeScript Support: Full type safety across frontend and backend
- Development Tools: Hot reload, error reporting, and debugging
- Documentation: Comprehensive guides and code examples
- Active Development: Regular updates and community support
📦 Deployment & Hosting
Multiple Deployment Options
Deploy to your preferred platform:
- Vercel (recommended): Zero-config deployment with ISR support
- Netlify: Continuous deployment with edge functions
- AWS Amplify: Enterprise-grade hosting with CDN
- Cloudflare Pages: Global edge network deployment
- Docker: Containerized deployment for custom infrastructure
WordPress Hosting Requirements
- WordPress 6.4+: Latest WordPress version
- WPGraphQL: Core GraphQL plugin (required)
- FlatWP Plugin: Companion plugin (recommended)
- ACF PRO: Advanced Custom Fields (optional)
🚀 Getting Started
Quick Setup
- WordPress Setup: Install WordPress with WPGraphQL plugin
- Clone Starter:
git clone https://github.com/flatwp/flatwp-starter - Configure: Set WordPress URL in environment variables
- Install:
pnpm installto install dependencies - Develop:
pnpm devto start development server - Deploy: Push to Vercel/Netlify for automatic deployment
Environment Configuration
WORDPRESS_URL=https://your-wordpress-site.com
WORDPRESS_GRAPHQL_ENDPOINT=/graphql
REVALIDATION_SECRET=your-secret-key
🎨 Theme Customization
TailwindCSS v4 Theming
Customize your site's appearance with Tailwind utilities:
// tailwind.config.ts
export default {
theme: {
extend: {
colors: {
brand: {
primary: '#0066ff',
secondary: '#00cc99'
}
}
}
}
}
Shadcn/ui Components
Beautiful, accessible components ready to use:
- Navigation: Headers, footers, and menus
- Content: Cards, grids, and lists
- Forms: Contact forms with validation
- Overlays: Modals, drawers, and popups
💻 Technology Stack
Built with modern web technologies for optimal developer experience:
- Frontend: Next.js 15 with App Router and React 19
- Styling: TailwindCSS v4 with Shadcn/ui components
- Backend: WordPress with WPGraphQL and FlatWP plugin
- Type Safety: TypeScript in strict mode with GraphQL Code Generator
- Deployment: Vercel-optimized with ISR support
- Performance: Image optimization, code splitting, and edge caching
🔮 Coming Soon
Planned Features
- Advanced Caching: Redis integration for query caching
- Multi-language: i18n support with WordPress WPML
- E-commerce: WooCommerce integration with GraphQL
- Analytics: Built-in analytics dashboard
- A/B Testing: Experimentation framework for content
FlatWP combines the best of both worlds: WordPress's mature content management with Next.js's cutting-edge performance, delivering near-instant page loads and exceptional user experiences.