- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Marketplace Recipe
This recipe provides the general steps to implement a marketplace in your Medusa application.
Example Guides#
Overview#
A marketplace is an online commerce store that allows different vendors to sell their products within the same commerce system. Customers can purchase products from any of these vendors, and vendors can manage their orders separately.
In Medusa, you can create a Marketplace Module that implements custom data models, such as vendors or sellers, and link those data models to existing ones such as products and orders. You also expose custom features using API routes, and implement complex flows using workflows.
Create Custom Module with Data Models#
In a marketplace, a business or a vendor has a user, and they can use that user to authenticate and manage the vendor's data.
You can create a marketplace module that implements data models for vendors, their admins, anything else that fits your use case.
Define Module Links#
Since a vendor has products, orders, and other models based on your use case, define module links between your module's data models and the commerce module's data models.
For example, if you defined a vendor data model in a marketplace module, you can define a module link between the vendor and the Product Module's product data model.
Allow Vendor Admins to Authenticate#
If your marketplace module implements admins for sellers or vendors, you can create an actor type for it.
Then, you guard custom API routes to only allow authenticated vendor admins.
Create Vendor API Routes#
If you provide vendor or sellers with custom features, or a different way of managing products and orders, create API routes only accessible by vendors exposing your custom features.
Split Orders Based on Vendors#
If your use case allows a customer's orders to have items from different vendors, you can override the Complete Cart API route to change how the order should be created.
If your flow requires different steps, such as creating a parent order then creating a child order, create a workflow and execute it from the API route.
Customize Storefront#
Medusa provides a Next.js Starter storefront that you can customize for your use case.
You can also create a custom storefront from scratch.
Customize Admin#
The Medusa Admin is extendable, allowing you to add widgets to existing pages or create new pages.
If your use case requires bigger customizations to the admin, such as showing different products and orders based on the logged-in vendor, use the admin API routes to build a custom admin.