Engineering Design
Node, nvm & Tooling

Node, nvm & Tooling

.nvmrc

A .nvmrc file at the repo root pins the Node version. Anyone running nvm use gets the correct version automatically. CI reads this file too.

# .nvmrc (both backend/ and frontend/ root)
20

Version Pinning Policy

Phase 1: pin all @medusajs/* packages to exact versions (no ^ or ~). Medusa minor releases sometimes contain breaking changes. Update deliberately, test in staging first.

PackageVersion policyReason
@medusajs/medusaExact: 2.13.3Breaking changes in minor releases
@medusajs/js-sdkExact: pin to match medusaMust stay in sync
nextExact: 14.x.xApp Router API changes between minors
stripeExact: pinAPI version tied to webhook version
TypeScriptExact: 5.xType inference can change between patches
devDependencies^ range OKOnly affects local dev

Claude Code Plugin (Medusa-specific)

Once the backend is initialised, install the official Medusa Claude Code plugin. This gives Claude Code knowledge of DML data models, workflows, module isolation, and API route patterns specific to Medusa v2.

# Inside the project directory in Claude Code
/plugin marketplace add medusajs/medusa-claude-plugins
/plugin install medusa-dev@medusa

Essential Tooling Stack

ToolPurposeConfig file
nvmNode version management.nvmrc
ESLintLinting.eslintrc.json
PrettierFormatting.prettierrc
TypeScriptType checkingtsconfig.json
HuskyGit hooks.husky/
lint-stagedRun checks on staged files.lintstagedrc.json
ZodRuntime validation on all custom endpointssrc/api/*/validators.ts

Pre-Commit Hook Pipeline

# .husky/pre-commit
npx lint-staged
// .lintstagedrc.json
{
  "*.{ts,tsx}": ["eslint --fix", "prettier --write", "tsc --noEmit"],
  "*.{js,json,md}": ["prettier --write"]
}