Get started with a new project
To get started using the RC, run the following command:
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.
Update existing project
Ensure your Medusa dependencies in package.json
are using the rc
tag:
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
...
}
}
To ensure an upgrade to a new version is completed correctly, run the following sequence of commands:
rm -rf node_modules
rm yarn.lock // or package-lock.json
yarn // If you are using yarn berry, you need to create the lock-file first
Highlights
Standalone builds
Warning
Breaking change
As part of our preparations for the official release, we have improved our build process by introducing standalone builds. Now, when you build your Medusa project, we compile it within the project and mimic the file structure in the build output, not just the src
directory. Additionally, we are placing the build artifacts in .medusa
in the server
and admin
folders for the backend and dashboard code, respectively.
Here's how the build output looks like
.medusa
├── server
│ ├── package.json
│ ├── yarn.lock
│ ├── medusa-config.js
│ ├── modules
│ │ ├── hello
│ │ ├── index.js
│ ├─── model
│ ├─── index.js
├── admin
│ ├── assets
│ ├── index.html
└── types
If you notice carefully, medusa-config.js
, yarn.lock
, and package.json
is included in the build artifacts. We do so to create a standalone built application, something you can copy/paste to your server and run without relying on the original source code.
This results in small containers since you are not copying unnecessary files. Additionally, it clearly distinguishes between the development and production code. If you want to run the production server, then cd
into the .medusa/server
directory and run it from there.
Breaking changes (summarised):
- Remove the dist and build folders. Instead, write them production artifacts within the .medusa directory as .medusa/admin and .medusa/server.
- Change the output of the .medusa/server folder to mimic the root project structure.
Read more in the PR.
Module registration
Warning
Breaking change
We have cleaned up module registration in medusa-config.js
to be consistent with the rest of the configuration. This means modules
can now be passed as an array instead of an object:
// before
-modules: {
- custom: {
- resolve: "./modules/custom",
- options: {
- apiKey: "test",
- },
- },
-},
+modules: [
+ {
+ resolve: "./modules/custom",
+ options: {
+ apiKey: "test",
+ },
+ },
+],
This is a backward-compatible change. The backward compatibility will be removed in the near future, so we recommend updating your medusa-config.js
now.
With this change, we now default to using the key specificed in the module export to register the module in the dependency container.
For example, let's say you've built a custom module with the following export:
export default Module("my_custom_module", { ... } )
The registration key in the dependency container will be my_custom_module
and is resolved as follows:
const service = req.scope.resolve("my_custom_module")
Breaking changes:
- The import location changed for the following utils:
- import { MODULE_PACKAGE_NAMES } from "@medusajs/framework/modules-sdk
+ import { MODULE_PACKAGE_NAMES } from "@medusajs/framework/utils
- The module registration key names have changed to be snake_cased instead of PascalCased:
- export const Modules = {
- AUTH: "Auth",
- CACHE: "Cache",
- CART: "Cart",
- CUSTOMER: "Customer",
- EVENT_BUS: "EventBus",
...
- } as const
+ export const Modules = {
+ AUTH: "auth",
+ CACHE: "cache",
+ CART: "cart",
+ CUSTOMER: "customer",
+ EVENT_BUS: "event_bus",
...
The latter is only a breaking change if you have used raw strings to resolve modules from the dependency container.
Features
- feat(dashboard, js-sdk): reset password UI by @fPolic in #9451
- feat(dashboard, medusa) add metadata to pages by @fPolic in #9433
- feat(dashboard,core-flows,types,order): change order accepts price updates by @riqwan in #9476
- feat: Add
useQueryStep
by @adrien2p in #9384 - fix(medusa): use transform order for store order endpoints by @riqwan in #9489
- feat(dashboard,admin-vite-plugin,admin-bundler,admin-sdk): Rework admin extensions and introduce custom fields API by @kasperkristensen in #9338
- breaking: Standalone builds by @thetutlage in #9496
- feat(dashboard): Add global search by @kasperkristensen in #9504
- feat(locking): Locking module by @carlos-r-l-rodrigues in #9524
Bugs
- fix(core-flows): update cart promotion data usage by @adrien2p in #9456
- fix(dashboard): allow to unset PL rule by @fPolic in #9276
- fix: Handle region updates on cart (1/n) by @olivermrbl in #9369
- fix: If country on cart has no tax region, clear tax lines by @olivermrbl in #9447
- fix: Idempotent cart completion by @olivermrbl in #9231
- fix: add order to pagination types by @carlos-r-l-rodrigues in #9471
- chore(cli): Update start description by @adrien2p in #9448
- fix(payment): Capture payment by @olivermrbl in #9469
- fix: Remove extra saving on serialization which breaks the chain by @adrien2p in #9465
- fix(orchestrator, workflows-sdk): skip async step by @carlos-r-l-rodrigues in #9482
- fix(core-flows): remove reservations on order edit confirm by @fPolic in #9477
- fix(order): searchable fields by @carlos-r-l-rodrigues in #9493
- fix(dashboard): manage inventory flags by @fPolic in #9487
- fix(product): Always add q if defined in product category search by @olivermrbl in #9505
- fix(dashboard): Remove token copy from badge by @kasperkristensen in #9508
- fix(order): undo order change by @carlos-r-l-rodrigues in #9497
- fix: add metadata to product type resp by @srindom in #9515
- fix: hover states on filters and chip groups by @srindom in #9511
- fix: add metadata to collection resp by @srindom in #9514
- fix(dashboard): undeclared var by @fPolic in #9512
- fix: provide outDir to typescript compiler by @thetutlage in #9518
- fix(core-flows, dashboard): inventory kit reservations by @fPolic in #9502
- fix(types): fix parameter types for the order module's service by @shahednasser in #9513
- fix(workflows-sdk):transaction id inheritence by @adrien2p in #9507
- fix(utils): build query conversion breaking the underlying API operator map by @adrien2p in #9533
- fix: do not pass additional_data to service by @thetutlage in #9532
- fix(dashboard,ui): Fixes to Combobox and CategoryCombobox by @kasperkristensen in #9537
Documentation
- docs: update imports of middlewares and http types by @shahednasser in #9440
- docs: add section on testing providers by @shahednasser in #9453
- docs: update modules chapter in basics by @shahednasser in #9452
- docs: improvements to API reference intro sections by @shahednasser in #9397
- docs: fix import path in the workflow basic documentation by @damien-thiesson in #9481
- docs: added docs for reset password by @shahednasser in #9306
- docs: document using conditional operators in workflows by @shahednasser in #9464
- docs: updates in recipes by @shahednasser in #9472
- docs: improved commerce module docs [2/n] by @shahednasser in #9501
- docs: improvements and fixes to components in API reference by @shahednasser in #9410
- docs: Fix link to the correct AuthIdentity model's page by @zaidrashid in #9519
- docs: redesigned navigation by @shahednasser in #9525
- docs-util: fix import in generated workflow hook snippet by @shahednasser in #9499
- docs: improve commerce modules [1/n] by @shahednasser in #9498
- docs: small structure fixed to db command reference by @shahednasser in #9446
- docs: add guide on how to seed data by @shahednasser in #9449
- docs: added documentation for admin components by @shahednasser in #9491
- docs: improve commerce modules [3/n] by @shahednasser in #9510
Chores
- chore: fix action name in update on rc release action by @shahednasser in #9463
- chore(types): index module type by @carlos-r-l-rodrigues in #9473
- chore: workflow internals improvementss by @adrien2p in #9455
- chore: swc/jest source maps config to inline instead of true by @adrien2p in #9531
- chore(): Allow to register modules through array by @adrien2p in #9522
Other Changes
- Feat: Move container bindings declaration merging within the framework by @thetutlage in #9467
- feat: convert modules enum to a const by @thetutlage in #9486
- fix(payment): correct import of MedusaError by @Veskel01 in #9474
- fix: js-sdk compilation error by @joekendal in #9523
New Contributors
- @damien-thiesson made their first contribution in #9481
- @Veskel01 made their first contribution in #9474
Full Changelog: v2.0.0-rc.2...v2.0.0-rc.3