Webstore Development & Page Builder Setup Guide

TABLE OF CONTENTS


Introduction

This article provides a step-by-step walkthrough for setting up a development environment, configuring Webstore-required services, and running the platform locally. Whether customizing themes, building new components, or managing content visually, this document provides the necessary instructions for a seamless development experience.

Prerequisites

Before beginning, ensure the following tools are installed:

Recommended Visual Studio Code Extensions (Optional)

These extensions help improve code quality and consistency:

  • Code Spell Checker – Catch spelling issues in code and comments
  • Bundle Size – Visualize the impact of imports
  • Git History – View git logs and file history
  • Prettier – Auto-format code on save
  • ESLint – Enforce consistent JavaScript/TypeScript style
  • SonarLint – Detect bugs and code smells in real-time

Tech Stack

All required components are installed automatically through the CLI tool.

Components:

  • Node.js and Next.js:
    Node.js is used as the runtime environment, and Next.js is the framework for web application development.
  • HTML, CSS, Tailwind CSS:
    Used for content structure and styling with responsive design.
  • Redis:
    Utilized as a caching mechanism for efficient data access.
  • JavaScript and React:
    JavaScript handles scripting and interactivity. React is used for building dynamic user interfaces.
  • NX:
    NX is used for managing the monorepo, including both Page Builder and Webstore.
  • IDE:
    Visual Studio Code is the recommended integrated development environment.

Project Architecture

Refer to the “Znode 10 Webstore Architecture” document for architecture details.

Environment Setup

Step 1: Znode CLI Tool

Follow the Znode 10 CLI setup guide to download the Webstore SDK locally. Refer to the “How to Install and Setup Znode CLI” document for additional details.

Step 2: Navigate to Repository

Navigate to the directory where the codebase has been downloaded:

cd webstore-platform

Note: There are two variations of the apps:

  • Webstore
  • Page Builder

Step 3: Install Dependencies

Run the following command:

npm install

Step 4: Configure Environment Variables

Both the Webstore and Page Builder applications include pre-generated .env files. Open and update the following files:

  • webstore/.env
  • page-builder/.env

Update the values of the required environment variables:

KeyDescription
API_URLThe base URL for the primary back-end API
API_DOMAINDomain name used to route API calls
API_V2_DOMAINEndpoint for version 2 of the back-end API
API_KEYAuthentication key used to authorize API requests

Step 5: Run Locally
Start Webstore

npx nx dev webstore

Access the Webstore at: http://localhost:3000

Key Features:

  • Page rendering from JSON (Page Builder output)
  • SEO-friendly routes
  • Modular components and reusable themes

Start Page Builder

npx nx dev page-builder

Access Page Builder at: http://localhost:3000

Preview a Page in the Webstore

To preview and edit a specific section in the Webstore using Page Builder, use the following URL:

http://localhost:3000/en-US/page-builder?url=header&theme=base&publishState=preview&themeCode=base&storeCode=MaxwellsHardware&pageCode=Header


Query Parameters

ParameterDescription
urlComponent or page to be edited (e.g., header)
themeTheme name (e.g., base, dark-mode)
publishStateState (e.g., preview, published)
themeCodeInternal reference for the theme
storeCodeIdentifies the store (e.g., MaxwellsHardware)
pageCodePage section identifier (e.g., Header, Footer)

Features

  • Drag-and-drop page sections
  • Component library
  • Save as JSON block structure

Enable Real-Time Changes Between Page Builder and Webstore

To reflect changes instantly from Page Builder to Webstore, disable caching and enable debug mode:

In page-builder/.env, set:

IS_DEBUGGING=true


In webstore/.env, set:

IS_DEBUGGING=true
ENABLE_CACHE=false

Enable the Publish Button in Page Builder

To allow publishing changes from Page Builder:

  • Open the following file:
packages/page-builder/src/constants/visual-editor.ts
  • In the VISUAL_EDITOR_SETTINGS object, update:

ENABLE_EDIT_WIDGET: true

Important: Ensure a corresponding domain entry exists in the Znode domain database table for proper routing and preview functionality.

Step 5: Run Production Build Locally

Ensure the working directory contains files such as package.json, nx.json, and next.config.js.

To build and run the application in production mode:

npx nx start webstore

Access the application at: http://localhost:3000

Quick Links

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.