docs
  1. Storefront Application
  2. Getting Started
  3. Set Up Your Storefront

Set up your Storefront

Overview

This guide walks you through setting up your local development environment, configuring the application, and running it in both development and production-like modes.

For information about what the Storefront Application is and its architecture, see What is Storefront?.

Prerequisites

Before you begin, ensure you have the following tools installed:

PackageVersionNote
gitlatest
nodeLTS (v22.19.x)
pnpmv10.xStarting with Storefront Application v1.11.x
dockerlatest

Install Node.js with NVM

The Storefront Application requires Node.js v22.19.0 or higher. nvm (Node Version Manager) simplifies installing and managing multiple Node.js versions.

Installing PNPM with Corepack

The Storefront Application uses PNPM as its package manager. Enable Corepack (included with Node.js) to manage package manager versions:

Set up Storefront Application

Step 1: Get the Source Code

The Storefront Application source code is distributed via a GitLab repository. Contact your SCAYLE Account Manager to obtain your GitLab Access Token (OAUTH token).

This GitLab Access Token provides read-only access via the command line using git to clone the storefront-boilerplate-nuxt-public repository. It doesn't grant additional access rights or ability to access the repository via the GitLab UI.

Clone the repository using the OAUTH token:

Step 2: Install Dependencies

Navigate to the project directory and install all required dependencies:

Step 3: Set Up Redis

Redis is required for caching and session management. The application includes a Docker Compose configuration for easy Redis setup.

Start the Redis service:

The Redis service runs on port 6379 and is accessible at localhost:6379.

Step 4: Configure Application

The SCAYLE Storefront CLI setup command simplifies the initial configuration by automatically generating configuration files based on your SCAYLE tenant space.

The setup command initializes a Storefront Application by fetching available shops from the SCAYLE Admin API using the provided tenant space.

Prerequisites for CLI setup

Run the setup command

The CLI tool performs the following actions:

  • Fetches available shops from the SCAYLE Admin API
  • Prompts you to select a shop
  • Generates the .env configuration file
  • Creates config/shops.ts with shop configurations
  • Generates locale translation files in i18n/locales/

Configure CMS (Optional)

To set up a CMS provider (Storyblok or Contentful), run the CMS setup command:

This command guides you through selecting a CMS provider and configuring the necessary options. For detailed CMS integration instructions, see the CMS Integrations documentation.

Step 5: Configure Additional Secrets

To run the Application, you still need to create and configure a few secrets:

SecretEnvironment Variable (.env)Purpose
Storefront API KeyNUXT_STOREFRONT_SAPI_TOKENAuthenticates requests to the Storefront API
OAuth Client IDNUXT_STOREFRONT_OAUTH_CLIENT_IDEnables OAuth authentication with SCAYLE Checkout
OAuth Client SecretNUXT_STOREFRONT_OAUTH_CLIENT_SECRETEnables OAuth authentication with SCAYLE Checkout
Checkout TokenNUXT_STOREFRONT_SHOPS_{SHOP_ID}_CHECKOUT_TOKENRequired for the Checkout Web Component
Checkout SecretNUXT_STOREFRONT_SHOPS_{SHOP_ID}_CHECKOUT_SECRETRequired for the Checkout Web Component

The {SHOP_ID} in environment variable names must match the shopId used in your shop configuration.

Step 6: Create Local HTTPS Certificate

Features like Checkout require a working HTTPS connection. Generate a local HTTPS certificate using the mkcert tool.

Install mkcert

Follow the mkcert installation instructions for your operating system.

Generate certificate

Add to local .env file

Your application will now be served on https://localhost:3000.

To disable HTTPS

Remove or comment out the HTTPS_KEY and HTTPS_CERT entries in your .env file:

The application will then run on http://localhost:3000.

Run Your Application

Step 7: Development Mode

Start the development server with hot-reloading:

The development server starts on http://localhost:3000 (or https://localhost:3000 if HTTPS is configured). Open your browser and navigate to the URL.

Step 8: Production-Like Preview

Build and preview the application in a production-like environment:

The preview server runs the built application from the .output/ directory, simulating how the application works in a production environment. Ensure Redis is running before starting the preview server.

Configuration

For detailed configuration options, see the Configuration Guide.

Shop Configuration

Shop configurations are defined in config/shops.ts. The Storefront CLI setup tool automatically generates this file. For manual configuration, see the Configuration Guide.

Environment Variables

The Storefront Application uses environment variables for runtime configuration. All Storefront-related variables that are not build-relevant use the NUXT_ prefix. Shop-specific variables use the pattern NUXT_STOREFRONT_SHOPS_{UNIQUE_IDENTIFIER}_{SETTING}, where {UNIQUE_IDENTIFIER} should match either shop.shopId (recommended) or shop.locale used in your shop configuration.

Best Practices

Shop Identifier Usage

Use shop.shopId as the unique identifier in shop configurations rather than shop.locale. This approach avoids conflicts when multiple shops share the same locale and provides clearer environment variable naming.

Environment Variable Management

  • Keep sensitive values in .env files and never commit them to version control.
  • Use .env.example as a template for required variables.
  • Document any custom environment variables in your project documentation.
  • Use descriptive variable names that clearly indicate their purpose.

Development Workflow

  • Always ensure Redis is running before starting the development server.
  • Use HTTPS in development when testing Checkout or other features that require secure connections.
  • Test both development and production-like preview modes before deploying.
  • Verify shop configurations match your SCAYLE Panel settings.

Configuration Validation

  • Verify that shop IDs in config/shops.ts match your SCAYLE Panel shop IDs.
  • Ensure translation files exist for all configured locales.
  • Check that environment variables use the correct shop identifier format.
  • Validate Redis connectivity before running the application.

Troubleshooting

Issue: Application fails to start with Redis connection errors

Possible causes:

  • Redis service is not running
  • Incorrect Redis host or port configuration
  • Network connectivity issues

Solution:

  1. Verify Redis is running: docker compose ps
  2. Check Redis connection settings in .env:
  3. Test Redis connection: redis-cli ping (should return PONG)
  4. Restart Redis service: docker compose restart redis

Prevention:

Always start Redis before running the application and verify connection settings match your Docker Compose configuration.

Issue: Shop configuration errors or missing shops

Possible causes:

  • Shop IDs in config/shops.ts don't match SCAYLE Panel shop IDs
  • Missing translation files for configured locales
  • Incorrect shop identifier in environment variables

Solution:

  1. Verify shop IDs in the SCAYLE Panel (Shops → Dashboard)
  2. Update config/shops.ts with correct shop IDs
  3. Ensure translation files exist in i18n/locales/ for all configured locales
  4. Check that environment variables use the correct shop identifier format

Prevention:

Use the Storefront CLI setup tool to automatically generate correct shop configurations.

Issue: HTTPS certificate errors in browser

Possible causes:

  • Certificate not properly generated with mkcert
  • Certificate files not found at specified paths
  • Browser doesn't trust the local certificate authority

Solution:

  1. Reinstall mkcert root certificate: mkcert -install
  2. Regenerate certificate files: mkcert --key-file localhost.pem --cert-file localhost.crt localhost
  3. Verify file paths in .env match actual file locations
  4. Clear browser cache and restart browser

Prevention:

Follow mkcert installation instructions completely and ensure the root certificate is installed in your system's trust store.

Issue: Checkout or authentication features not working

Possible causes:

  • Missing OAuth credentials
  • Missing or incorrect Checkout token and secret
  • HTTPS not properly configured

Solution:

  1. Verify OAuth credentials are set:
  2. Check Checkout configuration uses correct shop identifier:
  3. Ensure HTTPS is enabled and working
  4. Verify credentials in the SCAYLE Panel

Prevention:

Double-check all authentication-related environment variables and ensure HTTPS is properly configured for features that require it.

Issue: Environment variables not being applied

Possible causes:

  • Incorrect variable naming (missing NUXT_ prefix)
  • Wrong shop identifier in variable names
  • Variables defined after application startup

Solution:

  1. Verify variable names use the NUXT_ prefix
  2. Check that shop identifiers match your configuration (shopId or locale)
  3. Restart the development server after changing environment variables
  4. Review nuxt.config.ts to understand the expected variable format

Prevention:

Use the Storefront CLI setup tool to generate correct environment variable names, and always restart the server after configuration changes.

Further Education – SCAYLE Academy

Storefront

Storefront Crash Course

  • Intermediate
  • 5 lessons
  • 1h 55m