This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
pnpm dev- Start development server with turbo modepnpm build- Build for productionpnpm start- Start production serverpnpm lint- Run ESLint
Headless WordPress starter using Next.js 16 App Router with TypeScript.
- All WordPress REST API interactions centralized here
- Type definitions in
lib/wordpress.d.ts(Post, Page, Category, Tag, Author, FeaturedMedia) WordPressAPIErrorclass for consistent error handling- Cache tags for granular revalidation:
['wordpress', 'posts', 'post-{id}', 'posts-page-{n}'] - Pagination via
getPostsPaginated()returns{ data, headers: { total, totalPages } } - Default cache: 1 hour (
revalidate: 3600)
- Dynamic:
/posts/[slug],/pages/[slug] - Archives:
/posts,/posts/authors,/posts/categories,/posts/tags - API:
/api/revalidate(webhook),/api/og(OG images)
- Server Components with parallel
Promise.all()calls generateStaticParams()usesgetAllPostSlugs()for static generation- URL-based state for search/filters via
searchParams - Debounced search (300ms) in
SearchInputcomponent
- WordPress plugin sends webhook to
/api/revalidate - Validates
x-webhook-secretheader againstWORDPRESS_WEBHOOK_SECRET - Calls
revalidateTag()for specific content types (posts, categories, tags, authors)
site.config.ts- Site metadata (domain, name, description)menu.config.ts- Navigation menu structurenext.config.ts- Image remotePatterns, /admin redirect to WordPress
- Strict typing with interfaces from
lib/wordpress.d.ts - Async params:
params: Promise<{ slug: string }>(Next.js 15+ pattern)
- Components: PascalCase (
PostCard.tsx) - Functions/variables: camelCase
- Types/interfaces: PascalCase
- Pages:
/app/**/*.tsx - UI components:
/components/ui/*.tsx(shadcn/ui) - Feature components:
/components/posts/*.tsx,/components/theme/*.tsx - WordPress functions must include cache tags
WORDPRESS_URL="https://example.com" # Full WordPress URL
WORDPRESS_HOSTNAME="example.com" # For Next.js image optimization
WORDPRESS_WEBHOOK_SECRET="secret-key" # Webhook validation
- Next.js 16 with React 19
- Tailwind CSS v4 with
@tailwindcss/postcss - shadcn/ui components (Radix primitives)
- brijr/craft for layout (
Section,Container,Article,Prose)