Complete Authentication 🔐
Login, register, refresh, logout, and password flows with server-side HttpOnly cookie handling.
✨Next.js + WooCommerce Headless
A production-ready foundation for modern commerce frontends: the client talks only to the Next.js BFF, which orchestrates WPGraphQL, WooCommerce sessions, and API security.
Global Flow 🔄
Login, register, refresh, logout, and password flows with server-side HttpOnly cookie handling.
Unified cart API (get/add/remove/update/reorder) plus WooCommerce checkout URL generation.
Address/profile updates through a secured WordPress endpoint with validation and normalization.
Double opt-in flow, abuse mitigation (honeypot, rate limit), and optional shared token to WordPress.
The frontend consumes a single surface: /api/*. WordPress calls stay fully encapsulated on the server side.
src/hooks provides app-facing hooks that wrap API calls and SWR cache behavior for authentication and cart workflows.
src/hooks/useMe.ts
SWR hook for current user state with login/register/logout actions and cart cache refresh after auth changes.
src/hooks/useCart.ts
SWR hook for cart data with add/remove/update actions, optimistic quantity updates, and rollback on failure.
zod payload validation, HttpOnly cookies (authToken, refreshToken, wg_session), no-store on sensitive routes, and in-memory rate limiting on exposed endpoints.
WooCommerce, WPGraphQL, WooGraphQL, WPGraphQL Headless Login, MU plugins, and custom plugins (custom-newsletter, gallery-manager).
Configure .env.local, then run yarn install and yarn dev. The app runs at http://localhost:3000.
These custom WordPress plugins extend functionality and expose REST API endpoints for headless frontend integration.
wordpress/custom-newsletter
Minimal WordPress plugin providing newsletter subscribe + double opt-in endpoints for the headless site.
POST /wp-json/custom/v1/newsletter/subscribeGET /wp-json/custom/v1/newsletter/confirmwordpress/gallery-manager
Select images from the media library and expose them through a REST API for headless galleries.
GET /wp-json/gallery-manager/v1/images