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:
| Package | Version | Note |
|---|---|---|
git | latest | |
node | LTS (v22.19.x) | |
pnpm | v10.x | Starting with Storefront Application v1.11.x |
docker | latest |
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
- Admin API token from the SCAYLE Panel
- Tenant space identifier
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
.envconfiguration file - Creates
config/shops.tswith 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:
| Secret | Environment Variable (.env) | Purpose |
|---|---|---|
| Storefront API Key | NUXT_STOREFRONT_SAPI_TOKEN | Authenticates requests to the Storefront API |
| OAuth Client ID | NUXT_STOREFRONT_OAUTH_CLIENT_ID | Enables OAuth authentication with SCAYLE Checkout |
| OAuth Client Secret | NUXT_STOREFRONT_OAUTH_CLIENT_SECRET | Enables OAuth authentication with SCAYLE Checkout |
| Checkout Token | NUXT_STOREFRONT_SHOPS_{SHOP_ID}_CHECKOUT_TOKEN | Required for the Checkout Web Component |
| Checkout Secret | NUXT_STOREFRONT_SHOPS_{SHOP_ID}_CHECKOUT_SECRET | Required 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
.envfiles and never commit them to version control. - Use
.env.exampleas 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.tsmatch 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:
- Verify Redis is running:
docker compose ps - Check Redis connection settings in
.env: - Test Redis connection:
redis-cli ping(should returnPONG) - 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.tsdon't match SCAYLE Panel shop IDs - Missing translation files for configured locales
- Incorrect shop identifier in environment variables
Solution:
- Verify shop IDs in the SCAYLE Panel (Shops → Dashboard)
- Update
config/shops.tswith correct shop IDs - Ensure translation files exist in
i18n/locales/for all configured locales - 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:
- Reinstall mkcert root certificate:
mkcert -install - Regenerate certificate files:
mkcert --key-file localhost.pem --cert-file localhost.crt localhost - Verify file paths in
.envmatch actual file locations - 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:
- Verify OAuth credentials are set:
- Check Checkout configuration uses correct shop identifier:
- Ensure HTTPS is enabled and working
- 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:
- Verify variable names use the
NUXT_prefix - Check that shop identifiers match your configuration (shopId or locale)
- Restart the development server after changing environment variables
- Review
nuxt.config.tsto 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.