# AGENTS.md ## Overview Medusa DTC Starter — a Turborepo workspace monorepo containing a Medusa backend (`@medusajs/medusa` latest, Node 20+, PostgreSQL 15+) and an optional storefront (Next.js, Tanstack, etc...). ## Directory Structure ```text . ├── apps/ │ ├── backend/ # Medusa application (@dtc/backend) │ │ ├── medusa-config.ts # Medusa config: DB URL, CORS, secrets, modules │ │ ├── integration-tests/ # setup.js (Jest setupFiles) and http/*.spec.ts suites │ │ └── src/ │ │ ├── admin/ # Admin dashboard extensions (widgets/, i18n/, routes) │ │ ├── api/ # API routes: api/store/*, api/admin/* (file-based) │ │ ├── jobs/ # Scheduled jobs │ │ ├── links/ # Module links between modules │ │ ├── migration-scripts/# Data migration scripts (e.g. initial-data-seed.ts) │ │ ├── modules/ # Custom modules (service + models + migrations) │ │ ├── subscribers/ # Event subscribers │ │ └── workflows/ # Workflows and workflow steps │ └── storefront/ # OPTIONAL storefront ├── eslint.config.ts # Root ESLint: @medusajs/eslint-plugin recommended ├── turbo.json # Task graph: build, dev, start, lint, test, seed ``` **`apps/storefront` is optional and may not exist.** It is skipped when the user chooses not to install it. Before running any storefront command, referencing storefront files, or assuming a full-stack change is possible, check that `apps/storefront/` exists. If it doesn't, the project is backend-only — do not scaffold it or suggest it was deleted by mistake. Each app can have its own nested `AGENTS.md`; agents read the nearest one in the directory tree, so put app-specific context there rather than expanding this file. ## Package Manager **The package manager is chosen at install time and is not fixed.** Detect it before running anything, in this order: 1. The `packageManager` field in the root `package.json` (e.g. `"pnpm@10.11.1"`) — authoritative when present. 2. The lockfile at the repo root: `pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `package-lock.json` → npm. ```bash node -p "require('./package.json').packageManager ?? 'unset'" ls pnpm-lock.yaml yarn.lock package-lock.json bun.lock bun.lockb 2>/dev/null ``` Use that manager for every command and never introduce a second lockfile. Below, `` means the detected manager. The ` run