THIS IS A DEMO STORE, ORDERS WILL NOT BE PROCESSED AND YOU WON'T BE CHARGED. U:Test P:funkytest111@

Local development

February 20, 2025

407 words | 3 min read.
CustomisationDocumentationCodingDevelopmentGatsbyGraphQLHeadless WordPresslocalhostNode.jsReact.js
xtelegramfacebooktiktoklinkedin

Running the development server for real time updates and full stack development.

Make sure You have the WordPress backend correctly configured first before running the local server.

Note: Works well with the new Woocommerce product editor found in: settings => advanced => features => Experimental features => New product editor => Try the new product editor (Beta)

1. Navigate to the Frontend Directory

Open your terminal and move to the project folder:

cd superfunky-space

2. Install Dependencies

Run one of the following commands based on your package manager:

yarn install

or

pnpm install

or

npm install

3. Configure Environment Variables

Create and configure the .env.development file with the required environment variables:


WORDPRESS_SITE_URL=http://admin.yoursite.com
GATSBY_SITE_URL=https://yoursite.com
GOOGLE_TAGMANAGER_ID=GTM-XXXXXX
PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_XXX
STRIPE_SECRET_KEY=sk_test_XXX
STRIPE_WEBHOOK_SECRET=whsec_XXX
STRIPE_ID=acct_XXX
MG_API_KEY=XXX

Make sure you never expose sensitive credentials like API keys in frontend-accessible .env files.

When on server, use the netlify .env option to set the .env variables. Learn more here

4. Start the Development Server

Run the following command:

gatsby develop

5. Access your development site

Once the server starts, access the site and GraphQL schema – learn more in your browser:

This setup ensures fast, real-time development with Gatsby’s hot-reloading capabilities. 🚀

6. Use gatsby clean and gatsby build Commands

Clean the cache

If you encounter unexpected issues, clear Gatsby’s cache and restart the server:

gatsby clean

This removes all cached files and ensures Gatsby rebuilds everything from scratch.

7. Build the Production-Ready Site

To generate an optimized version of your site for deployment, run:

gatsby build

This command creates static files in the /public directory, ready to be deployed to Netlify, Vercel, or any static hosting provider.


8. Add Custom Node.js Packages

You can install additional Node.js packages to extend functionality. Use the preferred package manager:

Install a Package

yarn add package-name

or

pnpm add package-name

or

npm install package-name

Install a Package as a Dev Dependency

For packages only needed in development (e.g., linters, testing tools), use:

yarn add package-name --dev

or

pnpm add package-name --save-dev

or

npm install package-name --save-dev

Example: Adding Axios for API Calls

yarn add axios

Then, you can use it in your Gatsby project:

import axios from "axios";

axios.get("https://yourwordpresssite.com/graphql").then(response => {
console.log(response.data);
});

George

Written by George – The theme author, a passionate coder and web developer with years of experience, whose expertise led to the creation of superfunky theme and other various creative IT projects including WordPress plugins and headless, highly complex websites as well as code for custom business solutions and digital arts.

Leave a review

No reviews yet.

Drop us a message

We crate delightful web development projects that stand out with their architecture, design, content and performance.

Stay up to date with our progress.

25 / 7

Tailwind

Tailwind

Swiper

Swiper

Stripe

Stripe

Woo

Woo

WordPress

WordPress

React

React

Gatsby

Gatsby

Netlify

Netlify

Node

Node

PHP

PHP

Github

Github

GA4

GA4

Cookie Consent
We inform you that uses cookies for the proper functioning of our website, as well as for analytical and advertising purposes. Learn more about how we use cookies in our Privacy Policy.