v2.0.0-rc
medusajs/medusav2.0.0-rcOct 1, 2024by olivermrbl
AI Summary
The first Release Candidate for Medusa v2.0 introduces significant architectural changes, including a major package restructuring that bundles modules into `@medusajs/medusa` and `@medusajs/framework`, along with the introduction of a redesigned admin interface and Next.js storefront.
Key Highlights
- Package restructuring to reduce dependencies and footprint
- TSConfig file changes requiring `moduleResolution: Node16`
- medusa-config.js updates using subpath imports (e.g., `@medusajs/medusa/auth`)
- Introduction of Query tool (replacing Remote Query)
- Redesigned admin and 2.0-compatible Next.js storefront project structure
Breaking Changes
- Package restructuring (bundling modules into main packages)
- TSConfig file changes (require `moduleResolution: Node16`)
- medusa-config.js file changes (use subpath imports for modules)
New Features
- Index module foundation
- Manage inventory placeholder in dashboard
- Provide a similar API to Query
- Login and invite redesign in dashboard
- Pass stock location data to fulfillment provider
Full Release Notes
<!--

# Medusa v2.0 Release Candidate #1
CMS_BREAK -->
We’re excited to share the first Release Candidate (RC) of Medusa 2.0. By definition, release candidates are not production-ready. There are likely still minor issues across our packages, which is part of the reason for publishing a pre-release of the official version.
We welcome feedback, questions, and bug reports. Please use [Issues](https://github.com/medusajs/medusa/issues) to submit your input.
## Get started with a new project
To get started using the RC, run the following command:
```bash
npx create-medusa-app@rc
```
This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.
## Highlights
**Please note, the following highlights are based on changes that have landed between the last preview release update and this release candidate.**
We will cover all new changes to Medusa 2.0 in the official release notes. For now, you can refer to previous preview release updates to see what's new.
### Package restructuring
> [!WARNING]
Breaking change
With the announcement of the first Release Candidate, we decided to perform some housekeeping tasks and arrange our packages/dependencies. This is the last larger breaking change before the official release of 2.0.
Our goal with this change is to reduce the footprint of multiple packages within your application. Instead, we expose all the core-level utilities via the `@medusajs/framework` package and all commerce features via the `@medusajs/medusa` package.
As a result, you will have fewer dependencies to install and upgrade with every change. We will also be able to restructure things internally without impacting outside usage.
**Dependencies**
Moving forward, the dependencies inside a fresh Medusa application's `package.json` file will look as follows:
```json
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"awilix": "^8.0.1",
"pg": "^8.13.0"
},
"devDependencies": {
"@mikro-orm/cli": "5.9.7",
"@swc/jest": "^0.2.36",
"medusa-test-utils": "rc",
"jest": "^29.7.0",
"@types/node": "^20.0.0",
"@swc/core": "1.5.7",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^5.2.11"
},
}
```
You don't have to install individual modules since they are all bundled and distributed via the `@medusajs/medusa` package.
**TSConfig file changes**
Now that most packages have been bundled into `@medusajs/medusa` and `@medusajs/framework, importing from the transitive dependencies should be done with subpaths.
For example, this is how a link definition will look like:
```diff
import HelloModule from "../modules/hello"
- import ProductModule from "@medusajs/product"
+ import ProductModule from "@medusajs/medusa/product"
- import { defineLink } from "@medusajs/utils"
+ import { defineLink } from "@medusajs/framework/utils"
export default defineLink(
ProductModule.linkable.product,
HelloModule.linkable.myCustom
)
```
In the above example, we import the `product` module from the `@medusajs/medusa/product` subpath and the `defineLink` from the `@medusajs/framework/utils` subpath.
To use subpath imports, the `moduleResolution` should be set to Node16 inside the tsconfig.json file:
```json
{
"module": "Node16",
"moduleResolution": "Node16",
}
```
**`medusa-config.js` file changes**
With the introduction of subpath imports, the module registration in `medusa-config.js` should similarly use subpaths instead of top-level paths.
For example, this is how you would register the authentication module:
```diff
defineConfig({
// ...
modules: {
- resolve: "@medusajs/auth",
+ resolve: "@medusajs/medusa/auth",
options: {
providers: [
{
- resolve: "@medusajs/auth-emailpass",
+ resolve: "@medusajs/medusa/auth-emailpass",
id: "emailpass",
options: {
// provider options...
},
},
],
},
},
})
```
Notice the change from `@medusajs/auth` to `@medusajs/medusa/auth` and `@medusajs/auth-emailpass` to `@medusajs/medusa/auth-emailpass`.
## Features
* feat(index): Index module foundation by @adrien2p in https://github.com/medusajs/medusa/pull/9095
* feat(dashboard): manage inventory placeholder by @fPolic in https://github.com/medusajs/medusa/pull/9190
* feat(index): Provide a similar API to Query by @adrien2p in https://github.com/medusajs/medusa/pull/9193
* feat(dashboard): login and invite redesign by @fPolic in https://github.com/medusajs/medusa/pull/9214
* feat(core-flows,dashboard,types,fulfillment,medusa): uses requires shipping throughout lifecycle by @riqwan in https://github.com/medusajs/medusa/pull/9170
* feat(utils): define read only link by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9254
* feat(medusa,fulfillment): pass stock location data to fulfillment provider by @srindom in https://github.com/medusajs/medusa/pull/9322
* feature: bundle all modules by @thetutlage in https://github.com/medusajs/medusa/pull/9324
## Bugs
* fix(workflow-sdk): Use the correct event group ID from the flow metadata by @adrien2p in https://github.com/medusajs/medusa/pull/9177
* fix(workflow-engine-*): pass container to flow by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9180
* fix(medusa-test-utils): get port should a deps for now by @adrien2p in https://github.com/medusajs/medusa/pull/9198
* fix(dashboard): open edit variant modal in current context by @fPolic in https://github.com/medusajs/medusa/pull/9203
* fix(types): fixes to HTTP types by @shahednasser in https://github.com/medusajs/medusa/pull/9189
* fix(oas): support additional props, fix circular references patch, and other fixes by @shahednasser in https://github.com/medusajs/medusa/pull/9213
* fix(oas): handle new keys in circular reference patch by @shahednasser in https://github.com/medusajs/medusa/pull/9218
* fix(user): check if user account with email already exist on invite create by @fPolic in https://github.com/medusajs/medusa/pull/9243
* fix(dashboard): PL creation - customers table customers count by @fPolic in https://github.com/medusajs/medusa/pull/9237
* fix(dashboard): prices validation in PL bulk editor by @fPolic in https://github.com/medusajs/medusa/pull/9245
* fix(dashboard): minor collection bugs by @fPolic in https://github.com/medusajs/medusa/pull/9255
* fix(dashboard): customer groups table fileds by @fPolic in https://github.com/medusajs/medusa/pull/9262
* fix(dashboard): customer groups fixes by @fPolic in https://github.com/medusajs/medusa/pull/9258
* fix(dashboard): pagination in invite table by @fPolic in https://github.com/medusajs/medusa/pull/9259
* fix(core-flows): line item type collection by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9251
* fix(pricing): calculate pricing repository query by @fPolic in https://github.com/medusajs/medusa/pull/9265
* fix: Add missing await when refetching region by @sradevski in https://github.com/medusajs/medusa/pull/9283
* fix(orchestration): Throw if not exists using filters by @adrien2p in https://github.com/medusajs/medusa/pull/9275
* fix: add missing dependency to utils package by @thetutlage in https://github.com/medusajs/medusa/pull/9297
* fix: Add actor type to password reset event by @sradevski in https://github.com/medusajs/medusa/pull/9301
* fix(modules-sdk): Fix dynamic import usage by @adrien2p in https://github.com/medusajs/medusa/pull/9304
* fix(dashboard): login alert background by @fPolic in https://github.com/medusajs/medusa/pull/9305
* fix(types): remove BigNumberValue usages in http types by @shahednasser in https://github.com/medusajs/medusa/pull/9285
* fix: Generated types interface name by @adrien2p in https://github.com/medusajs/medusa/pull/9307
* fix: base tsconfig by @adrien2p in https://github.com/medusajs/medusa/pull/9309
* fix(types, medusa): fixes to HTTP types by @shahednasser in https://github.com/medusajs/medusa/pull/9273
* fix(modules-sdk): default db options by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9313
* fix(dashboard): set/unset automatic taxes on a region by @fPolic in https://github.com/medusajs/medusa/pull/9315
* fix(types): fix order DTO types by @shahednasser in https://github.com/medusajs/medusa/pull/9323
* fix(dashboard): variant update success toast by @fPolic in https://github.com/medusajs/medusa/pull/9325
* fix(create-medusa-app): fix publishable api key not saving in .env.local by @shahednasser in https://github.com/medusajs/medusa/pull/9328
* fix: Bind abort controller to abort in sdk by @sradevski in https://github.com/medusajs/medusa/pull/9341
* fix: remove dist access for modules in integration tests by @adrien2p in https://github.com/medusajs/medusa/pull/9336
* fix(core-flows): shipping options for cart by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9343
* fix: validate regions exist for shipping option price update by @srindom in https://github.com/medusajs/medusa/pull/9364
* fix: Tax region + rates clean up by @olivermrbl in https://github.com/medusajs/medusa/pull/9279
* fix: force string compare by @srindom in https://github.com/medusajs/medusa/pull/9360
* fix(medusa): Instrumentation resolution by @adrien2p in https://github.com/medusajs/medusa/pull/9368
* fix(dashboard): product table colum widths by @fPolic in https://github.com/medusajs/medusa/pull/9329
* fix(medusa,dashboard): don't send price updates for deleted regions/currencies by @srindom in https://github.com/medusajs/medusa/pull/9361
* fix: Update tax lines on cart when region changes by @olivermrbl in https://github.com/medusajs/medusa/pull/9367
* fix: Use correct propname for stroke opacity by @sradevski in https://github.com/medusajs/medusa/pull/9331
* fix: db:rollback and db:generate commands to cast module names to arrays by @thetutlage in https://github.com/medusajs/medusa/pull/9377
* fix: Pass order object to create fulfillment by @sradevski in https://github.com/medusajs/medusa/pull/9391
* fix(dashboard): don't prefil invite email while onboarding by @fPolic in https://github.com/medusajs/medusa/pull/9392
* fix(medusa): Replace default http tracer by @adrien2p in https://github.com/medusajs/medusa/pull/9390
* fix(dashboard): reservations quantity validations by @fPolic in https://github.com/medusajs/medusa/pull/9393
* fix(dashboard): categories add products by @fPolic in https://github.com/medusajs/medusa/pull/9380
* fix: Correctly reference job hander in loader by @sradevski in https://github.com/medusajs/medusa/pull/9396
## Documentation
* docs: customization chapter exploration by @shahednasser in https://github.com/medusajs/medusa/pull/9078
* docs: improvements and fixes to API route docs by @shahednasser in https://github.com/medusajs/medusa/pull/9197
* docs: fix link in sidebar for modules test example by @shahednasser in https://github.com/medusajs/medusa/pull/9195
* docs: add an examples list documentation by @shahednasser in https://github.com/medusajs/medusa/pull/9194
* chore(oas): [11/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9188
* chore(oas): [12/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9200
* chore(oas): [10/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9167
* chore(oas): [14/n] improve OAS schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9202
* docs: fix attribute name in calculated price by @shahednasser in https://github.com/medusajs/medusa/pull/9215
* docs: updates to digital product recipe by @shahednasser in https://github.com/medusajs/medusa/pull/9165
* docs: improvements + additions to workflow docs by @shahednasser in https://github.com/medusajs/medusa/pull/9182
* docs: change navbar items + breadcrumb improvements by @shahednasser in https://github.com/medusajs/medusa/pull/9209
* docs: improve search to show results for all filters by @shahednasser in https://github.com/medusajs/medusa/pull/9208
* chore(oas): [13/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9201
* Fix: Correct module path and clarify config structure in Medusa v2 Docs by @aqeebpathan in https://github.com/medusajs/medusa/pull/9222
* Fix: Install command for Vercel deployment documentation by @aqeebpathan in https://github.com/medusajs/medusa/pull/9270
* chore(): Update modules deps by @adrien2p in https://github.com/medusajs/medusa/pull/9286
* docs: added architecture documentation by @shahednasser in https://github.com/medusajs/medusa/pull/9256
* docs: fixes to customization docs by @shahednasser in https://github.com/medusajs/medusa/pull/9236
* chore(oas): [16/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9272
* oas: [15/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9216
* docs: add note about authentication opt out by @shahednasser in https://github.com/medusajs/medusa/pull/9298
* chore(oas): [17/n] improve OAS schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9284
* docs: document InferTypeOf by @shahednasser in https://github.com/medusajs/medusa/pull/9321
* chore(oas): [19/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9317
* chore(oas): [18/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9311
* chore(oas): [20/n] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9337
* docs-util: fixes following packages reorg by @shahednasser in https://github.com/medusajs/medusa/pull/9326
* chore(oas): [21/21] improve oas schemas by @shahednasser in https://github.com/medusajs/medusa/pull/9339
## Chores
* chore: Cleanup manager decorator usage by @adrien2p in https://github.com/medusajs/medusa/pull/9181
* chore(): Handle medusa service base methods events by @adrien2p in https://github.com/medusajs/medusa/pull/9179
* chore: Add stale bot by @olivermrbl in https://github.com/medusajs/medusa/pull/9184
* chore(link-modules): fulfillment order fieldAlias by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9185
* chore(orchestrator): remote joiner using entitymap by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9205
* fix(framework): throw when middleware fails to register by @riqwan in https://github.com/medusajs/medusa/pull/9211
* refactor(modules-sdk): Align configuration and fixes by @adrien2p in https://github.com/medusajs/medusa/pull/9239
* refactor(orchestration): Align configuration and fixes by @adrien2p in https://github.com/medusajs/medusa/pull/9242
* chore: Cleanup utils package by @thetutlage in https://github.com/medusajs/medusa/pull/9238
* Chore: cleanup workflows SDK by @thetutlage in https://github.com/medusajs/medusa/pull/9244
* refactor(types): Align configuration and fixes by @adrien2p in https://github.com/medusajs/medusa/pull/9240
* chore: upgrade moduleResolution to Node16 by @thetutlage in https://github.com/medusajs/medusa/pull/9269
* chore(): Remove default limit from the build query by @adrien2p in https://github.com/medusajs/medusa/pull/9257
* chore(): Move dependencies around by @adrien2p in https://github.com/medusajs/medusa/pull/9278
* chore: notify slack on failed release by @riqwan in https://github.com/medusajs/medusa/pull/9287
* chore: notify slack on failed release by @riqwan in https://github.com/medusajs/medusa/pull/9289
* chore: Add missing changeset for index by @olivermrbl in https://github.com/medusajs/medusa/pull/9288
* chore: Move graphl to a single place by @adrien2p in https://github.com/medusajs/medusa/pull/9303
* chore: remove direct usage from graphql by @adrien2p in https://github.com/medusajs/medusa/pull/9316
* chore: perform dependencies scan and fix all dependencies by @thetutlage in https://github.com/medusajs/medusa/pull/9296
* Chore/framework sub path by @adrien2p in https://github.com/medusajs/medusa/pull/9253
* chore: Add support for module dependencies configuration by @adrien2p in https://github.com/medusajs/medusa/pull/9330
* chore(utils): Cleanup and improve message aggregator by @adrien2p in https://github.com/medusajs/medusa/pull/9300
* chore(modules-sdk): load modules in sequence by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9327
* chore: Improve jest config and deps by @adrien2p in https://github.com/medusajs/medusa/pull/9318
* chore: Improve instrumentation loading by @adrien2p in https://github.com/medusajs/medusa/pull/9378
* chore: Add import from framework types at the top of ay generated types file by @adrien2p in https://github.com/medusajs/medusa/pull/9389
### Other Changes
* refactor(framework): Align configuration and fixes by @adrien2p in https://github.com/medusajs/medusa/pull/9246
* chore(medusa-test-utils): Add custom link loading before syncing by @adrien2p in https://github.com/medusajs/medusa/pull/9249
* chore(types): is_return on shipping options by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9352
* fix: invalid mutation for product media gallery by @joekendal in https://github.com/medusajs/medusa/pull/9371
## New Contributors
* @aqeebpathan made their first contribution in https://github.com/medusajs/medusa/pull/9222
* @joekendal made their first contribution in https://github.com/medusajs/medusa/pull/9371
**Full Changelog**: https://github.com/medusajs/medusa/compare/v2.0.10-preview...v2.0.0-rc