Blog

January 27, 2025·Product

Announcing Plugins

Harminder Virk

Harminder avatar

Harminder Virk

Plugins redefine how Medusa applications are enhanced and extended. Instead of baking all the commerce features in a single codebase, you can enhance your apps by installing and configuring a plugin.

Image modal

This week, we released Medusa 2.4, which introduces the concept of plugins. Plugins are Medusa customizations distributed as npm packages. A plugin can do everything a Medusa application can, including defining HTTP routes and workflows, registering subscribers, exporting custom modules, or defining links between modules.

Plugins redefine how Medusa applications are enhanced and extended. Instead of baking all the commerce features in a single codebase, you can enhance your apps by installing and configuring a plugin.

Using a Plugin

Plugins are npm packages you can install like any other Node.js package and configure within the Copy to clipboardmedusa-config.ts file. To demonstrate, let's set up the Wishlist plugin, one of our example plugins. If you are interested in building your own plugin, we have published an implementation guide for the Wishlist plugin in our documentation.

First, install the plugin using your preferred package manager:

yarn add medusa-plugin-wishlist

Configure it in your Copy to clipboardmedusa-config.[ts|js] file:

import { loadEnv, defineConfig } from '@medusajs/framework/utils'
loadEnv(process.env.NODE_ENV || 'development', process.cwd())
module.exports = defineConfig({
projectConfig: {
databaseUrl: process.env.DATABASE_URL,
http: {
storeCors: process.env.STORE_CORS!,
adminCors: process.env.ADMIN_CORS!,
authCors: process.env.AUTH_CORS!,
jwtSecret: process.env.JWT_SECRET || "supersecret",
cookieSecret: process.env.COOKIE_SECRET || "supersecret",
}
},
plugins: [
{
resolve: "medusa-wishlist-plugin",
options: {}
}

Apply the migrations that the plugins might contain for its modules:

npx medusa db:migrate

Finally, start your server and use the plugin:

yarn dev

Developing a Plugin Locally

This is where things get interesting. While using an existing plugin is pretty simple, developing one can be tedious without the right set of tools. For example:

  • How to create a plugin as a separate project and install it locally?
  • How do you restart the development server when you modify the plugin source code?
  • How do you leverage Vite's dev server for Admin extensions?

Also, the flow of development and publishing of the plugin should be similar. Otherwise, you may make many last-minute adjustments to prepare your plugin for distribution.

The good news is we have taken care of all these moving parts and offer you an excellent DX for local development.

We are excited to introduce plugins to Medusa 2.0 and look forward to seeing community contributions that will further expand the ecosystem around Medusa. In the future, you can expect us to publish official plugins to extend Medusa projects with functionality and integrations specific to different use cases.

Share this post

Ready to build your custom commerce setup?