Skip to main content

Configuration for your launchpad

In short; everything is set up for you. You can start building your store right away. This launchpad also comes with a test drive payment gateway and a freight checkout. This means that you can test your store right out-the-box without having to set up a payment gateway or freight provider.

General setup

Environment variables

In the root of the project, you will find an .env.example file. This file contains all the environment variables that are needed for the project to run.

Tip

If you want to run your store with a multi market setup (with /market/language in the url), then just remove the DOMAINS variable and your site will default to multi market.

VariableDescriptionRequiredExample value
API_ENDPOINTThe API endpoint for your Geins Merchant APIYeshttps://url.com
API_KEYYour Geins Merchant API keyYes00000000-0000-0000-0000-000000000000
AUTH_ENDPOINTThe auth endpoint for your Geins Merchant APIYeshttps://url.com
SIGN_ENDPOINTThe sign endpoint for your Geins Merchant APIYeshttps://url.com
BASE_URLThe base URL for your store including http/https without ending slashYeshttps://url.com
FALLBACK_CHANNEL_IDThe fallback channel ID for your storeYes1ǀse
FALLBACK_MARKET_ALIASThe fallback market alias for your storeYesse
DEFAULT_LOCALEThe default locale for your storeYessv
RALPH_ENVThe environment for your store (dev, qa or prod)Nodev
DOMAINSThe domains for your store (if you want to use different domains for different languages/markets)Nosvǀwww.site.se,fiǀwww.site.fi

If you only have one market, your DOMAINS variable should look like this: DOMAINS=sv|www.site.se. For your local dev environment the equivalent would be DOMAINS=sv|localhost:3000.

Nuxt config

In the Nuxt config file nuxt.config.js you can set up most things, for example routes configuration and your runtime config (global variables that are accessed through the $config object). Please refer to the Nuxt Configuration Glossary for more information. We will dive deeper into our Nuxt config setup further down this page.

Channel settings

You will find some channel settings in config/channel-settings.js. This is a good place to set up and add variables that differs between channels. All variables added to the theme property will get converted into global CSS variables and can be used throughout the application. The channel settings are imported into the Nuxt config file as currentChannelSettings and can be used for setup there. This below is the default setup for the channel settings.

config/channel-settings.js
export const channelSettings = [
{
channelId: '1|se',
siteName: 'Ralph Storefront', // Change this to the name of your store
theme: {
'accent-color': '#131313', // Change this to yours
// Add more theme variables here if you like
},
},
];

Design setup

Assets

Add your desired logos and fonts etc to the assets folder. In the static folder, you should replace the favicon.ico, icon.png and the meta-image-fallback.jpg with your own. Here is also where you can add assets for your Geins generated emails, in the static/mail folder.

Icons

By default, the project comes with a set of icons from Feather Icons in the assets/icons folder. You can use these icons throughout the application, for example by using the CaIcon component. You can also add your own icons to this folder. To decrease the size of the site bundle, only the icons that are actively used in the project are included in the assets/icons folder. The rest of the icons you can find in the assets library folder in the root of the project.

Styles

In the styles folder, you'll find all the styles for the application. For the general setup, it is suggested to look through and adjust the files in the styles/variables folder, and also the styles/global and the styles/helpers folders.

All styles are written in SASS, and the styles are structured according to the BEM methodology.

Image sizes

To understand how to configure image sizes you will first need to have knowledge of how to work with the HTML img elements' sizes and srcset attributes. If you are not familiar with these attributes, you can read more about them here.

By default your project comes with a bunch of already configured image sizes. Most often you will not even have to change anything and can just roll with the pre-configured sizes.

If you do want to change for example the aspect ratio of your product images or add/remove image sizes, read more further down where we get more into detail about image sizes.

Nuxt.config.js

Here follows a guide on the most important parts of the nuxt.config.js file.

Internationalization (i18n)

In the i18n object, you can set up the internationalization settings for the project.

Languages

By default, the project comes with English, Swedish, Norwegian, Danish and Finnish. If you are not gonna use all of these languages, you should remove the ones you're not using from the locales array. If you want to add another language, add it to the array and create a new file in the languages folder with the same name as the language code.

nuxt.config.js
  return {
...
i18n: {
...
locales: [
{
code: 'en',
iso: 'en-US',
file: 'en-US.js',
name: 'English',
// Only used if you have multiple markets on DIFFERENT domains (using the DOMAINS env variable)
domain: domainUrls?.en || '',
},
...
],
...

Pages

In the pages object of the i18n object, you can name your routes that you want translated. The key is the name of the route and the value is the translation key.

nuxt.config.js
  return {
...
i18n: {
...
pages: {
'checkout/index': {
en: '/checkout',
sv: '/kassan',
},
...
},
...

The default setup comes with a bunch of translated routes for all the languages. You can remove the ones you're not gonna use.

PWA settings & loading bar

The PWA settings are used to configure the PWA. You can change the name, description and theme color of the PWA. This gives your store the look and feel of your brand. By default this is set from what your channel settings, but you can change it here if you like.

nuxt.config.js
  return {
...
// Loading bar color
loading: {
color: currentChannelSettings.theme['accent-color'],
height: '5px',
},
...
// PWA settings
pwa: {
manifest: {
name: currentChannelSettings.siteName,
short_name: currentChannelSettings.siteName,
description: fallbackMeta.description,
theme_color: currentChannelSettings.theme['accent-color'],
},
...
},
...

Router settings

The router settings are used to configure your routes. This launchpad comes with all the routes you need to get started. Although, you might need to add some own custom routes for your project, and this is where you do it.

nuxt.config.js
  return {
...
router: {
....
extendRoutes(routes, resolve) {
...
routes.push({
name: 'my-custom-page',
path: '/my-custom-path',
component: resolve(__dirname, 'pages/custom/my-page.vue'),
});
}
...

Runtime config (publicRuntimeConfig)

The runtime config is used to set up global variables that can be accessed throughout the application. This is where you set up the most important settings for your store.

Global settings

SettingDescriptionDefault valueType
ralphLogSettings for when to debug log different messages to the console{ onlyInClient: true, all: ralphEnv === 'dev', api: false, events: false, checkout: false, warnings: false }Object
ralphEnvThe environment for your store, by default not used by anything apart from setting ralphLog, but could be usefulprocess.env.RALPH_ENV or prodString
baseUrlThe base URL for your store including https:// and without ending slashprocess.env.BASE_URLString
imageServerThe image server urlprocess.env.IMAGE_SERVERString
authEndpointThe auth endpoint urlprocess.env.AUTH_ENDPOINTString
signEndpointThe sign endpoint urlprocess.env.SIGN_ENDPOINT.replace('{API_KEY}', process.env.API_KEY)String
apiKeyThe API key for your storeprocess.env.API_KEYString
apiEndpointThe API endpoint for your storeprocess.env.API_ENDPOINTString
fallbackChannelIdThe fallback channel ID for your storeprocess.env.FALLBACK_CHANNEL_IDString
fallbackMarketAliasThe fallback market alias for your storeprocess.env.FALLBACK_MARKET_ALIASString
currentChannelSettingsThe settings from config/channel-settings.js with the same id as fallbackChannelId-Object
channelSettingsAll channel settings from config/channel-settings.js-Array
fallbackMarketsAll available markets fetched in config/fallback-data.js-Array
imageSizesAll available image sizes parsed in config/image-sizes.js-Array
useStartPageNOTE! This has been removed from v23.0.0. Set this to true if you want to create a start page for selecting market/language in a multi market setupfalseBoolean
customerServiceEmailThe email for customer service[email protected]String
customerServicePhoneThe phone number for customer service+46 123 23 43 45String
breakpointsThe breakpoints you want to use for your store{ tablet: 768, laptop: 1024, desktop: 1200, desktopBig: 1440 }Object
siteTopThresholdThe threshold in pixels for when siteIsAtTop getter should be true10Number
socialMediaLinksThe social media links for your store, can for example be used to render social media icons for the footer[{ icon: 'facebook', title: 'Facebook', link: 'https://www.facebook.com' }, { icon: 'instagram', title: 'Instagram', link: 'https://www.instagram.com' }]Array
customerTypesToggleSet to true if you want to use the customer types featuretrueBoolean
customerTypesThe customer types you want to use[{ type: 'PERSON', vat: true }, { type: 'ORGANIZATION', vat: false }]Array
routePathsThe route paths setup in config/route-paths.js{category: '/c', brand: '/b', product: '/p', search: '/s', discountCampaign: '/dc', list: '/l'}Object
statesToPersistThe states of the store that you want to persist when page reloades. These states will be saved in a cookie called ralph-persisted-states['favorites', 'customerType', 'vatIncluded', 'list/relocateAlias', 'list/relocatePage']Array
searchProductsImageSizesThe image sizes attribute to use for the search products35pxString

CMS / Widget settings

SettingDescriptionDefault valueType
bannerWidgetPrimaryColorThe primary color for the banner widget#000000String
bannerWidgetSecondaryColorThe secondary color for the banner widget#FFFFFFString
productListWidgetArrowIconNameThe name of the icon to use for the arrow in the product list widgetchevronString
productListRowSizeThe default number of products per row in the product list widget5Number
widgetImageSizesThe images sizes attribute for the different column sizes{ full: '(min-width: 1920px) 1920px, 97vw', half: '(min-width: 1920px) 950px, (min-width: 768px) 48vw, 97vw', third: '(min-width: 1920px) 627px, (min-width: 768px) 32vw, 97vw', quarter: '(min-width: 1920px) 465px, (min-width: 768px) 24vw, 97vw', }Object
widgetImageSizesFullWidthThe images sizes attribute for the different column sizes when the widget area container is set to full width{ full: '100vw', half: '(min-width: 768px) 49vw, 100vw', third: '(min-width: 768px) 33vw, 100vw', quarter: '(min-width: 768px) 24vw, 100vw' }Object

Product lists

SettingDescriptionDefault valueType
productListDefaultSortThe default sorting for product listsLATESTString
productListPageSizeThe default page size for product lists20Number
productListScrollSizeThe number of products to scroll at a time when using the CaProductListSlider{ phone: 2, tablet: 3, laptop: 5, desktop: 5, desktopBig: 6 }Object
showCategoryFilterSet to true if you want to show the category filtertrueBoolean
showCategoryTreeViewFilterSet to true if you want to show the category filter as a tree viewtrueBoolean
showBrandsFilterSet to true if you want to show the brands filtertrueBoolean
showSkuFilterSet to true if you want to show the SKU filtertrueBoolean
showPriceFilterSet to true if you want to show the price filtertrueBoolean
showDiscountFilterSet to true if you want to show the discount filtertrueBoolean
customSortRoutesUse this to override productListDefaultSort for specific routes. Use the name of the route as name. Example: [{name: 'bestsellers', sort: 'MOST_SOLD'}][]Array
productCardBuyButtonSet to true if you want to show the buy button on the product card in product listsfalseBoolean

Product

SettingDescriptionDefault valueType
productImageRatioThe ratio for the product images. This is by default set in the config/image-sizes.json file1.25Number
productStockFewLeftLimitThe few left limit for stock to use in stock status6Number
productSchemaOptionsThe options for the product schema, make sure to change the schemaImageSize to an existing size of your site{ productSkuLabelIsSize: false, productDescriptionField: 'text1', schemaImageSize: '1000f1250', extraOfferProperties: { itemCondition: 'https://schema.org/NewCondition' } }Object
productShowRelatedSet to true if you want to fetch and show related products on product detail pagefalseBoolean
showProductReviewSectionSet to true if you want to show the product review section on the product detail pagefalseBoolean
showStarsInProductReviewFormSet to true if you want to show the stars in the product review formtrueBoolean
preLoadedProductImageSizesThe image sizes to preload for the product detail page['1000f1250']Array

Checkout

SettingDescriptionDefault valueType
checkout.promoCodesAccept promo codes on checkouttrueBoolean
checkout.shippingAddressAdd option to add separate shipping address when using CaCheckoutInvoicetrueBoolean
checkout.identityNumberAdd option to add identity number when using CaCheckoutInvoicetrueBoolean
checkout.entryCodeAdd option to add entry code when using CaCheckoutInvoicetrueBoolean
checkout.messageAdd option to add message when using CaCheckoutInvoicetrueBoolean
checkout.defaultPaymentIdThe default payment method id23Number
checkout.defaultShippingIdThe default shipping method id, needs to be set when useInternalShipping is set to truenullNumber
checkout.showMultipleMarketsSet to true if you want to show the country selector step in checkouttrueBoolean
checkout.useInternalShippingSet to true if you want to use the internal shipping methodfalseBoolean

Cart

SettingDescriptionDefault valueType
cart.hiddenSkuValuesDont show selected value for sku with these values in cart['-', 'One size']Array
cart.quantityChangerTypeQuantity changer type for items in cart. Options: default, round, stackeddefaultString
cart.productImageSizesThe image sizes attribute for the products in the cart(min-width: 768px) 80px, 53pxString

User

SettingDescriptionDefault valueType
user.genderShow user gender picker in 'my accounts' settingsfalseBoolean
user.countryShow user country picker in 'my accounts' settingsfalseBoolean

Getting more into detail

Customer types

If you want to use the customer types feature, you need to enable it and add the customer types. You can also enable or disable the VAT field for each customer type. Add the types you want to use according to set up in merchant center.

Tip

This feature is powerful and can be used to create different customer groups. For example, you can create a customer type for wholesale customers and a customer type for retail customers. You can then use this feature to create different prices for each customer type.

nuxt.config.js
  return {
...
publicRuntimeConfig: {
...
customerTypesToggle: true,
customerTypes: [
{
type: 'Retail',
vat: true
},
{
type: 'Wholesale',
vat: false
}
...

Image sizes

There are two parts of the image sizes set up. First, we need to provide a range of image sizes to feed the srcset attributes of all images. Then, we need to specify the sizes attributes for all the different places where images appears.

srcset attributes

In the config/image-sizes.json file (since Ralph Storefront v2.5.0+), you can set up what type of images you want to be available to use. When this is set up, you can use the npm run ralph-image-sizes to generate the config/image-sizes.csv file. This generated csv file is formatted to be imported into the image size table, which is used by our image scaling service.

During the build of the storefront, the csv file will be parsed and all available image sizes will be saved to the $config.imageSizes object, where the keys will be the type of image. So to feed a CaImage component with the available image sizes for a product, you can use the $config.imageSizes.product array in the sizeArray prop and the component will generate the full srcset attribute for you.

sizes attributes

When you have provided all available image sizes for the srcset attributes, you can set up the sizes attribute for all the different places where images appears. This is done differently depending on what image you want to specify sizes for.

If you're straight up using the CaImage component, you can use the sizes prop to specify the sizes string for the image. For the CaProductGallery they are set in mainImagSizes and thumbnailImageSizes props. For the CMS you can set all sizes attributes for different column widths in the widgetImageSizes object in the runtime config.

nuxt.config.js
  return {
...
publicRuntimeConfig: {
...
widgetImageSizes: {
full: '(min-width: 1920px) 1920px, 97vw',
half: '(min-width: 1920px) 950px, (min-width: 768px) 48vw, 97vw',
third: '(min-width: 1920px) 627px, (min-width: 768px) 32vw, 97vw',
quarter: '(min-width: 1920px) 465px, (min-width: 768px) 24vw, 97vw',
},
...
}

Image types

The type / folder is used in tha CaImage property type and as the key in the $config.imageSizes object. The name is used in the config/image-sizes.json file.

NameType / FolderDescription
productproductProduct images
cmspagewidgetCMS images
categorycategoryheaderCategory images (Deprecated)
brandbrandBrand images (Deprecated)

Using config/image-sizes.json

This file consists of an array of objects where each object represents an image type and sizing instructions. You can add more than one object with the same type.

Example

The settings below will set up product image sizes from the width of 100px to 2000px with an aspect ratio of 4:5. This will give you a set of images like 100x125px, 200x250px, 300x375px and so on.

For the CMS images, it is set to scale an image on every 100 pixels from 100px to 1000px and then every 500 pixels from 1500px to 4000px with the original aspect ratio. This will result in images with widths like 100px, 200px, 300px and so on for the first set and 1500px, 2000px, 2500px and so on for the second set.

config/image-sizes.json
{
"imageSizes": [
{
"type": "product",
"aspectRatio": "4:5",
"startWidth": 100,
"endWidth": 2000,
"resizeFunction": "f",
"incrementStep": 100
},
{
"type": "cms",
"aspectRatio": "",
"startWidth": 100,
"endWidth": 1000,
"resizeFunction": "w",
"incrementStep": 100
},
{
"type": "cms",
"aspectRatio": "",
"startWidth": 1500,
"endWidth": 4000,
"resizeFunction": "w",
"incrementStep": 500
}
]
}

Here follows a detailed description of the properties of the objects in the config/image-sizes.json file:

PropertyDescriptionType
typeProvide the "Name" from the image type table aboveString
aspectRatioThe aspect ratio of the image. If you want to keep the original aspect ratio, leave this empty. Must be in format "0:0"String
startWidthThe smallest width you want the image to be resized to in pixelsNumber
endWidthThe largest width you want the image to be resized to in pixelsNumber
resizeFunctionThe function to use for resizing. f is used to not crop but fill with white, c is used to crop from center, x is used to crop from top and w is used to only resize width, keeping the relative heightString
incrementStepThe step to increment the image width with on each rowNumber

When you have set up the config/image-sizes.json file, you can run the npm run ralph-image-sizes command to generate the config/image-sizes.csv file.

Next step: Working with Components

Now that you have set up your configuration, you can start working with the components in your store. Head over to the Components section to learn more about the components in this launchpad.