1 ---
2 date: 2026-01-05T07:06:33Z
3 researcher: Claude
4 git_commit: 43305a562cfba914654da056b0a7e03c40849678
5 branch: develop
6 repository: medusa-core
7 topic: "CLAUDE.md File Creation Research"
8 tags: [research, codebase, claude-md, documentation, conventions]
9 status: complete
10 last_updated: 2026-01-05
11 last_updated_by: Claude
12 ---
13
14 # Research: CLAUDE.md File Creation for Medusa Core
15
16 **Date**: 2026-01-05T07:06:33Z
17 **Researcher**: Claude
18 **Git Commit**: 43305a562cfba914654da056b0a7e03c40849678
19 **Branch**: develop
20 **Repository**: medusa-core
21
22 ## Research Question
23
24 Research the Medusa Core codebase to gather information needed to create a CLAUDE.md file following Claude Code best practices. The file should be concise and focused.
25
26 ## Summary
27
28 This research documents the Medusa Core monorepo structure, build system, testing conventions, and code style to enable creation of an effective CLAUDE.md file. Key findings:
29
30 - **Monorepo**: Yarn 3 workspaces with Turbo orchestration
31 - **Stack**: Node.js 20+, TypeScript 5.6.2, Express, MikroORM/PostgreSQL
32 - **30+ modules**: Product, Order, Cart, Payment, Fulfillment, etc.
33 - **Admin**: React 18 dashboard with Vite
34 - **Testing**: Jest for backend, Vitest for frontend
35
36 ## Detailed Findings
37
38 ### 1. Codebase Structure
39
40 **Monorepo Organization:**
41 ```
42 /packages/
43 ├── medusa/ # Main Medusa package
44 ├── core/ # Core framework packages
45 │ ├── framework/ # Core runtime
46 │ ├── types/ # TypeScript definitions
47 │ ├── utils/ # Utilities
48 │ ├── workflows-sdk/ # Workflow composition
49 │ ├── core-flows/ # Predefined workflows
50 │ └── modules-sdk/ # Module development
51 ├── modules/ # 30+ commerce modules
52 │ ├── product/, order/, cart/, payment/...
53 │ └── providers/ # 15+ provider implementations
54 ├── admin/ # Dashboard packages
55 │ └── dashboard/ # React admin UI
56 ├── cli/ # CLI tools
57 └── design-system/ # UI components
58 /integration-tests/ # Full-stack tests
59 /www/ # Documentation site
60 ```
61
62 **Key Directories:**
63 - `packages/core/framework/` - Core runtime, HTTP, database
64 - `packages/medusa/src/api/` - API routes
65 - `packages/modules/` - Commerce feature modules
66 - `packages/admin/dashboard/` - Admin React app
67
68 ### 2. Build System & Commands
69
70 **Package Manager**: Yarn 3.2.1 with node-modules linker
71
72 **Essential Commands:**
73 ```bash
74 # Install dependencies
75 yarn install
76
77 # Build all packages
78 yarn build
79
80 # Build specific package
81 yarn workspace @medusajs/medusa build
82
83 # Watch mode (in package directory)
84 yarn watch
85
86 # Lint
87 yarn lint
88
89 # Format
90 yarn prettier --write <files>
91 ```
92
93 **Testing Commands:**
94 ```bash
95 # All unit tests
96 yarn test
97
98 # Package integration tests
99 yarn test:integration:packages
100
101 # HTTP integration tests
102 yarn test:integration:http
103
104 # API integration tests
105 yarn test:integration:api
106
107 # Module integration tests
108 yarn test:integration:modules
109 ```
110
111 ### 3. Testing Conventions
112
113 **Frameworks:**
114 - Jest 29.7.0 (backend/core)
115 - Vitest 3.0.5 (admin/frontend)
116
117 **Test Locations:**
118 - Unit tests: `__tests__/` directories alongside source
119 - Module integration tests: `packages/*/integration-tests/__tests__/`
120 - HTTP integration tests: `integration-tests/http/__tests__/`
121
122 **Test Runners:**
123 - `medusaIntegrationTestRunner` - HTTP integration tests
124 - `moduleIntegrationTestRunner` - Module integration tests
125 - Both from `@medusajs/test-utils`
126
127 **Patterns:**
128 - File extension: `.spec.ts` or `.test.ts`
129 - Unit test structure: `describe/it` blocks
130 - Integration tests: Use custom test runners with DB setup
131
132 ### 4. Code Style Conventions
133
134 **Formatting (Prettier):**
135 - No semicolons
136 - Double quotes
137 - 2 space indentation
138 - ES5 trailing commas
139 - Always use parens in arrow functions
140
141 **TypeScript:**
142 - Target: ES2021
143 - Module: Node16
144 - Strict null checks enabled
145 - Decorators enabled (experimental)
146
147 **Naming Conventions:**
148 - Files: kebab-case (`define-config.ts`)
149 - Types/Interfaces/Classes: PascalCase
150 - Functions/Variables: camelCase
151 - Constants: SCREAMING_SNAKE_CASE
152 - DB fields: snake_case
153
154 **Import Organization:**
155 1. @medusajs/framework imports (grouped by subpath)
156 2. External npm packages
157 3. Node.js built-ins
158 4. Relative local imports
159
160 **Export Patterns:**
161 - Barrel exports via `export * from`
162 - Named re-exports for specific items
163
164 ## Code References
165
166 - Root package.json: `package.json`
167 - ESLint config: `.eslintrc.js`
168 - Prettier config: `.prettierrc`
169 - TypeScript base: `_tsconfig.base.json`
170 - Turbo config: `turbo.json`
171 - Contributing guide: `CONTRIBUTING.md`
172 - Jest config: `jest.config.js`
173 - Yarn config: `.yarnrc.yml`
174
175 ## Recommended CLAUDE.md Structure
176
177 Based on research, the CLAUDE.md should include:
178
179 1. **Project Overview** - Brief description of Medusa as commerce platform
180 2. **Quick Commands** - Build, test, lint commands
181 3. **Code Style** - Key formatting/naming conventions
182 4. **Architecture Notes** - Module system, workflows, admin
183 5. **Testing** - How to run tests, test patterns
184 6. **Key Directories** - Where to find important code
185
186 Keep each section to 3-5 bullet points maximum for conciseness.
187
188 ## Open Questions
189
190 None - sufficient information gathered for CLAUDE.md creation.