Getting Started¶
Welcome to NextPresser! This guide will help you get started with building a Next.js frontend for WordPress.
Overview¶
NextPresser is a modern headless e-commerce solution built with Next.js, WooCommerce, and Faust.js. This project provides a fully functional online store with authentication, cart management, checkout, and payment processing.
Features¶
- Headless Architecture: Next.js frontend with WordPress/WooCommerce backend
- Faust.js Integration: Seamless WordPress authentication and content management
- WooCommerce Integration: Full e-commerce functionality via GraphQL
- User Authentication: Login, registration, and account management
- Shopping Cart: Persistent cart with session management
- Checkout Flow: Complete checkout with billing, shipping, and payment processing
- Stripe Integration: Secure payment processing with Stripe Elements
- Product Catalog: Product listings, categories, and search
- User Accounts: Order history, account details, and address management
- Responsive Design: Mobile-first, modern UI built with Tailwind CSS
Prerequisites¶
Before you begin, ensure you have the following installed:
- Node.js 20.x or higher
- npm or yarn package manager
- WordPress site (5.8 or higher)
- PHP 7.4 or higher (for WordPress)
- MySQL 5.7 or higher (for WordPress database)
Installation¶
Step 1: Clone the Repository¶
Step 2: Install Next.js Dependencies¶
Step 3: Configure Environment Variables¶
Create a .env.local file in the root directory:
Add the following environment variables:
# Required: Your WordPress GraphQL endpoint
NEXT_PUBLIC_GRAPHQL_URL=http://localhost:8080/graphql
# Faust.js Configuration
# Your WordPress site URL (base URL, not the GraphQL endpoint)
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8080
# Plugin secret found in WordPress Settings->Faust
FAUST_SECRET_KEY=your-faust-secret-key-here
# Optional: Algolia Search (only if using search)
# NEXT_PUBLIC_ALGOLIA_APP_ID=your_algolia_app_id
# NEXT_PUBLIC_ALGOLIA_PUBLIC_API_KEY=your_algolia_public_key
# NEXT_PUBLIC_ALGOLIA_INDEX_NAME=your_index_name
# Optional: Placeholder images
NEXT_PUBLIC_PLACEHOLDER_SMALL_IMAGE_URL=https://via.placeholder.com/300
NEXT_PUBLIC_PLACEHOLDER_LARGE_IMAGE_URL=https://via.placeholder.com/800
# Stripe Configuration
# Publishable key - safe to use in frontend/client-side code
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
# Stripe Gateway ID - usually 'stripe' but check your WooCommerce Stripe plugin settings
# Common values: 'stripe', 'stripe_cc', 'woocommerce_gateway_stripe'
NEXT_PUBLIC_STRIPE_GATEWAY_ID=stripe
# NOTE: The Stripe SECRET key (sk_test_...) should NOT be added here!
# Secret keys must only be stored in your WordPress/WooCommerce backend (server-side)
# Add the secret key in your WordPress admin: WooCommerce > Settings > Payments > Stripe
Step 4: Start Development Server¶
The application will be available at http://localhost:3000
WordPress Backend Setup¶
Required WordPress Plugins¶
Install and activate the following plugins in your WordPress site:
Core Plugins (Required)¶
Installation Order: Install and activate plugins in this order for best results.
- WooCommerce
- Purpose: E-commerce platform for WordPress
- Installation:
- Go to Plugins → Add New
- Search for "WooCommerce"
- Click "Install Now" then "Activate"
- After Activation: Complete the WooCommerce setup wizard
-
Version: Tested with WooCommerce 9.9.5+
- Purpose: Exposes GraphQL API for WordPress
- Installation:
- Go to Plugins → Add New
- Search for "WPGraphQL"
- Click "Install Now" then "Activate"
- After Activation:
- Go to GraphQL → Settings
- Enable "Public Introspection" (required for Faust.js)
- Note your GraphQL endpoint URL (usually
/graphql)
-
Version: Tested with WP GraphQL 2.3.3+
- Purpose: Adds WooCommerce functionality to WPGraphQL schema
- Installation: Download from GitHub releases and install via WordPress admin
-
Version: Tested with WP GraphQL WooCommerce 0.19.0+
- Purpose: Enables CORS for GraphQL requests from your Next.js frontend
- Installation: Install via WordPress admin
-
Critical: Must be configured correctly or Next.js won't be able to connect
- Purpose: Provides authentication and API endpoints for Faust.js
- Installation: Install via WordPress admin
- After Activation: Configure Faust.js settings
Optional Plugins¶
- WPGraphQL Content Blocks
- Purpose: Enables Gutenberg block support in GraphQL
- Required: Only if you want to use WordPress blocks in your Next.js app
-
Installation: See WPGraphQL Content Blocks Installation for detailed instructions
- Purpose: For custom product fields and additional content fields
-
Configuration: See WordPress Custom Fields Setup for detailed setup
- Purpose: Required for Stripe payment processing
- Configuration: See Stripe Configuration Guide for detailed setup
For detailed WordPress plugin configuration, see the WordPress Setup Guide.
Next Steps¶
- WordPress Setup - Detailed WordPress backend configuration
- Configuration - Environment variables and settings
- Setup Guides - Additional setup instructions
- Components Documentation - Component reference
- Features Overview - Feature documentation