Getting started
Commerce Klaus is a set of focused packages. Adopt only the parts your project needs, or combine them into one consistent SFCC development workflow.
Requirements
- Node.js 22.12 or newer
- An SFCC cartridge project
- pnpm, npm, or Yarn
Recommended setup
Start with static runtime checks and cartridge-aware types:
pnpm add -D eslint typescript @salesforce/b2c-cli \
@commerce-klaus/eslint-config-sfcc \
@commerce-klaus/typescript-sfccyarn add -D eslint typescript @salesforce/b2c-cli \
@commerce-klaus/eslint-config-sfcc \
@commerce-klaus/typescript-sfccnpm install -D eslint typescript @salesforce/b2c-cli \
@commerce-klaus/eslint-config-sfcc \
@commerce-klaus/typescript-sfccAdd the recommended ESLint flat config:
import { defineConfig } from "eslint/config"
import sfcc from "@commerce-klaus/eslint-config-sfcc"
export default defineConfig(sfcc.configs.recommended)Enable cartridge-aware TypeScript resolution:
{
"compilerOptions": {
"plugins": [{ "name": "@commerce-klaus/typescript-sfcc" }]
}
}Synchronize Salesforce types and check the cartridges:
pnpm exec sfcc-ts-sync-types
pnpm exec sfcc-ts-typecheckAdd local module resolution
Choose the adapter that matches the tool running your server-side code:
- Use the Vite plugin for Vite and Vitest.
- Use the Babel plugin for existing Babel-based tests and tooling.
Both use the same resolver core, so */, ~/, cartridge aliases, and module.superModule follow the same ordering rules.
Complete example
See the ESLint, TypeScript, and Vite SFCC example for a runnable two-cartridge setup. It demonstrates a shared cartridge path loaded from the site template, generated SFCC types, custom attributes, hooks, a Custom API, cartridge overrides, and a Vitest integration test.
For a smaller Vite+ setup, see the Oxlint and ESLint SFCC example. It runs the Oxlint-compatible SFCC rules through Vite+ and follows them with the minimal ESLint fallback while using the same TypeScript and Vite module resolution.