How sayandey18/wp-headless works
Project Type and Purpose
• This is a full-stack headless-CMS front-end: a Next.js/React application that uses Faust.js to fetch content from a WordPress backend via GraphQL.
• Purpose: Render SEO-optimized pages (SSR/SSG), pull posts/pages/projects/comments from WordPress, serve assets (images, sounds), and provide features like comments, newsletters, etc.
File Structure
• Top-Level Config & Scripts:
• next.config.mjs, faust.config.js → Next.js & Faust setup
• package.json, pnpm-lock.yaml → dependencies & scripts
• blueprint-schema.json, possibleTypes.json → GraphQL schema introspection
• Public: /public/assets → static images & sound files
• Source Code (/src):
• components/ → reusable UI pieces (cards, buttons, headers, footers, comment widgets)
• graphql/ → query & mutation definitions
• pages/ → Next.js routing (SSR/SSG pages, API endpoints under /api/faust)
• styles/ → global CSS & Tailwind config
• wp-templates/ → Faust.js page templates mapping WP nodes to Next.js routes
• Deployment & Tooling:
• vercel.json → Vercel deployment settings
• ESLint, Prettier, Tailwind, PostCSS configs
README for Additional Insights
• Key features: SSR/SSG via Next.js, GraphQL for data, Faust.js integration, WPGraphQL on WP side
• Prerequisites: Node ≥18, WP instance with WPGraphQL plugin
• Workflow: pnpm install → generate possibleTypes → pnpm dev
a. Main Components
1. Client (Browser/Mobile)
2. Next.js Frontend
• Pages & Routing Layer
• Faust.js GraphQL Client
• Static Assets (served from /public)
3. GraphQL API Layer
• WPGraphQL Endpoint on WordPress
4. WordPress Backend
• Headless CMS content (posts, pages, media, comments)
5. Deployment Platform
• Vercel (SSR/SSG hosting, CDN for static assets)
b. Relationships & Interactions
• Client → Next.js (HTTP/HTTPS)
• Next.js (SSR/SSG) → WPGraphQL (GraphQL queries & mutations)
• Next.js ↔ Static Assets (images/sounds) via CDN
• Next.js → Vercel Hosting & CDN
c. Architectural Patterns & Principles
• Headless CMS pattern
• SSR/SSG for SEO and performance
• Component-based design (React)
• GraphQL data fetching
• Separation of concerns: UI, data layer, CMS
d. Key Technologies & Frameworks
• React & Next.js (pages, SSR/SSG, API routes)
• Faust.js (GraphQL client abstractions)
• WPGraphQL & WordPress (content source)
• Tailwind CSS, PostCSS for styling
• Vercel for deployment/CDN
Essential Details to Capture
• The internal GraphQL folder: group queries & mutations as part of the GraphQL Client block.
• Static /public/assets serve directly from CDN—show asset flow.
• API routes in /pages/api/faust handle preview and serverless functions—indicate these under the Next.js server block.