Releases: medusajs/medusa
v2.0.1
This version fixes a range of bugs reported in the 2.0.0 release.
Features
- feat(core-flows, dashboard, js-sdk): customer batch endpoint for managing customer groups by @fPolic in #9761
- feat(dashboard, medusa, types): orders list on customer details page by @fPolic in #9790
- feat: Allow customer metadata update by @docloulou in #9780
Bugs
- fix: missing dependency in dev-cli by @thetutlage in #9730
- fix: install preview version of dev-cli by @thetutlage in #9750
- fix(js-sdk): remove list and retrieve methods of paymentCollection by @shahednasser in #9746
- fix(dashboard): Prevent reusing same Component for nested UI routes by @kasperkristensen in #9725
- fix(dashboard): Workflow executions by @adrien2p in #9757
- fix(medusa): Admin validator filtering and pagination by @adrien2p in #9748
- feat(dashboard,ui): DateFilter should open correctly by @kasperkristensen in #9775
- fix(core-flows, dashboard): products category batch issue by @fPolic in #9766
- fix(orchestration): Ids wrongly processed when using operators map by @adrien2p in #9781
Documentation
Important
The documentation for Medusa v1 has moved from https://docs.medusajs.com to https://docs.medusajs.com/v1.
- docs: remove v1 docs from navbar by @shahednasser in #9722
- docs: remove dev notices + fix AI assistant answer width by @shahednasser in #9686
- Update docs commerce modules so that tax links to the correct page by @jackcaldwell in #9747
- docs: show latest version in docs + update automatically by @shahednasser in #9753
- docs: fix deleteCascade typo by @shahednasser in #9744
- docs: change configurations to make v2 the main docs by @shahednasser in #9729
- docs: add ui rewrite by @shahednasser in #9762
- docs: fix complete cart workflow usage in marketplace recipe by @shahednasser in #9771
- docs: fixes to ui docs by @shahednasser in #9759
Chores
- chore: update links to v2 docs in source code and comments by @shahednasser in #9732
- chore: Add fixed packages in changeset by @olivermrbl in #9752
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [5/n] by @shahednasser in #9788
New Contributors
- @jackcaldwell made their first contribution in #9747
- @docloulou made their first contribution in #9780
Full Changelog: v2.0.0...v2.0.1
Medusa 2.0 Release Candidate #8
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
Features
- fix(medusa, types): allow to pass
external_id
on product create/update by @fPolic in #9694 - feat(dashboard,types): Translate all OrderBy filters by @kasperkristensen in #9691
- feat(core-flows): order events by @carlos-r-l-rodrigues in #9702
- feat(core-flows,medusa): Add customer validation on cart update by @riqwan in #9662
- Feat/validate query enhancement by @adrien2p in #9705
Bugs
- fix(dashboard,js-sdk): remove method and hook for deleting claim by @shahednasser in #9668
- fix(dashboard, js-sdk): undefined RMA activity items by @fPolic in #9649
- fix(core-flows): Emit event in update products workflow by @olivermrbl in #9682
- fix(dashboard): wrong queryKey for price preferences list by @fPolic in #9685
- fix(dasboard): Grammer issues on invite page by @kasperkristensen in #9683
- fix: allow additional_data to be undefined or null by @thetutlage in #9687
- fix(product): Category repository missing ontext by @adrien2p in #9688
- fix(dashboard,js-sdk): remove methods / hooks to non existing exchange routes by @shahednasser in #9697
- fix: Don't store token in SDK by default by @sradevski in #9704
- fix(admin-vite-plugin,dashboard): Generate correct UI Route tree by @kasperkristensen in #9699
- fix(dashboard): temp hide order column on reservations by @fPolic in #9692
- fix(dashboard): broken CustomerGroup create form by @fPolic in #9711
- fix(dasbhoard): Revert keybound form for public pages by @kasperkristensen in #9710
- fix: API validation management issues by @adrien2p in #9693
Documentation
- docs: rename packages by @shahednasser in #9618
- docs-util: fixes to package renames + other options by @shahednasser in #9671
- docs: fix scroll + divider issues by @shahednasser in #9663
- fix: revise words on docs intro page by @srindom in #9588
- docs: update nav items by @shahednasser in #9709
Chores
- chore(utils): update tsdocs for provider identifiers by @shahednasser in #9656
- chore(orchestration): modules method context by @carlos-r-l-rodrigues in #9669
- chore: fix to DML action by @shahednasser in #9672
- chore(types,js-sdk,medusa): Add TSDocs for store and auth's JS SDK + small type fixes by @shahednasser in #9657
- chore: Correctly assert test by @sradevski in #9695
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [1/n] by @shahednasser in #9667
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [2/n] by @shahednasser in #9696
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [3/n] by @shahednasser in #9712
Full Changelog: v2.0.0-rc.7...v2.0.0-rc.8
v2.0.0
Medusa v.2.0.0
Weβre excited to announce the release of Medusa 2.0 to the world today. This major version has been over 16 months in the making, with more than 3500 pull requests merged, and represents an incredible engineering feat by our team.
Medusa 2.0 is a complete rewrite of our architecture and feature set with breaking changes to many areas of Medusa 1.0. While we recognize this may be disruptive for our users, we deemed these changes necessary to establish the proper foundation for our vision of the future of building applications with Medusa.
Since this is a complete rewrite and we have yet to finalize an upgrade guide, there is no point in covering all the breaking changes in this announcement. You can expect this to be covered in the upgrade guide, which is published within the next two months. This post focuses on whatβs new in Medusa 2.0. We will briefly cover the new architecture and commerce features, but otherwise, leave it to the documentation to educate about all the new concepts. Our documentation has also been rewritten and will, aside from tutorials, guides, and references, offer an in-depth learning path, equipping you with the knowledge needed to build bespoke commerce applications with Medusa.
Package restructuring
First, letβs understand the packages you need to build applications with Medusa 2.0. These havenβt changed much from 1.0, aside from some restructuring for a more logical separation of concerns.
There are three core packages in Medusa 2.0, and these are installed in new projects by default:
@medusajs/medusa
@medusajs/framework
@medusajs/admin-sdk
@medusajs/medusa
If you have been testing previews of Medusa 2.0, you know that weβve gone through a few iterations of package management to figure out the most appropriate bundling of our commerce features. Eventually, we decided to stick with what we had in Medusa 1.0, a single package containing all commerce modules and the Rest API. Much of this code ships as separate npm packages (more about this in the section covering our modular architecture). However, they are all dependencies of @medusajs/medusa
, which makes for a seamless upgrade path whenever new versions of underlying packages are published.
@medusajs/framework
We are excited to introduce a new package dedicated to our framework for customization. This package holds all the tooling needed to extend existing and/or introduce new functionality in Medusa projects. This includes API Routes, Workflows SDK, Modules SDK, Subscribers, Scheduled Jobs, Loaders, DML, and more. We will cover this in more depth in a later section.
@medusajs/admin-sdk
We have restructured our admin packages as part of the dashboard redesign. The commerce dashboard ships as @medusajs/dashboard
and is a dependency of the core package @medusajs/medusa
. The tooling to extend the dashboard, including UI Widgets and Routes, is now bundled in an Admin SDK package, @medusajs/admin-sdk
.
Now that you understand the new packages, letβs move on to the most significant change in Medusa 2.0.
Architecture rewrite
The largest change from Medusa 1.0 to 2.0 is the rewrite of our core architecture. While architecture rewrites often have a tarnished reputation, we believe this decision aligns with how software engineering will evolve in the next decade. We will elaborate on this thinking in a separate blog post.
Complete isolation of domains
In Medusa 2.0, all business domains (services and data models) have been rewritten from scratch to eliminate interdependencies between them. To understand the reasoning behind this change, letβs briefly consider the previous architectural design.
In Medusa 1.0, services, e.g., Product and Cart, held most cross-domain business logic, and relationships between data models were defined via foreign keys in the database. The Cart service strictly depended on the Product service for many operations, e.g., adding a line item to the cart, and the line item data model references product variants via foreign keys. This pattern was applied to all domains in Medusa 1.0, and made it near-impossible to partially adopt our feature offeringβit was all or nothingβa dealbreaker for some of our users, especially in the enterprise segment.
These interdependencies between domains significantly constrained the level of extensibility we could offer in the service layer. The only way to βextendβ services was to override entire methods, which led to nasty upgrade paths whenever we upgraded those service methods with additional logic.
Medusa 2.0 eliminates all interdependencies between domains. Services are now pure in the sense that they only manage resources within their domain. All cross-domain functionality has been moved to extensible workflows, which will be covered in a later section. Weβve also eliminated all database-level dependencies, removing foreign keys between data models in different modules.
Architecture of Medusa 2.0
Benefits of module isolation
Weβve already touched on some key benefits of module isolation. Over the past three years, weβve seen a growing demand for incremental adoption, especially from large businesses. These businesses often have a sizeable existing tech stack with various integrations and custom applications. For them, a full migration can take years and cost millions. They need a platform that allows them to migrate their tech stack gradually while keeping the existing systems intact. Our new modular architecture makes that possible (and feasible).
Gradual adoption of modules
A related benefit of module isolation is our new standalone mode. Not all companies need the full suite of features of a commerce platform. Weβve seen many requests for (and now usage of) standalone modules, which is a new βruntimeβ of modules in Medusa 2.0. Companies can install and use a few modules to build out their application. This is typically the preceding step to the gradual migration described above, where companies, over time, adopt more and more modules until they eventually leverage the full power of our platform.
For example, the Cart module can be used standalone to build a custom checkout flow:
import CartService from "@medusajs/cart"
const cart = await cartService.createCarts({
email: "tony@stark.com",
currency_code: "usd"
})
await cartService.addLineItem(cart.id. {
title: "Custom item",
unit_price: 1000,
quantity: 1
})
In a common setup, line items in a cart are associated with products. However, that might not be the case for your use case. You may sell simpler goods that are not tied to a product variant or calculated price. All you need is plug-and-play cart management, and we offer you precisely that.
Services as a lower-level primitive
A non-obvious benefit from our architecture rewrite is that services have become a more useful lower-level primitive. As described above, we've removed all cross-domain business logic from services, limiting them to managing resources within their modules. So, when you use the Cart service to create a cart, you only create a cart. This sounds obvious, but in monolithic architectures, itβs common to carry out cross-domain operations within single service methods. For example, you might create shipping methods or populate the region as part of creating the cart. Such actions are typically achieved via dependency injection, which, in Medusa 2.0, is not available across modules.
Having more βdumbβ services enables a greater level of composability. Modules can integrate more seamlessly, and how you integrate them is entirely up to you and your use case. Consider our previous example. Imagine you're not selling traditional products but rather subscriptions or licenses. Our Cart service doesnβt care. As long as you provide the required details to create line items, the Cart service and all its related functions, including total computation, will work as expected. It will also continue to work seamlessly with other modules, e.g. you can apply promotions to your license products with little to no changes needed. This is an example of the power of services as lower-level primitives and elegant abstractions.
Read more about the architectural changes in our documentation.
New and improved commerce features
As part of rewriting our commerce modules, we reevaluated each feature set to identify improvements. This led to various updates and new modules we are excited to introduce today.
Promotions engine
Our new Promotion module, @medusajs/promotion
, lets you set up advanced conditional promotion logic. You can compute discounts based on coupons, cart items, customers, or custom data models. Additionally, weβve introduced new types of promotions, such as Buy X and Get Y promotions.
Read more about the Promotions module here.
Advanced inventory management
Our new Inventory and Stock Location modules, @medusajs/inventory
and @medusajs/stock-location
, significantly improve inventory management in Medusa. With our Stock Location module, you can keep inventory in multiple warehouses worldwide, including physical stores, and associate those locations with shipping zones to ensure your fulfillment processes are optimized for distance to customers. With our new Inventory module, your product variants can share inventory items, enabling new use cases such as product bundl...
Medusa 2.0 Release Candidate #7
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
Package restructuring
Warning
Breaking change
This release comes with the final package restructuring, mainly dealing with consistent package names.
The following packages have been renamed:
@medusajs/medusa-cli
->@medusajs/cli
@medusajs/stock-location-next
->@medusajs/stock-location
@medusajs/inventory-next
->@medusajs/inventory
@medusajs/file-local-next
->@medusajs/file-local
medusa-telemetry
->@medusajs/telemetry
medusa-test-utils
->@medusajs/test-utils
This is a breaking change, and to upgrade, please update your dependencies as follows:
- Replace
medusa-test-utils
with@medusajs/test-utils
in your project - Replace
@medusajs/medusa-cli
with@medusajs/cli
in your project
Standardize provider ID generation
Warning
Breaking change
We have cleaned up some inconsistencies and legacy code in the provider domain, which has led to breaking changes.
- Module providers should no longer have a static property
PROVIDER
β this has been replaced withidentifier
- Module providers should have a static property
identifier
describing the name of the provider - Module providers' container registration name have changed format
Before
const key = `pp_[PROVIDER]_[id]`
id
being the id specified in the module provider configuration inmedusa-config.js
PROVIDER
being the property described above, that has now been removed
After
const key = `pp_[identifier]_[id]`
id
being the id specified in the module provider configuration inmedusa-config.js
- If this is not specified, we omit it from the registration key*
identifier
being the property described above, that replacedPROVIDER
*Previously, we did not omit the id
if it wasn't specified, which meant registration keys contained undefined
. For example:
pp_stripe-ideal_undefined
Aside from having a new name in the dependency container, these changes will also affect the payment providers stored in the database. They are stored using the registration key described above, so consequently, they will be loaded anew the first time you boot up your application after upgrading to this version.
Let's consider an example provider configuration of Stripe with an explicit id
:
{
id: "stripe-usd",
resolve: "@medusajs/payment-stripe",
options: { ... }
}
If Stripe providers were enabled, they used to be stored with the following IDs in the database:
pp_stripe_stripe-usd
pp_stripe-ideal_stripe-usd
pp_stripe-bancontact_stripe-usd
...
Those IDs will now be:
pp_stripe_stripe-usd
pp_stripe-ideal_stripe-usd
pp_stripe-bancontact_stripe-usd
...
Let's consider an example provider configuration of Stripe without an explicit id
:
{
resolve: "@medusajs/payment-stripe",
options: { ... }
}
If Stripe providers were enabled, they used to be stored with the following IDs in the database:
pp_stripe_undefined
pp_stripe-ideal_undefined
pp_stripe-bancontact_undefined
...
Those IDs will now be:
pp_stripe
pp_stripe-ideal
pp_stripe-bancontact
...
These changes will affect all created payment sessions on carts, as the provider specified upon creation no longer exists.
Form submission in Admin
Form submissions in Admin now require CMD + Enter
on MacOS or CTRL + Enter
on Windows. This makes for a more intentional action and prevents incorrect submissions.
Features
- breaking: rename package names to be consistent and under @medusajs scope by @thetutlage in #9580
- feat(core-flows): cart events by @carlos-r-l-rodrigues in #9585
- feat(dashboard): Submit forms on Cmd + Enter by @kasperkristensen in #9623
- feat(core-flows,types,medusa): Add tax region update API by @riqwan in #9634
- fea(providers): locking postgres by @carlos-r-l-rodrigues in #9545
- feat(medusa): ordem items endpoint by @carlos-r-l-rodrigues in #9646
- feat: allow html content for notifications by @christiananese in #9613
- feature: use application logger to log HTTP requests by @thetutlage in #9655
- feat(dashboard) taxes + discount breakdown by @fPolic in #9586
Bugs
- fix(dashboard): Set correct method value on promotion by @riqwan in #9610
- fix(dashboard): FF return reason table by @fPolic in #9614
- fix(utils): Mikro orm joined selection issue when select-in strategy by @adrien2p in #9615
- fix(modules-sdk): Add missing paths to require.resolve in load resources by @adrien2p in #9608
- fix(product): options validation if ids are same by @fPolic in #9622
- fix(dashboard,ui): Fix outline flash on FocusModal by @kasperkristensen in #9624
- fix: Add free text search on reservations by @olivermrbl in #9621
- fix(dashboard): cleanup Payments section by @fPolic in #9520
- fix(dashboard): Fix styling of nested NavLinks by @kasperkristensen in #9637
- fix(dashboard): Ensure all progress tabs are 200px wide by @kasperkristensen in #9644
- fix(ui): Fix Avatar styling by @kasperkristensen in #9645
- fix(core-flows, types): general fixes to types and tsdocs by @shahednasser in #9633
- fix(types): change options to be required in http type by @shahednasser in #9642
- fix(dashboard): Hide usage insights by @kasperkristensen in #9651
- test(admin-vite-plugin): React Invalid hook call on Windows by @kasperkristensen in #9647
- Fix/production logging by @thetutlage in #9658
- fix(orchestration): local workflow proxy by @carlos-r-l-rodrigues in #9664
- fix: resolve paths using require.resolve by @thetutlage in #9665
Documentation
- docs: added examples page by @shahednasser in #9587
- docs: improved commerce modules [5/5] by @shahednasser in #9592
- docs: fix heroku typo by @shahednasser in #9382
- docs: update providers to use ModuleProvider by @shahednasser in #9579
- Switch the headings to match the content by @erickirt in #9619
- fix(docs): update workflow API example to include query parameter by @VrajPatelK in #9640
- docs: update curl request to /admin/products by @shahednasser in #9641
- docs-util: add configuration to generate js-sdk reference by @shahednasser in #9630
- docs: add routing page by @shahednasser in #9550
- docs: document JS SDK installation by @shahednasser in #9611
Chores
- chore(medusa): default endpoints size limit by @carlos-r-l-rodrigues in #9616
- chore: Prepare changeset for 2.0 release by @olivermrbl in #9631
- feat(medusa): Display admin url on start by @adrien2p in #9643
- chore(js-sdk): add ignore tsdoc tag to client and constructor of inner classes by @shahednasser in #9635
- chore: remove internal module resources option by @carlos-r-l-rodrigues in #9582
- chore: Update modules providers configuration with 'identifier' and 'PROVIDER' by @adrien2p in #9636
New Contributors
- @VrajPatelK made their first contribution in #9640
Full Changelog: v2.0.0-rc.6...v2.0.0-rc.7
Medusa Release Candidate #6
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
Highlight
Resolved issue with module provider loading
See #9601 for more.
Bugs
- fix(admin-vite-plugin): Replace slashes for Windows by @kasperkristensen in #9602
- fix: resolve provider path before requiring it by @thetutlage in #9601
- fix(types): logger by @carlos-r-l-rodrigues in #9581
Documentation
- docs: fix package names in module registration by @shahednasser in #9590
- docs: update resolve path to use src by @shahednasser in #9605
- docs-util: fixes for OAS docs generator + framework typedoc config by @shahednasser in
Full Changelog: v2.0.0-rc.5...v2.0.0-rc.6
Medusa Release Candidate #5
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
Removing ourDir
from admin settings
Warning
Breaking change
The outDir
has been removed in favor of internally computing output directory for the admin dashboard.
The computation follows these rules
- If admin is not
disabled
and thebuild
command is run without the--admin-only
flag, the admin output directory will be.medusa/server/public/admin
and it will be served from that same location from the Medusa instance. - If admin is not
disabled
and thebuild
command is run with the--admin-only
flag, then the admin output directory will be.medusa/admin
. This commands should be used for deploying the admin dashboard separately from the Medusa instance.
// medusa-config.ts
{
// ...
admin: {
- outDir: 'some/path'
}
}
Features
- chore: add compare_at_unit_price when price list price is retrieved by @riqwan in #9564
- feat(providers): locking redis by @carlos-r-l-rodrigues in #9544
Bugs
- fix(create-medusa-app): use db:migrate to run migrations by @shahednasser in #9565
- fix(core-flows, link-module): product <> inventory delete cascades by @fPolic in #9528
- fix: remove default value for the cluster flag by @thetutlage in #9570
- fix(dashboard): reservation inventory details by @fPolic in #9535
- feat(core-flows, product): options checks on product create/update by @fPolic in #9171
- fix(utils): update medusa config resolution for consistency by @adrien2p in #9591
- fix(utils): Reversed module package missing references by @adrien2p in #9589
- fix(admin-vite-plugin): Normalize file paths and add tests by @kasperkristensen in #9595
Chores
- chore: update slack message by @riqwan in #9290
- chore: Remove Query Filter by @adrien2p in #9403
- chore: Update admin build/serve configuration by @adrien2p in #9584
Full Changelog: v2.0.0-rc.4...v2.0.0-rc.5
Medusa 2.0 Release Candidate #4
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
Removed deprecated APIs
Warning
Breaking change
We are still cleaning up in preparation for v2.0 and this release removes a range of deprecated APIs.
Here is a list of everything:
Commands
- seed: There was no implementation for the seed command in the first place.
migrations [action]
: Removed in favor ofdb:migrate
,db:rollback
anddb:generate
.links [action]
: Removed in favor ofdb:sync-links
.start-cluster
: Removedstart-cluster
command in favor of the--cluster
flag on thestart
command.
Config options
- Remove config option
databaseType
as it is not used anywhere. - Remove config option
httpCompression
in favor of compression property. - Remove
allowedFields
in favor ofallowed
property from theMedusaRequest
. - Remove
expand
property in favor ofallowed
property from theRequestQueryFields
. - Remove
defaultFields
anddefaultRelations
in favor ofdefaults
property from theRequestQueryFields
. - Remove
allowedFields
andallowedRelations
in favor ofallowed
property from theRequestQueryFields
.
Events build
- Remove
eventsEnum
in favor ofeventName
property accepted by themoduleEventBuilderFactory
. Also updated all the usages to useeventName
.
ModelDTO
- Remove unused properties
singular
andplural
fromModelDTOConfig
.
Models template
- Remove unused properties
create
,update
,singular
, andplural
fromModelsConfigTemplate
.
Zod validator
- Remove unused
OptionalBooleanValidator
in favor ofbooleanString
.
Features
- breaking: remove deprecated commands and code by @thetutlage in #9521
Bugs
- fix(dashboard): Adds routes for handling tax overrides for provinces by @kasperkristensen in #9549
- fix(utils): Cascade soft deletion management by @adrien2p in #9534
- fix(dashboard): Show SO name in DataGrid by @kasperkristensen in #9554
- fix(dashboard): Hide note input on orders by @kasperkristensen in #9555
- fix(dashboard): Show progress on tabs in create form by @kasperkristensen in #9553
- fix: Add shipping method data validation by @olivermrbl in #9542
- fix(dashboard): Change icon of Shipping Profiles card by @kasperkristensen in #9563
- fix(dashboard): Prevent category names from overflowing in organize section by @kasperkristensen in #9562
- fix: Link migration descriptor case changes and hash computation by @adrien2p in #9560
- fix(dashboard): Translate breadcrumbs by @kasperkristensen in #9561
Documentation
- docs: updates for breaking changes by @shahednasser in #9558
Chores
- chore(framework): update TSDocs for medusa config by @shahednasser in #9559
- chore(product): Update the events emitted from the product module by @adrien2p in #9557
Full Changelog: v2.0.0-rc.3...v2.0.0-rc.4
Medusa 2.0 Release Candidate #3
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 @zaidrashi...
Medusa v2.0 Release Candidate #2
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
Continued restructuring
Warning
Breaking change
Since the first RC, we have continued our code restructuring, this time affecting commonly used middleware. These have been moved from @medusajs/medusa
to @medusajs/framework
to make them usable outside the context of the core commerce package.
This is a breaking change if you are using any of the following middleware in your Medusa project:
applyParamsAsFilters
clearFiltersByKey
applyDefaultFilters
setContext
getQueryConfig
httpCompression
maybeApplyLinkFilter
refetchEntities
unlessPath
validateBody
validateQuery
Importing these middleware will look as follows going forward:
import { validateBody } from "@medusajs/framework/http"
Features
- feat(orchestration): Provide hint in workflows error by @adrien2p in #9400
- feat(framework,medusa): Ensure publishable key middleware is set for all store endpoints by @riqwan in #9429
- breaking: move shared HTTP utils to the framework by @thetutlage in #9402
- feature: allow using typescript path aliases when using ts-node by @thetutlage in #9443
Bugs
- fix: Validate
identifier
payload for reset password by @olivermrbl in #9302 - fix(utils): knex import by @adrien2p in #9408
- fix(types, medusa): http types fixes by @shahednasser in #9334
- fix(medusa-oas-cli): Fix incorrect import by @shahednasser in #9404
- fix: Export all classes and types from the SDK by @sradevski in #9422
- fix(create-medusa-app): remove warnings on installation by @shahednasser in #9405
- fix(workflows-sdk): when then return value by @carlos-r-l-rodrigues in #9427
- fix(dashboard): allocation label condition by @fPolic in #9398
- fix(dashboard, fulfilment): fulfilment providers enabled check by @fPolic in #9415
- fix(dashboard): location details loader by @fPolic in #9412
- fix: Use the default admin port in create medusa app env definition by @sradevski in #9439
- fix(core-flows): Remove concurrent steps that rely on the same data update by @adrien2p in #9438
- fix: Get backend URL from environment variable if available by @sradevski in #9450
Documentation
- Update page.mdx by @arun-prasath2005 in #9366
- docs: fix imports from dist by @shahednasser in #9401
- docs: improvements + additions to module docs by @shahednasser in #9152
- chore(oas): clean up oas by @shahednasser in #9354
- docs: fix how api reference shows any type by @shahednasser in #9340
- docs: updates and fixes in utils + fulfillment provider changes by @shahednasser in #9347
- docs: fix query option in instrumentation by @shahednasser in #9395
- chore(oas): general fixes to OAS by @shahednasser in #9413
- docs: DX and performance improvements in API reference by @shahednasser in #9430
- docs: Fix typo. Use instead yuse by @zaidrashid in #9431
- chore(oas): add more details link to pagination and select fields by @shahednasser in #9414
- docs: fix infinite scroll, update next.js, other fixes by @shahednasser in #9441
- docs: add a troubleshooting guide for dist imports by @shahednasser in #9442
Chores
- chore(types, utils): update the TSDocs of AbstractFulfillmentProviderService by @shahednasser in #9349
- chore: Processing filters deeply looking at the current joiner first by @adrien2p in #9428
- chore: improve mikro orm serializer circular ref and link serialization by @adrien2p in #9411
- chore: add action to update starter dependencies + update reference actions by @shahednasser in #9385
Other Changes
- feature: Add MikroORM CLI wrapper to bypass hardcoded module system by @thetutlage in #9426
New Contributors
- @arun-prasath2005 made their first contribution in #9366
- @zaidrashid made their first contribution in #9431
Full Changelog: v2.0.0-rc...v2.0.0-rc.2
Medusa v2.0 Release Candidate #1
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 to submit your input.
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.
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:
{
"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:
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:
{
"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:
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 #9095
- feat(dashboard): manage inventory placeholder by @fPolic in #9190
- feat(index): Provide a similar API to Query by @adrien2p in #9193
- feat(dashboard): login and invite redesign by @fPolic in #9214
- feat(core-flows,dashboard,types,fulfillment,medusa): uses requires shipping throughout lifecycle by @riqwan in #9170
- feat(utils): define read only link by @carlos-r-l-rodrigues in #9254
- feat(medusa,fulfillment): pass stock location data to fulfillment provider by @srindom in #9322
- feature: bundle all modules by @thetutlage in #9324
Bugs
- fix(workflow-sdk): Use the correct event group ID from the flow metadata by @adrien2p in #9177
- fix(workflow-engine-*): pass container to flow by @carlos-r-l-rodrigues in #9180
- fix(medusa-test-utils): get port should a deps for now by @adrien2p in #9198
- fix(dashboard): open edit variant modal in current context by @fPolic in #9203
- fix(types): fixes to HTTP types by @shahednasser in #9189
- fix(oas): support additional props, fix circular references patch, and other fixes by @shahednasser in #9213
- fix(oas): handle new keys in circular reference patch by @shahednasser in #9218
- fix(user): check if user account with email already exist on invite create by @fPolic in #9243
- fix(dashboard): PL creation - customers table customers count by @fPolic in #9237
- fix(dashboard): prices validation in PL bulk editor by @fPolic in #9245
- fix(dashboard): minor collection bugs by @fPolic in #9255
- fix(dashboard): customer groups table fileds by @fPolic in #9262
- fix(dashboard): customer groups fixes by @fPolic in #9258
- fix(dashboard): pagination in invite table by @fPolic in #9259
- fix(core-flows): line item type collection by @carlos-r-l-rodrigues in #9251
- fix(pricing): calculate pricing repository query by @fPolic in #9265
- fix: Add missing await when refetching region by @sradevski in #9283
- fix(orchestration): Throw if not exists using filters by @adrien2p in #9275
- fix: add missing dependency to utils package by @thetutlage in #9297
- fix: Add actor type to password reset event by @sradevski in #9301
- fix(modules-sdk): Fix dynamic import usage by @adrien2p in #9304
- fix(dashboard): login alert background by @fPolic in #9305
- fix(types): remove BigNumberValue usages in http types by @shahednasser in #9285
- fix: Generated types interface name by @adrien2p in #9307
- fix: base tsconfig by @adrien2p in #9309
- fix(types, medusa): fixes to HTTP types by @shahednasser in #9273
- fix(modules-sdk): default db options by @carlos-r-l-rodrigues in #9313
- fix(dashboard): set/unset automatic taxes on a region by @fPolic in #9315
- fix(types): fix order DTO types by @shahednasser in #9323
- fix(dashboard): variant update success toast by @fPolic in #9325
- fix(create-medusa-app): fix publishable api key not saving in .env.local by @shahednasser in #9328
- fix: Bind abort controller to abort in sdk by @sradevski in #9341
- fix: remove dist access for modules in integration tests by @adrien2p in #9336
- fix(core-flows): shipping options for cart by @carlos-r-l-rodrigues in #9343
- fix: validate regions exist for shipping option price update by @srindom in #9364
- fix: Tax region + rates clean up by @olivermrbl in #9279
- fix: force string compare by @srindom in #9360
- fix(medusa): Instrumentation ...