For descriptions of the configuration options, see Configuration Options Reference in the storefront-next-template GitHub repo.
The configuration is organized into three main sections.
Section
Purpose
Client Access
metadata
Project name and slug for deployment
Server only
runtime
SSR and deployment settings
Server only
app
Application settings (commerce, features, UI)
Server and client
The app section is automatically made available to client-side code. The metadata and runtime sections remain server-only.
The runtime.ssrOnly option accepts an array of glob patterns for files that must be available on the server but aren’t publicly accessible from the client. Use this option for server-side resources that aren’t exposed via public URLs.
Don’t import config.server.ts directly in your app code. While the .server.ts suffix prevents the file from being bundled into client-side code (a React Router framework feature), always use getConfig() or useConfig() to access configuration values. These APIs ensure that the configuration is properly loaded and available in the correct context.
Warning
Minimum Required Configuration
To start the storefront, set B2C Commerce API credentials in a .env file at your project root. All the other settings have a working default in config.server.ts. Declare them only if you want to override their values.
The Storefront Next template includes an .env.default file pre-filled with public demo credentials. Copy it to .env to get started.
1cp .env.default .env
Public Client (Default)
A public SLAS client needs three variables. These values are safe to expose to the browser, so they use the PUBLIC__ prefix.
B2C Commerce organization or realm ID (for example, f_ecom_zzrf_001)
PUBLIC__app__commerce__api__shortCode
SCAPI short code for your tenant (for example, kv7kzm78)
Private Client
A private SLAS client uses the same three variables, plus a feature flag that switches authentication into private-client mode and a server-only secret that signs token requests.
1# Client-safe values (PUBLIC__ prefix bundled to the browser)2PUBLIC__app__commerce__api__clientId=your-client-id3PUBLIC__app__commerce__api__organizationId=your-org-id4PUBLIC__app__commerce__api__shortCode=your-short-code5PUBLIC__app__commerce__api__privateKeyEnabled=true67# Server-only secret — never use the PUBLIC__ prefix8COMMERCE_API_SLAS_SECRET=your-slas-secret
Don’t add COMMERCE_API_SLAS_SECRET to config.server.ts and don’t give it a PUBLIC__ prefix. Read it directly from process.env in server-side code, such as loaders, actions, and middleware. Anything with the PUBLIC__ prefix is bundled into the browser-visible JavaScript.
To deploy your storefront to Managed Runtime, also set the deployment variables that the Storefront Next CLI reads. See Storefront Next CLI.
Optional Configuration
Every other setting has a working default in config.server.ts. To override one, use a PUBLIC__ environment variable with the path syntax described in Environment Variable Overrides.
For feature-specific configuration, see the dedicated guides.
Override any configuration value by using environment variables with the PUBLIC__ prefix. With environment variables, you can customize settings per environment (development, staging, production) without modifying code.
Path Syntax
Use double underscores (__) to navigate nested configuration paths.
Environment variables are deep merged into the defaults from config.server.ts. Only the values you specify are overridden. Everything else keeps its default.
1// In a component2const config = useConfig();3if(config.myFeature.enabled){4 // Feature is enabled5}67// In a loader8const config = getConfig(context);9const limit = config.myFeature.maxItems;
Deployment
When deploying to Managed Runtime (MRT), set your environment variables in the Runtime Admin.
Log in to the Runtime Admin.
Navigate to your project → Environment Variables.
Add the required PUBLIC__ variables.
Add any server-only secrets without the PUBLIC__ prefix.
Deploy your app.
MRT has limits: variable names max 512 characters, total PUBLIC__ values max 32 KB. Use JSON to consolidate related settings if needed.
Note
Troubleshooting
Changed .env but Nothing Happened?
Restart your dev server. Environment variables are loaded at startup.
Environment Variable Not Working?
Verify the variable name starts with PUBLIC__ (double underscore after PUBLIC)
Check the .env file is in the project root
Ensure that the path exists in config.server.ts—you can only override existing paths
Type Errors After Adding Configuration?
Update both src/config/schema.ts (types) and config.server.ts (defaults) to match.
The configuration system validates that environment variable paths exist in your config. If you see an error like "local" doesn't exist, check for typos. The system suggests similar valid paths when possible.