MCPcopy Index your code
hub / github.com/adrien2p/medusa-extender

github.com/adrien2p/medusa-extender @v1.8.8

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.8.8 ↗ · + Follow
386 symbols 930 edges 118 files 20 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Medusa-extender logo

medusa-extender

Full documentation website

<a href="https://npmcharts.com/compare/medusa-extender?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/medusa-extender.svg" height="20"/></a>
<a href="https://www.npmjs.com/package/medusa-extender"><img alt="NPM Version" src="https://img.shields.io/npm/v/medusa-extender.svg" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/adrien2p/medusa-extender.svg" height="20"/></a>
<a href="https://github.com/adrien2p/awesome-medusajs"><img alt="Awesome medusajs" src="https://awesome.re/badge.svg" height="20"/></a>
<a href="https://adrien2p.github.io/medusa-extender/#/"><img alt="Documentation" src="https://img.shields.io/badge/documentation-online-important" height="20"/></a>
<a href="https://twitter.com/intent/tweet?text=Check%20this%20out!%20The%20new%20medusa%20headless%20e-commerce%20extender&url=https://github.com/adrien2p/medusa-extender"><img alt="Twitter" src="https://badgen.net/badge/icon/twitter?icon=twitter&label=Share%20it%20on" height="20"/></a>
<a href="https://discord.gg/xpCwq3Kfn8"><img alt="Discord" src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" height="20"/></a>
<a href="https://www.npmjs.com/package/medusa-extender"><img alt="Npm download" src="https://img.shields.io/npm/dt/medusa-extender" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/commits/main"><img alt="Activity" src="https://img.shields.io/github/commit-activity/m/adrien2p/medusa-extender?style=flat" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/issues"><img alt="Issues" src="https://img.shields.io/github/issues/adrien2p/medusa-extender?style=flat" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/blob/main/LICENSE"><img alt="Licence" src="https://img.shields.io/github/license/adrien2p/medusa-extender?style=flat" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/blob/main/CONTRIBUTING.md"><img alt="Contributing" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/actions/workflows/action.yml"><img alt="Test pipeline status" src="https://github.com/adrien2p/medusa-extender/actions/workflows/action.yml/badge.svg" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/actions/workflows/pages/pages-build-deployment"><img alt="Page build deployment status" src="https://github.com/adrien2p/medusa-extender/actions/workflows/pages/pages-build-deployment/badge.svg" height="20"/></a>
<a href="https://github.com/adrien2p/medusa-extender/actions/workflows/codeql-analysis.yml"><img alt="CodeQL security analysis status" src="https://github.com/adrien2p/medusa-extender/actions/workflows/codeql-analysis.yml/badge.svg" height="20"/></a>
<a href="https://www.codacy.com/gh/adrien2p/medusa-extender/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=adrien2p/medusa-extender&amp;utm_campaign=Badge_Grade"><img alt="Codacy code quality" src="https://app.codacy.com/project/badge/Grade/379a920025324868a7445d39ae586c39" height="20"/></a>
<a href="https://www.producthunt.com/posts/medusa-extender?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-medusa-extender"><img alt="Product hunt" src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=333482&theme=dark" height="20"/></a>
<a href="https://github.com/sponsors/adrien2p"><img alt="sponsor" src="https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86" height="20"/></a>

Medusa on steroid, take your medusa project to the next level with some badass features :rocket:

The extender provides an out-of-the-box application architecture which allows developers and teams to create highly testable, scalable, loosely coupled, and easily maintainable applications. In also increase medusa extensibility and customisation for special use cases. It comes with handy decorators approach to increase the DX and full typings support for easier development. It is a complement to medusa but not a replacement :rocket:

-----------------------------------------------------

Table of Contents

-----------------------------------------------------

Introduction

Medusa is an open source headless commerce platform that allows you to create your own store in a matter of minutes. Part of what makes Medusa a good choice for your ecommerce store is its extensibility. Now, it is also possible to create multi-vendor marketplaces using Medusa.

:point_right: And here is why I've done that package for medusa

"I've been looking for an e-commerce solution that could provide me with some core features while being fully customisable... After some research, where I found that none of the present solutions could provide what I needed, I chose Medusa as it provided me with many of the needed features while being easy to extend. I ended up loving the community atmosphere, especially the proximity with the team, and have been helping those in the community looking for a similar fully-customisable solution by sharing a part of my private project. This is how the medusa-extender was born." — Adrien de Peretti

-----------------------------------------------------

Getting started :rocket:

Depending on your situation, pick the right getting started section.

Existing medusa project

In that case, you must already have scaffold a new medusa store project. If that's not the case you can follow the tutorial here.

Run the following command in your terminal

npm install medusa-extender
./node_modules/.bin/medex init

That's it, you are now ready to run your server :rocket:

Note: The default port is 9000, if you want to run the server on a custom port update medusa-config.js as follows:

module.exports = {
  /* ... */
  serverConfig:{
    port: <PORT_NUMBER>
  }
  /* ... */
};

From server starter

You can directly clone the starters/server to get started quickly.

First, update your medusa-config.js accordingly to your needs.

Then, follow the next command to be ready in minutes

npx degit github:adrien2p/medusa-extender/starters/server#main server
cd server
npm i
npm run build
npm run start

That's it, your server is now up and running :rocket:

-----------------------------------------------------

CLI medex

To install the cli globally instead of using the local one, you can run the following command

npm i -g medusa-extender

To make things easier for you, the project comes with a CLI that allow you to generate any component with minimum code implementation and also to be able to run the migrations and show the list of applied and to be applied migrations.

To see more about the usage and references, click here to see the documentation

Application Architecture

Using this package help you organise your code in a module approach. That means that you can go for a modular architecture and decoupled your code depending on your domains.

Here is the proposed folder structure that you can add to your medusa project

.
├── ...
├── src                                 # Here are located all the files that make your application
│   ├── modules                         # Where you can put all your modules using the medusa-extender
|       ├── Module1
|           ├── module1.entity.ts
|           ├── module1.migration.ts
|           ├── module1.service.ts
|           ├── module1.repository.ts
|           ├── module1.middleware.ts
|           ├── module1.module.ts       # This is where the above components are referenced
|           ├── ...
|       ├── Module2
|           ├── ...
|       ├── Module3
|           ├── ...
│   ├── main.ts                         # this is where the magic happen and your modules will be passed to the load method
└── ...

-----------------------------------------------------

Discussions

If you are interesting to participate in any discussions you can follow that links

-----------------------------------------------------

Resources

Here are some resources that are using the medusa-extender, more of them will come in time :rocket:.

Marketplace tutorial

Here is a tutorial repository that will be followed by a series of article to guide you through the process of creating your marketplace using @medusajs and the medusa-extender.

Here is the link to the Marketplace tutorial repo and Here is the link to the Marketplace tutorial plugin

Here is the first tutorial using the medusa-extender package, [Open source ecommerce platform for multi-vendor marketplaces](https://dev.to/medus

Extension points exported contracts — how you extend this code

MedusaMiddleware (Interface)
(no doc) [10 implementers]
src/core/types.ts
User (Interface)
(no doc)
starters/server/src/modules/user/index.d.ts
User (Interface)
(no doc)
starters/plugin-module/src/modules/user/index.d.ts
MultiTenancyOptions (Interface)
(no doc)
src/modules/multi-tenancy/types.ts
MedusaDynamicModule (Interface)
(no doc) [8 implementers]
src/core/types.ts
Type (Interface)
(no doc)
src/core/types.ts

Core symbols most depended-on inside this repo

log
called by 66
src/core/logger.ts
get
called by 43
src/core/componentMap.ts
register
called by 39
src/core/event-emmiter.ts
Module
called by 28
src/decorators/module.decorator.ts
makeRequest
called by 19
integration-tests/utils/request.ts
metadataReader
called by 16
src/core/metadata-reader.ts
Service
called by 15
src/decorators/components.decorator.ts
generateComponent
called by 14
src/cli/commands/generate-component.ts

Shape

Class 186
Function 104
Method 90
Interface 6

Languages

TypeScript100%

Modules by API surface

integration-tests/tests/fixtures/loaders.ts36 symbols
integration-tests/tests/fixtures/event-subscribers.ts21 symbols
src/decorators/tests/onMedusaEntityEvent.spec.ts19 symbols
src/loaders/tests/modules.loader.spec.ts17 symbols
src/loaders/tests/providers.loader.spec.ts16 symbols
src/core/tests/metadata-reader.spec.ts16 symbols
src/decorators/onMedusaEntityEvent.decorator.ts14 symbols
src/loaders/tests/repositories.loader.spec.ts13 symbols
src/core/logger.ts12 symbols
src/core/utils.ts11 symbols
src/modules/multi-tenancy/tests/tenant.service.spec.ts9 symbols
src/loaders/tests/services.loader.spec.ts8 symbols

For agents

$ claude mcp add medusa-extender \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact