Skip to main content
  1. All Posts/

medusa-extender

eCommerce TypeScript

medusa-extender


Full documentation website





Medusa on steroid, take your medusa project to the next level with some badass features πŸš€
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 πŸš€

Table of Contents

  • Introduction
  • Getting started πŸš€

  • Application Architecture
  • CLI medex

    • Commands references

      • Command generate reference

      •       <li>
                <a rel="nofollow noopener" target="_blank" href="https://adrien2p.github.io/medusa-extender/#/?id=command-migrate-reference">Command <code>migrate</code> reference</a></p> <ul dir="auto">
                  <li>
                    <a rel="nofollow noopener" target="_blank" href="https://adrien2p.github.io/medusa-extender/#/?id=usage-1">Usage</a>
                  </li>
                  <li>
                    <a rel="nofollow noopener" target="_blank" href="https://adrien2p.github.io/medusa-extender/#/?id=options-1">Options</a>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
        
      • Full code API πŸ”
      • API documentation πŸ’‘

        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.
        πŸ‘‰ 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 πŸš€

        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 πŸš€
        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 πŸš€

        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 πŸš€.

        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

        Like my work? πŸ’“

        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

        Contribute

        Contributions are welcome! You can look at the contribution guidelines