💉 Medusa on steroid. Extends Typeorm entities and repositories, medusa core services and so on. Get the full power of modular architecture. Keep your domains clean. Build shareable modules 🚀
Do you want to extend existing entities to add custom fields? Do you want to implement your own feature or extend existing one
in a module way? Did you ever wanted to build something more than a single store?
Well, this project has been made to help you reach you goal. It is now possible to customise
Medusa in a way you will be able to enjoy all the awesome features that Medusa provides you
but with the possibility to take your e-commerce project to the next level 🚀
- Getting started 🚀
- Integration within your medusa project
- Features 🧐
- Documentation
- Resources
- Discussions
- Like my work? 💓
- Contribute
IMPORTANT! Using the extender does not break any features from medusa under the hood. The only thing it provides are some badass features
Run the following command in your terminal (The last version is 1.4.5)
npm install medusa-extender
To benefit from all the features that the extender offers you, the usage of typescript is recommended.
If you have already an existing project scaffold with the command medusa new ...
here is how are the following steps to integrate
the extender in your project.
follow the next steps yo be ready to launch 🚀
npm i -D typescript
echo '{
"compilerOptions": {
"module": "CommonJS",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"target": "es2017",
"sourceMap": true,
"skipLibCheck": true,
"allowJs": true,
"outDir": "dist",
"rootDir": ".",
"esModuleInterop": true
},
"include": ["src", "medusa-config.js"],
"exclude": ["dist", "node_modules", "**/*.spec.ts"]
}' > tsconfig.json
update the scripts in your package.json
{
"scripts": {
"build": "rm -rf dist && tsc",
"start": "npm run build && node dist/src/main.js"
}
}
add a main file in the src
directory
// src/main.ts
import express = require('express');
import { Medusa } from 'medusa-extender';
import { resolve } from 'path';
async function bootstrap() {
const expressInstance = express();
const rootDir = resolve(__dirname) + '/../';
await new Medusa(rootDir, expressInstance).load([]);
expressInstance.listen(9000, () => {
console.info('Server successfully started on port 9000');
});
}
bootstrap();
And finally update the develop.sh
script with the following
#!/bin/bash
#Run migrations to ensure the database is updated
medusa migrations run
#Start development environment
npm run start
Here is a list of the features that you can find in that package
- Create or extend an entity
- Create or extend a repository
- Create or extend a service
- Create middleware before or after medusa authentication strategy
- Create new migrations
- Create new router handler
- Extend validators from medusa to includes custom fields
- Emit entity subscribers events
- Listen to entity subscribers and handle them wherever you want
All those features provide you a way to
- Create and manage a market place
- Create a media store to sell nft - video - images - keys - etc.
- And basically create whatever you want on top of
@medusajs
Share your code
- Build shareable modules/plugins to use across your project or to share with the community
Using this package also allow you to manage your architecture as you want. you will not be limited by any constraint as long as the component are decorated and the modules are referenced into the main file to be loaded, everything is fine. 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
└── ...
See our dedicated documentation website for the Medusa-extender package, follow the link
If you are interesting in participate to any discussions you can follow that links
Here are some resources that are using the medusa-extender, more of them will come in time 🚀.
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
This project needs a ⭐ from you. Don't forget to leave a star ⭐. If you found the package helpful consider supporting me with a coffee
Contributions are welcome! You can look at the contribution guidelines