@mercurjs/docs 2.2.0-canary.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/README.md +24 -0
  2. package/content/blocks.mdx +209 -0
  3. package/content/learn/architecture.mdx +215 -0
  4. package/content/learn/attributes.mdx +89 -0
  5. package/content/learn/blocks.mdx +99 -0
  6. package/content/learn/commissions.mdx +175 -0
  7. package/content/learn/concepts.mdx +84 -0
  8. package/content/learn/installation.mdx +117 -0
  9. package/content/learn/introduction.mdx +71 -0
  10. package/content/learn/offers.mdx +78 -0
  11. package/content/learn/order-groups.mdx +114 -0
  12. package/content/learn/payouts.mdx +175 -0
  13. package/content/learn/product-requests.mdx +82 -0
  14. package/content/learn/products.mdx +79 -0
  15. package/content/learn/registry.mdx +155 -0
  16. package/content/learn/seller-members.mdx +62 -0
  17. package/content/learn/sellers.mdx +118 -0
  18. package/content/migration/from-1-x-to-2-0.mdx +152 -0
  19. package/content/migration/from-2-0-to-2-1.mdx +105 -0
  20. package/content/migration/overview.mdx +58 -0
  21. package/content/references/api/admin/commission-rates/batch-commission-rules.mdx +70 -0
  22. package/content/references/api/admin/commission-rates/create-commission-rate.mdx +95 -0
  23. package/content/references/api/admin/commission-rates/delete-commission-rate.mdx +40 -0
  24. package/content/references/api/admin/commission-rates/list-commission-rates.mdx +92 -0
  25. package/content/references/api/admin/commission-rates/retrieve-commission-rate.mdx +70 -0
  26. package/content/references/api/admin/commission-rates/update-commission-rate.mdx +84 -0
  27. package/content/references/api/admin/members/list-members.mdx +61 -0
  28. package/content/references/api/admin/offers/batch-create-offers.mdx +130 -0
  29. package/content/references/api/admin/offers/delete-offer.mdx +40 -0
  30. package/content/references/api/admin/offers/list-offers.mdx +106 -0
  31. package/content/references/api/admin/offers/retrieve-offer.mdx +82 -0
  32. package/content/references/api/admin/order-groups/list-order-groups.mdx +77 -0
  33. package/content/references/api/admin/order-groups/retrieve-order-group.mdx +56 -0
  34. package/content/references/api/admin/orders/get-order-commission-lines.mdx +65 -0
  35. package/content/references/api/admin/orders/get-order-order-group.mdx +56 -0
  36. package/content/references/api/admin/orders/list-orders.mdx +79 -0
  37. package/content/references/api/admin/payouts/list-payouts.mdx +75 -0
  38. package/content/references/api/admin/payouts/retrieve-payout.mdx +62 -0
  39. package/content/references/api/admin/product-attributes/create-attribute-value.mdx +76 -0
  40. package/content/references/api/admin/product-attributes/create-product-attribute.mdx +99 -0
  41. package/content/references/api/admin/product-attributes/delete-attribute-value.mdx +52 -0
  42. package/content/references/api/admin/product-attributes/delete-product-attribute.mdx +40 -0
  43. package/content/references/api/admin/product-attributes/list-product-attributes.mdx +91 -0
  44. package/content/references/api/admin/product-attributes/retrieve-product-attribute.mdx +81 -0
  45. package/content/references/api/admin/product-attributes/update-attribute-value.mdx +66 -0
  46. package/content/references/api/admin/product-attributes/update-product-attribute.mdx +76 -0
  47. package/content/references/api/admin/product-changes/cancel-product-change.mdx +68 -0
  48. package/content/references/api/admin/product-changes/confirm-product-change.mdx +47 -0
  49. package/content/references/api/admin/products/batch-product-attributes.mdx +96 -0
  50. package/content/references/api/admin/products/confirm-product.mdx +59 -0
  51. package/content/references/api/admin/products/create-product-variant.mdx +78 -0
  52. package/content/references/api/admin/products/create-product.mdx +169 -0
  53. package/content/references/api/admin/products/delete-product-variant.mdx +48 -0
  54. package/content/references/api/admin/products/delete-product.mdx +40 -0
  55. package/content/references/api/admin/products/list-product-variants.mdx +91 -0
  56. package/content/references/api/admin/products/list-products.mdx +109 -0
  57. package/content/references/api/admin/products/preview-product.mdx +78 -0
  58. package/content/references/api/admin/products/reject-product.mdx +59 -0
  59. package/content/references/api/admin/products/request-product-changes.mdx +59 -0
  60. package/content/references/api/admin/products/retrieve-product-variant.mdx +73 -0
  61. package/content/references/api/admin/products/retrieve-product.mdx +96 -0
  62. package/content/references/api/admin/products/set-product-sellers.mdx +47 -0
  63. package/content/references/api/admin/products/update-product-variant.mdx +89 -0
  64. package/content/references/api/admin/products/update-product.mdx +133 -0
  65. package/content/references/api/admin/sellers/add-seller-member.mdx +63 -0
  66. package/content/references/api/admin/sellers/approve-seller.mdx +54 -0
  67. package/content/references/api/admin/sellers/create-seller.mdx +100 -0
  68. package/content/references/api/admin/sellers/delete-member-invite.mdx +42 -0
  69. package/content/references/api/admin/sellers/delete-professional-details.mdx +52 -0
  70. package/content/references/api/admin/sellers/invite-seller-member.mdx +63 -0
  71. package/content/references/api/admin/sellers/list-member-invites.mdx +71 -0
  72. package/content/references/api/admin/sellers/list-seller-members.mdx +71 -0
  73. package/content/references/api/admin/sellers/list-seller-products.mdx +85 -0
  74. package/content/references/api/admin/sellers/list-sellers.mdx +96 -0
  75. package/content/references/api/admin/sellers/remove-seller-member.mdx +42 -0
  76. package/content/references/api/admin/sellers/resend-member-invite.mdx +55 -0
  77. package/content/references/api/admin/sellers/retrieve-seller.mdx +81 -0
  78. package/content/references/api/admin/sellers/suspend-seller.mdx +60 -0
  79. package/content/references/api/admin/sellers/terminate-seller.mdx +60 -0
  80. package/content/references/api/admin/sellers/unsuspend-seller.mdx +52 -0
  81. package/content/references/api/admin/sellers/unterminate-seller.mdx +52 -0
  82. package/content/references/api/admin/sellers/update-seller.mdx +83 -0
  83. package/content/references/api/admin/sellers/upsert-payment-details.mdx +88 -0
  84. package/content/references/api/admin/sellers/upsert-professional-details.mdx +78 -0
  85. package/content/references/api/admin/sellers/upsert-seller-address.mdx +91 -0
  86. package/content/references/api/admin.mdx +134 -0
  87. package/content/references/api/conventions.mdx +109 -0
  88. package/content/references/api/store/carts/add-line-item.mdx +115 -0
  89. package/content/references/api/store/carts/add-shipping-methods.mdx +84 -0
  90. package/content/references/api/store/carts/apply-promotions.mdx +83 -0
  91. package/content/references/api/store/carts/complete-cart.mdx +98 -0
  92. package/content/references/api/store/offers/list-offers.mdx +161 -0
  93. package/content/references/api/store/offers/retrieve-offer.mdx +112 -0
  94. package/content/references/api/store/order-groups/list-order-groups.mdx +105 -0
  95. package/content/references/api/store/order-groups/retrieve-order-group.mdx +78 -0
  96. package/content/references/api/store/product-attributes/list-product-attributes.mdx +134 -0
  97. package/content/references/api/store/product-attributes/retrieve-product-attribute.mdx +78 -0
  98. package/content/references/api/store/product-categories/list-product-categories.mdx +126 -0
  99. package/content/references/api/store/product-categories/retrieve-product-category.mdx +79 -0
  100. package/content/references/api/store/products/list-products.mdx +184 -0
  101. package/content/references/api/store/products/retrieve-product.mdx +107 -0
  102. package/content/references/api/store/search/search.mdx +136 -0
  103. package/content/references/api/store/sellers/list-sellers.mdx +105 -0
  104. package/content/references/api/store/sellers/retrieve-seller.mdx +62 -0
  105. package/content/references/api/store/shipping-options/list-shipping-options.mdx +74 -0
  106. package/content/references/api/store.mdx +67 -0
  107. package/content/references/api/vendor/members/accept-member-invite.mdx +65 -0
  108. package/content/references/api/vendor/members/retrieve-current-member.mdx +51 -0
  109. package/content/references/api/vendor/members/update-current-member.mdx +70 -0
  110. package/content/references/api/vendor/offers/batch-create-offers.mdx +123 -0
  111. package/content/references/api/vendor/offers/batch-offer-inventory-items.mdx +103 -0
  112. package/content/references/api/vendor/offers/create-offer.mdx +141 -0
  113. package/content/references/api/vendor/offers/delete-offer.mdx +51 -0
  114. package/content/references/api/vendor/offers/list-offers.mdx +125 -0
  115. package/content/references/api/vendor/offers/retrieve-offer.mdx +74 -0
  116. package/content/references/api/vendor/offers/update-offer.mdx +82 -0
  117. package/content/references/api/vendor/orders/cancel-fulfillment.mdx +63 -0
  118. package/content/references/api/vendor/orders/cancel-order.mdx +56 -0
  119. package/content/references/api/vendor/orders/complete-order.mdx +55 -0
  120. package/content/references/api/vendor/orders/create-fulfillment.mdx +76 -0
  121. package/content/references/api/vendor/orders/create-shipment.mdx +99 -0
  122. package/content/references/api/vendor/orders/get-order-commission-lines.mdx +66 -0
  123. package/content/references/api/vendor/orders/list-order-changes.mdx +75 -0
  124. package/content/references/api/vendor/orders/list-orders.mdx +103 -0
  125. package/content/references/api/vendor/orders/mark-fulfillment-delivered.mdx +62 -0
  126. package/content/references/api/vendor/orders/preview-order.mdx +65 -0
  127. package/content/references/api/vendor/orders/retrieve-order.mdx +84 -0
  128. package/content/references/api/vendor/payout-accounts/create-onboarding.mdx +68 -0
  129. package/content/references/api/vendor/payout-accounts/create-payout-account.mdx +59 -0
  130. package/content/references/api/vendor/payout-accounts/retrieve-payout-account-by-id.mdx +60 -0
  131. package/content/references/api/vendor/payout-accounts/retrieve-payout-account.mdx +77 -0
  132. package/content/references/api/vendor/payouts/list-payouts.mdx +90 -0
  133. package/content/references/api/vendor/payouts/retrieve-payout.mdx +63 -0
  134. package/content/references/api/vendor/product-attributes/list-product-attributes.mdx +135 -0
  135. package/content/references/api/vendor/product-attributes/retrieve-product-attribute.mdx +71 -0
  136. package/content/references/api/vendor/product-variants/list-variants.mdx +136 -0
  137. package/content/references/api/vendor/products/batch-product-attributes.mdx +104 -0
  138. package/content/references/api/vendor/products/cancel-product-change.mdx +62 -0
  139. package/content/references/api/vendor/products/create-product-variant.mdx +92 -0
  140. package/content/references/api/vendor/products/create-product.mdx +197 -0
  141. package/content/references/api/vendor/products/delete-product-variant.mdx +68 -0
  142. package/content/references/api/vendor/products/delete-product.mdx +62 -0
  143. package/content/references/api/vendor/products/list-product-variants.mdx +114 -0
  144. package/content/references/api/vendor/products/list-products.mdx +163 -0
  145. package/content/references/api/vendor/products/preview-product.mdx +61 -0
  146. package/content/references/api/vendor/products/retrieve-product-variant.mdx +76 -0
  147. package/content/references/api/vendor/products/retrieve-product.mdx +69 -0
  148. package/content/references/api/vendor/products/update-product-variant.mdx +104 -0
  149. package/content/references/api/vendor/products/update-product.mdx +148 -0
  150. package/content/references/api/vendor/sellers/create-seller.mdx +150 -0
  151. package/content/references/api/vendor/sellers/delete-professional-details.mdx +54 -0
  152. package/content/references/api/vendor/sellers/invite-seller-member.mdx +67 -0
  153. package/content/references/api/vendor/sellers/list-member-invites.mdx +82 -0
  154. package/content/references/api/vendor/sellers/list-seller-members.mdx +80 -0
  155. package/content/references/api/vendor/sellers/list-sellers.mdx +71 -0
  156. package/content/references/api/vendor/sellers/remove-seller-member.mdx +48 -0
  157. package/content/references/api/vendor/sellers/retrieve-current-seller-member.mdx +59 -0
  158. package/content/references/api/vendor/sellers/retrieve-current-seller.mdx +69 -0
  159. package/content/references/api/vendor/sellers/select-seller.mdx +44 -0
  160. package/content/references/api/vendor/sellers/update-current-seller.mdx +108 -0
  161. package/content/references/api/vendor/sellers/update-member-role.mdx +51 -0
  162. package/content/references/api/vendor/sellers/upsert-payment-details.mdx +74 -0
  163. package/content/references/api/vendor/sellers/upsert-professional-details.mdx +70 -0
  164. package/content/references/api/vendor/sellers/upsert-seller-address.mdx +81 -0
  165. package/content/references/api/vendor.mdx +150 -0
  166. package/content/references/configuration.mdx +155 -0
  167. package/content/references/modules/commission.mdx +106 -0
  168. package/content/references/modules/custom-fields.mdx +45 -0
  169. package/content/references/modules/media.mdx +55 -0
  170. package/content/references/modules/offer.mdx +64 -0
  171. package/content/references/modules/payout.mdx +121 -0
  172. package/content/references/modules/product-attribute.mdx +111 -0
  173. package/content/references/modules/product-edit.mdx +80 -0
  174. package/content/references/modules/search.mdx +112 -0
  175. package/content/references/modules/seller.mdx +175 -0
  176. package/content/references/overview.mdx +70 -0
  177. package/content/references/workflows/cart/add-seller-shipping-method-to-cart.mdx +44 -0
  178. package/content/references/workflows/cart/complete-cart-with-split-orders.mdx +36 -0
  179. package/content/references/workflows/cart/list-seller-shipping-options-for-cart.mdx +39 -0
  180. package/content/references/workflows/cart/update-cart-seller-promotions.mdx +42 -0
  181. package/content/references/workflows/commission/batch-commission-rules.mdx +45 -0
  182. package/content/references/workflows/commission/create-commission-rates.mdx +41 -0
  183. package/content/references/workflows/commission/delete-commission-rates.mdx +34 -0
  184. package/content/references/workflows/commission/refresh-order-commission-lines.mdx +30 -0
  185. package/content/references/workflows/commission/update-commission-rates.mdx +35 -0
  186. package/content/references/workflows/media/set-category-images.mdx +41 -0
  187. package/content/references/workflows/media/set-collection-images.mdx +41 -0
  188. package/content/references/workflows/member/accept-member-invite.mdx +33 -0
  189. package/content/references/workflows/member/add-seller-member.mdx +30 -0
  190. package/content/references/workflows/member/create-member-invites.mdx +34 -0
  191. package/content/references/workflows/member/delete-member-invite.mdx +24 -0
  192. package/content/references/workflows/member/remove-seller-member.mdx +28 -0
  193. package/content/references/workflows/member/resend-member-invite.mdx +28 -0
  194. package/content/references/workflows/member/update-member-role.mdx +28 -0
  195. package/content/references/workflows/member/update-member.mdx +35 -0
  196. package/content/references/workflows/offer/batch-offer-inventory-items.mdx +58 -0
  197. package/content/references/workflows/offer/create-offers.mdx +63 -0
  198. package/content/references/workflows/offer/delete-offers.mdx +35 -0
  199. package/content/references/workflows/offer/update-offers.mdx +51 -0
  200. package/content/references/workflows/order/cancel-order-fulfillment.mdx +34 -0
  201. package/content/references/workflows/order/confirm-claim-request.mdx +25 -0
  202. package/content/references/workflows/order/confirm-exchange-request.mdx +25 -0
  203. package/content/references/workflows/order/confirm-order-edit-request.mdx +25 -0
  204. package/content/references/workflows/order/confirm-return-receive.mdx +25 -0
  205. package/content/references/workflows/order/create-order-fulfillment.mdx +45 -0
  206. package/content/references/workflows/order-group/get-order-group-detail.mdx +29 -0
  207. package/content/references/workflows/order-group/get-order-groups-list.mdx +36 -0
  208. package/content/references/workflows/overview.mdx +72 -0
  209. package/content/references/workflows/payout/create-onboarding.mdx +36 -0
  210. package/content/references/workflows/payout/create-payout-account.mdx +33 -0
  211. package/content/references/workflows/payout/create-payout.mdx +30 -0
  212. package/content/references/workflows/payout/process-payout-for-webhook.mdx +32 -0
  213. package/content/references/workflows/product/confirm-products.mdx +46 -0
  214. package/content/references/workflows/product/create-products.mdx +63 -0
  215. package/content/references/workflows/product/link-sellers-to-product-category.mdx +40 -0
  216. package/content/references/workflows/product/link-sellers-to-product.mdx +40 -0
  217. package/content/references/workflows/product/reject-product.mdx +46 -0
  218. package/content/references/workflows/product/request-product-change.mdx +46 -0
  219. package/content/references/workflows/product-attribute/add-product-attributes-to-product.mdx +49 -0
  220. package/content/references/workflows/product-attribute/create-and-link-product-attributes-to-product.mdx +46 -0
  221. package/content/references/workflows/product-attribute/create-product-attribute-values.mdx +43 -0
  222. package/content/references/workflows/product-attribute/create-product-attributes.mdx +56 -0
  223. package/content/references/workflows/product-attribute/delete-product-attribute-values.mdx +30 -0
  224. package/content/references/workflows/product-attribute/delete-product-attributes.mdx +30 -0
  225. package/content/references/workflows/product-attribute/remove-product-attributes-from-product.mdx +29 -0
  226. package/content/references/workflows/product-attribute/update-product-attribute-values.mdx +44 -0
  227. package/content/references/workflows/product-attribute/update-product-attributes-on-product.mdx +41 -0
  228. package/content/references/workflows/product-attribute/update-product-attributes.mdx +48 -0
  229. package/content/references/workflows/product-attribute/upsert-product-attribute-values.mdx +43 -0
  230. package/content/references/workflows/product-edit/auto-confirm-product-change.mdx +39 -0
  231. package/content/references/workflows/product-edit/cancel-product-change.mdx +49 -0
  232. package/content/references/workflows/product-edit/confirm-product-change.mdx +57 -0
  233. package/content/references/workflows/product-edit/create-product-change.mdx +72 -0
  234. package/content/references/workflows/product-edit/reject-product-change.mdx +54 -0
  235. package/content/references/workflows/product-edit/stage-product-change.mdx +75 -0
  236. package/content/references/workflows/seller/approve-seller.mdx +34 -0
  237. package/content/references/workflows/seller/create-seller-account.mdx +59 -0
  238. package/content/references/workflows/seller/create-seller-defaults.mdx +22 -0
  239. package/content/references/workflows/seller/create-sellers.mdx +65 -0
  240. package/content/references/workflows/seller/delete-seller-professional-details.mdx +37 -0
  241. package/content/references/workflows/seller/delete-sellers.mdx +24 -0
  242. package/content/references/workflows/seller/invite-seller.mdx +28 -0
  243. package/content/references/workflows/seller/suspend-seller.mdx +35 -0
  244. package/content/references/workflows/seller/terminate-seller.mdx +35 -0
  245. package/content/references/workflows/seller/unsuspend-seller.mdx +34 -0
  246. package/content/references/workflows/seller/unterminate-seller.mdx +34 -0
  247. package/content/references/workflows/seller/update-seller-address.mdx +55 -0
  248. package/content/references/workflows/seller/update-seller-payment-details.mdx +52 -0
  249. package/content/references/workflows/seller/update-seller-professional-details.mdx +48 -0
  250. package/content/references/workflows/seller/update-sellers.mdx +57 -0
  251. package/content/resources/ai/llms.mdx +74 -0
  252. package/content/resources/ai/mcp.mdx +152 -0
  253. package/content/resources/ai/overview.mdx +97 -0
  254. package/content/resources/customization/custom-fields.mdx +182 -0
  255. package/content/resources/customization/extend-a-workflow.mdx +39 -0
  256. package/content/resources/customization/extending-panels.mdx +309 -0
  257. package/content/resources/deployment/medusa-cloud.mdx +167 -0
  258. package/content/resources/integrations/notifications.mdx +39 -0
  259. package/content/resources/integrations/search.mdx +122 -0
  260. package/content/resources/integrations/stripe-connect.mdx +395 -0
  261. package/content/resources/tutorials/add-a-block.mdx +74 -0
  262. package/content/resources/tutorials/attributes-and-variant-axes.mdx +111 -0
  263. package/content/resources/tutorials/build-a-block.mdx +134 -0
  264. package/content/resources/tutorials/configure-commissions.mdx +127 -0
  265. package/content/resources/tutorials/custom-api-route.mdx +142 -0
  266. package/content/resources/tutorials/custom-panel-page.mdx +78 -0
  267. package/content/resources/tutorials/first-marketplace.mdx +45 -0
  268. package/content/resources/tutorials/handle-product-requests.mdx +80 -0
  269. package/content/resources/tutorials/import-export-products.mdx +96 -0
  270. package/content/resources/tutorials/master-products-and-offers.mdx +89 -0
  271. package/content/resources/tutorials/recompose-a-page.mdx +129 -0
  272. package/content/resources/tutorials/replace-panel-components.mdx +116 -0
  273. package/content/resources/tutorials/seller-payouts-stripe.mdx +89 -0
  274. package/content/telemetry.mdx +67 -0
  275. package/content/tools/api-client.mdx +155 -0
  276. package/content/tools/cli.mdx +196 -0
  277. package/content/tools/dashboard-sdk.mdx +35 -0
  278. package/content/user-guide/admin/overview.mdx +23 -0
  279. package/content/user-guide/admin/stores.mdx +193 -0
  280. package/content/user-guide/vendor/overview.mdx +23 -0
  281. package/content/user-guide/vendor/stores.mdx +209 -0
  282. package/llms.txt +307 -0
  283. package/package.json +33 -0
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @mercurjs/docs
2
+
3
+ Bundled Mercur documentation, shipped as a dependency so AI agents can read it
4
+ locally — offline and version-matched to the installed packages.
5
+
6
+ ## For agents
7
+
8
+ 1. Read `llms.txt` — a grouped index of every page with its description.
9
+ 2. Open the referenced file under `content/` for the full page before implementing.
10
+
11
+ Paths in `llms.txt` are relative to this package
12
+ (`node_modules/@mercurjs/docs/`).
13
+
14
+ ## Contents
15
+
16
+ - `llms.txt` — the index.
17
+ - `content/**/*.mdx` — the documentation pages, mirroring the structure of the
18
+ docs site (`learn/`, `resources/`, `tools/`, `references/`, `user-guide/`,
19
+ `migration/`).
20
+
21
+ ## Build
22
+
23
+ `content/` and `llms.txt` are generated from `apps/docs/rc` by
24
+ `scripts/build.mjs` (run via `turbo run build`). They are not committed.
@@ -0,0 +1,209 @@
1
+ ---
2
+ title: "Official Blocks"
3
+ sidebarTitle: "Official Blocks"
4
+ description: "Modular blocks from the official Mercur registry — install only what you need."
5
+ mode: "custom"
6
+ ---
7
+
8
+ <div className="max-w-5xl mx-auto px-6 py-16">
9
+
10
+ <div className="mb-12">
11
+ <h1 className="text-4xl font-bold tracking-tight mb-4">Official Blocks</h1>
12
+ <p className="text-lg text-gray-500 dark:text-gray-400 max-w-2xl mb-6">
13
+ Blocks are modular pieces of marketplace functionality — API routes, workflows, UI pages, and data models. Each block is copied directly into your project. You own the code.
14
+ </p>
15
+ <div className="inline-flex items-center gap-3 px-4 py-2.5 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800">
16
+ <code className="text-sm font-mono text-gray-800 dark:text-gray-100">bunx @mercurjs/cli@rc add &lt;block-name&gt;</code>
17
+ </div>
18
+ </div>
19
+
20
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
21
+
22
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
23
+ <div className="flex items-center gap-3 mb-1">
24
+ <span className="text-base">⭐</span>
25
+ <h3 className="font-semibold text-base m-0">reviews</h3>
26
+ </div>
27
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Product and seller reviews with ratings, customer/vendor/admin API routes, and workflows.</p>
28
+ <div className="flex flex-wrap gap-1.5">
29
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">module</span>
30
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
31
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
32
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">admin</span>
33
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">vendor</span>
34
+ </div>
35
+ </div>
36
+
37
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
38
+ <div className="flex items-center gap-3 mb-1">
39
+ <span className="text-base">👥</span>
40
+ <h3 className="font-semibold text-base m-0">team-management</h3>
41
+ </div>
42
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Team member management with invitations, roles, and vendor portal pages.</p>
43
+ <div className="flex flex-wrap gap-1.5">
44
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">module</span>
45
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
46
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
47
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">vendor</span>
48
+ </div>
49
+ </div>
50
+
51
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
52
+ <div className="flex items-center gap-3 mb-1">
53
+ <span className="text-base">🔖</span>
54
+ <h3 className="font-semibold text-base m-0">wishlist</h3>
55
+ </div>
56
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Customer wishlist with product bookmarking, pricing context, and store API endpoints.</p>
57
+ <div className="flex flex-wrap gap-1.5">
58
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">module</span>
59
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
60
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
61
+ </div>
62
+ </div>
63
+
64
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
65
+ <div className="flex items-center gap-3 mb-1">
66
+ <span className="text-base">🔔</span>
67
+ <h3 className="font-semibold text-base m-0">vendor-notifications</h3>
68
+ </div>
69
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Vendor notification feed with bell icon in the navbar and a vendor API endpoint.</p>
70
+ <div className="flex flex-wrap gap-1.5">
71
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
72
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">vendor</span>
73
+ </div>
74
+ </div>
75
+
76
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
77
+ <div className="flex items-center gap-3 mb-1">
78
+ <span className="text-base">🔍</span>
79
+ <h3 className="font-semibold text-base m-0">algolia</h3>
80
+ </div>
81
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Algolia search integration with product indexing, event-driven sync, and store search API.</p>
82
+ <div className="flex flex-wrap gap-1.5">
83
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">module</span>
84
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
85
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
86
+ </div>
87
+ </div>
88
+
89
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
90
+ <div className="flex items-center gap-3 mb-1">
91
+ <span className="text-base">🔎</span>
92
+ <h3 className="font-semibold text-base m-0">meilisearch</h3>
93
+ </div>
94
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Meilisearch search integration with product indexing, seller moderation sync, filtering, and store/admin API.</p>
95
+ <div className="flex flex-wrap gap-1.5">
96
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">module</span>
97
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
98
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
99
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">subscriber</span>
100
+ </div>
101
+ </div>
102
+
103
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
104
+ <div className="flex items-center gap-3 mb-1">
105
+ <span className="text-base">✅</span>
106
+ <h3 className="font-semibold text-base m-0">requests</h3>
107
+ </div>
108
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Admin approval system for entity requests — list, review, accept or reject submissions.</p>
109
+ <div className="flex flex-wrap gap-1.5">
110
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
111
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
112
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">admin</span>
113
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">vendor</span>
114
+ </div>
115
+ </div>
116
+
117
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
118
+ <div className="flex items-center gap-3 mb-1">
119
+ <span className="text-base">📦</span>
120
+ <h3 className="font-semibold text-base m-0">product-import-export</h3>
121
+ </div>
122
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">CSV product import & export for vendors. Includes API routes, workflows, and portal drawers.</p>
123
+ <div className="flex flex-wrap gap-1.5">
124
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
125
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
126
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">vendor</span>
127
+ </div>
128
+ </div>
129
+
130
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
131
+ <div className="flex items-center gap-3 mb-1">
132
+ <span className="text-base">💬</span>
133
+ <h3 className="font-semibold text-base m-0">vendor-chat</h3>
134
+ </div>
135
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">TalkJS chat integration for vendors — API endpoint for seller conversations and a Messages page.</p>
136
+ <div className="flex flex-wrap gap-1.5">
137
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
138
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">vendor</span>
139
+ </div>
140
+ </div>
141
+
142
+ <div className="p-5 rounded-xl border border-gray-200 dark:border-gray-800">
143
+ <div className="flex items-center gap-3 mb-1">
144
+ <span className="text-base">✉️</span>
145
+ <h3 className="font-semibold text-base m-0">messaging</h3>
146
+ </div>
147
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">Buyer-vendor messaging with real-time SSE, content filtering, chat blocking, rate limiting, and admin oversight.</p>
148
+ <div className="flex flex-wrap gap-1.5">
149
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">module</span>
150
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">workflow</span>
151
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">api</span>
152
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">admin</span>
153
+ <span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-0.5">vendor</span>
154
+ </div>
155
+ </div>
156
+
157
+ </div>
158
+
159
+ <div className="mt-10 p-5 rounded-xl border border-gray-200 dark:border-gray-800">
160
+ <p className="text-sm text-gray-500 dark:text-gray-400 m-0">
161
+ Blocks are copied directly into your project — no runtime dependencies on Mercur.
162
+ After installing, follow the setup steps in the <a href="/developer-guide/blocks" className="text-gray-900 dark:text-gray-100 font-medium underline underline-offset-2">Developer Guide</a>.
163
+ Want to build your own? See the <a href="/developer-guide/registry" className="text-gray-900 dark:text-gray-100 font-medium underline underline-offset-2">Registry Guide</a>.
164
+ </p>
165
+ </div>
166
+
167
+ <div className="mt-12 mb-4">
168
+ <h2 className="text-2xl font-bold tracking-tight mb-4">Quick Start</h2>
169
+
170
+ <h3 className="text-lg font-semibold mb-2">Install a block</h3>
171
+
172
+ ```bash
173
+ bunx @mercurjs/cli@rc add reviews
174
+ ```
175
+
176
+ This copies the block source code into your project:
177
+
178
+ ```
179
+ src/
180
+ ├── modules/reviews/ # Data model and service
181
+ │ ├── models/
182
+ │ ├── service.ts
183
+ │ └── index.ts
184
+ ├── workflows/reviews/ # Business logic
185
+ │ ├── create-review.ts
186
+ │ └── index.ts
187
+ ├── api/
188
+ │ ├── admin/reviews/ # Admin API routes
189
+ │ ├── vendor/reviews/ # Vendor API routes
190
+ │ └── store/reviews/ # Storefront API routes
191
+ └── admin/
192
+ └── routes/reviews/ # Admin dashboard pages
193
+ ```
194
+
195
+ <h3 className="text-lg font-semibold mt-6 mb-2">Search blocks</h3>
196
+
197
+ ```bash
198
+ bunx @mercurjs/cli@rc search -q "reviews"
199
+ ```
200
+
201
+ <h3 className="text-lg font-semibold mt-6 mb-2">Compare local changes against registry</h3>
202
+
203
+ ```bash
204
+ bunx @mercurjs/cli@rc diff reviews
205
+ ```
206
+
207
+ </div>
208
+
209
+ </div>
@@ -0,0 +1,215 @@
1
+ ---
2
+ title: "Overview"
3
+ description: "How Mercur is built — architecture, technology stack, and how the pieces fit together."
4
+ ---
5
+
6
+ Mercur is a marketplace platform built on top of [MedusaJS](https://medusajs.com), an open-source headless commerce framework. Rather than being a standalone application, Mercur extends Medusa with marketplace-specific logic — sellers, commissions, order splitting, payouts — while Medusa handles the foundational commerce layer.
7
+
8
+ This page explains how the system is structured and how its components interact.
9
+
10
+ ## Architecture
11
+
12
+ Mercur follows a layered architecture where each layer has a distinct responsibility:
13
+
14
+ ```mermaid
15
+ graph TD
16
+ subgraph Frontend Layer
17
+ A[Admin Panel]
18
+ B[Vendor Portal]
19
+ C[Storefront]
20
+ end
21
+
22
+ subgraph API Layer
23
+ D["/admin/*"]
24
+ E["/vendor/*"]
25
+ F["/store/*"]
26
+ end
27
+
28
+ subgraph Marketplace Layer - Mercur
29
+ G[Modules · Workflows · Links · Subscribers · Events]
30
+ end
31
+
32
+ subgraph Commerce Layer - Medusa
33
+ H[Products · Orders · Carts · Payments · Fulfillment]
34
+ end
35
+
36
+ I[(PostgreSQL)]
37
+
38
+ A --> D
39
+ B --> E
40
+ C --> F
41
+ D --> G
42
+ E --> G
43
+ F --> G
44
+ G --> H
45
+ H --> I
46
+ ```
47
+
48
+ ### Commerce layer
49
+
50
+ Medusa provides the core commerce engine — products, pricing, carts, orders, payments, fulfillment, promotions, and inventory. Mercur does not replace any of this. Instead, it builds on top using Medusa's extension model: custom modules, links, workflows, and API routes.
51
+
52
+ ### Marketplace layer
53
+
54
+ This is where Mercur's code lives. It introduces marketplace modules — **Seller**, **Commission**, **Offer**, **Payout**, **Product Attribute**, and **Product Edit**, among others — along with workflows that coordinate marketplace-specific operations like order splitting, product approvals, and commission calculation. Links connect these modules to Medusa's core entities (products, orders, customers) without modifying the original models.
55
+
56
+ ### API layer
57
+
58
+ Mercur exposes three sets of HTTP endpoints:
59
+
60
+ | API | Path | Purpose |
61
+ |-----|------|---------|
62
+ | **Admin** | `/admin/*` | Platform administration — manage sellers, configure commission rates, view payouts |
63
+ | **Vendor** | `/vendor/*` | Seller operations — manage products, orders, fulfillment, shipping, inventory, payouts |
64
+ | **Store** | `/store/*` | Storefront — browse sellers, manage carts, checkout with order splitting |
65
+
66
+ Each API route is composed of a request handler, middleware, query configuration, and Zod validators.
67
+
68
+ ### Frontend layer
69
+
70
+ Three interfaces consume the APIs:
71
+
72
+ - **Admin Panel** — Built with React and Medusa UI components. Operators use it to manage the marketplace: approve sellers, set commission rates, handle disputes.
73
+ - **Vendor Portal** — A React application for sellers to manage their products, orders, fulfillment, and payouts. Uses file-based routing via the Dashboard SDK.
74
+ - **Storefront** — Customer-facing application. Can be built with any frontend technology that consumes the Store API.
75
+
76
+ ## Technology stack
77
+
78
+ | Layer | Technology |
79
+ |-------|-----------|
80
+ | Runtime | Node.js 20+, TypeScript |
81
+ | Framework | MedusaJS v2 |
82
+ | Database | PostgreSQL |
83
+ | Frontend | React 18, React Router, Vite |
84
+ | Data fetching | TanStack React Query |
85
+ | UI components | Medusa UI, Radix UI |
86
+ | Form handling | React Hook Form, Zod |
87
+ | Tables | TanStack React Table |
88
+ | Build | Turborepo (monorepo), Bun (package manager), tsup |
89
+ | Internationalization | i18next |
90
+
91
+ ## Core plugin
92
+
93
+ The core plugin (`@mercurjs/core`) is the main package that contains all marketplace logic. It's structured as a standard MedusaJS plugin:
94
+
95
+ ```
96
+ core/src/
97
+ ├── modules/ # Data models and services
98
+ │ ├── seller/ # Seller registration, profiles, members, order groups
99
+ │ ├── commission/ # Commission rates, rules, calculation
100
+ │ ├── offer/ # Seller listings against the shared product catalog
101
+ │ ├── payout/ # Payout accounts, onboarding, payouts
102
+ │ ├── product-attribute/ # Typed attribute catalog and values
103
+ │ ├── product-edit/ # Product change requests and audit trail
104
+ │ └── ... # Media, custom fields, search
105
+ ├── links/ # Relationships between modules
106
+ ├── workflows/ # Multi-step business processes
107
+ │ ├── seller/ # Seller CRUD workflows
108
+ │ ├── cart/ # Cart completion with order splitting
109
+ │ ├── commission/ # Commission rate and line management
110
+ │ ├── payout/ # Payout processing and crediting
111
+ │ ├── offer/ # Offer lifecycle
112
+ │ ├── product/ # Product approval and seller linking
113
+ │ ├── product-edit/ # Change-request lifecycle
114
+ │ ├── order-group/ # Order group operations
115
+ │ └── ... # Attributes, shipping, inventory, promotions, etc.
116
+ ├── api/ # HTTP route handlers
117
+ │ ├── admin/ # Admin API routes
118
+ │ ├── vendor/ # Vendor API routes
119
+ │ ├── store/ # Store API routes
120
+ │ └── hooks/ # Webhook handlers
121
+ ├── subscribers/ # Event listeners
122
+ ├── providers/ # Third-party provider integrations
123
+ └── jobs/ # Scheduled background tasks
124
+ ```
125
+
126
+ ### Modules
127
+
128
+ Modules encapsulate data models and business logic for a specific domain. Each module is self-contained with its own models, service, migrations, and repositories. Modules don't reference each other directly — they communicate through links and workflows.
129
+
130
+ ### Links
131
+
132
+ Links define relationships between Mercur modules and Medusa core entities. For example, the `product-seller-link` connects a Medusa `Product` to a Mercur `Seller` without modifying either model. Dozens of links wire the marketplace layer into the commerce layer — connecting sellers to their scoped resources (orders, customers, shipping, inventory, promotions), offers to products, variants, prices, and line items, order groups to carts and orders, and attributes to Medusa's native product options.
133
+
134
+ ### Workflows
135
+
136
+ Workflows orchestrate multi-step operations that span multiple modules. They support compensation (automatic rollback on failure) and hooks (extension points for custom logic). The most significant workflow is `completeCartWithSplitOrdersWorkflow`, which handles the entire checkout process — validating items, splitting by seller, creating orders, allocating payments, and calculating commissions.
137
+
138
+ ### Subscribers and events
139
+
140
+ Subscribers listen for events emitted by workflows and trigger asynchronous side effects — sending notifications, updating external systems, or processing webhooks. This keeps the core workflows focused on their primary job while allowing the system to react to changes.
141
+
142
+ ## How data flows
143
+
144
+ A typical customer purchase flows through the system like this:
145
+
146
+ 1. **Customer adds items** from multiple sellers to their cart (Store API)
147
+ 2. **Cart completion** triggers the split order workflow (Marketplace Layer)
148
+ 3. Items are **grouped by seller**, and a separate order is created for each (Commerce + Marketplace Layer)
149
+ 4. **Commission lines** are calculated for each order based on matching rates (Commission Module)
150
+ 5. **Payment is split** proportionally across seller orders (Commerce Layer)
151
+ 6. Each seller's order is **credited to their payout account** after commission deduction (Payout Module)
152
+ 7. **Events are emitted** — triggering notifications, webhook calls, and other side effects (Subscribers)
153
+ 8. Sellers **manage their orders** through the Vendor Portal (Vendor API)
154
+ 9. The admin **monitors everything** through the Admin Panel (Admin API)
155
+
156
+ ## Block-based distribution
157
+
158
+ Mercur uses a **block-based architecture** for distribution. Instead of installing an opaque package, the CLI copies source code directly into your project. Each block is a self-contained piece of functionality — a module, a workflow, an API route, or a UI extension.
159
+
160
+ This means:
161
+ - You own every line of code in your project
162
+ - You can modify any block to fit your business requirements
163
+ - There are no hidden abstractions or version conflicts
164
+ - Updates are explicit — you diff and apply changes from the registry
165
+
166
+ The CLI (`@mercurjs/cli@rc`) manages this process: scaffolding projects, installing blocks, searching the registry, and comparing local changes against upstream versions.
167
+
168
+ ## Workflow example
169
+
170
+ Here is a simplified example of how a Mercur workflow is structured. Workflows coordinate multi-step operations with automatic rollback on failure:
171
+
172
+ ```typescript
173
+ import {
174
+ createWorkflow,
175
+ createStep,
176
+ StepResponse,
177
+ WorkflowResponse,
178
+ } from "@medusajs/framework/workflows-sdk"
179
+ import { MercurModules } from "@mercurjs/types"
180
+
181
+ const validateSellerStep = createStep(
182
+ "validate-seller",
183
+ async ({ seller_id }: { seller_id: string }, { container }) => {
184
+ const sellerService = container.resolve(MercurModules.SELLER)
185
+ const seller = await sellerService.retrieveSeller(seller_id)
186
+
187
+ if (seller.status !== "open") {
188
+ throw new Error("Seller is not active")
189
+ }
190
+
191
+ return new StepResponse(seller)
192
+ }
193
+ )
194
+
195
+ const createProductForSellerWorkflow = createWorkflow(
196
+ "create-product-for-seller",
197
+ (input: { seller_id: string }) => {
198
+ const seller = validateSellerStep({ seller_id: input.seller_id })
199
+
200
+ // Additional steps: create product, link to seller, etc.
201
+
202
+ return new WorkflowResponse({ seller })
203
+ }
204
+ )
205
+ ```
206
+
207
+ ## Design principles
208
+
209
+ **Modular over monolithic** — Each marketplace feature is a separate module that can be installed, modified, or replaced independently. You don't need to use all of Mercur to benefit from it.
210
+
211
+ **Explicit over implicit** — Relationships between modules are defined through links, not hidden in service code. Workflows make multi-step operations visible and debuggable. API routes are file-based and predictable.
212
+
213
+ **Extensible over configurable** — Rather than exposing hundreds of configuration options, Mercur provides extension points. Workflows have hooks. Providers are pluggable. Models can be extended through Medusa's framework. When configuration isn't enough, you modify the source code directly.
214
+
215
+ **Commerce-aware** — Mercur doesn't reinvent commerce. It delegates products, pricing, orders, payments, and fulfillment to Medusa, and focuses exclusively on the marketplace logic that multi-vendor systems need.
@@ -0,0 +1,89 @@
1
+ ---
2
+ title: "Product Attributes"
3
+ description: "Typed, filterable product attributes on top of Medusa's native product options — including variant axes shared across the catalog."
4
+ ---
5
+
6
+ Product attributes extend the master catalog with structured, typed data — "Material: Cotton", "Weight: 10kg", "Waterproof: yes". The operator defines the attribute catalog; products reference it. Attributes power filtering, enforce consistent values across sellers, and — for select attributes — can drive variant generation.
7
+
8
+ ## Attribute types
9
+
10
+ | Type | Values | Example |
11
+ |------|--------|---------|
12
+ | `multi_select` | Multiple values from a defined list | Color: Red, Blue, Green |
13
+ | `single_select` | One value from a defined list | Condition: New |
14
+ | `text` | Free text | Care instructions |
15
+ | `unit` | A measured value | Weight: 10kg |
16
+ | `toggle` | Boolean — fixed `true` / `false` values | Waterproof |
17
+
18
+ ## Attribute fields
19
+
20
+ | Field | Description |
21
+ |-------|-------------|
22
+ | `name` / `handle` | Display name and unique handle |
23
+ | `type` | One of the types above |
24
+ | `is_variant_axis` | Whether the attribute generates product variants — only allowed for `multi_select` |
25
+ | `is_filterable` | Whether the attribute is exposed as a storefront filter |
26
+ | `is_required` | Whether products must set a value |
27
+ | `rank` | Ordering in listings and forms |
28
+ | `is_active` | Soft enable/disable |
29
+ | `product_id` | `null` for global attributes; set when the attribute is product-scoped |
30
+
31
+ Each select attribute owns a ranked list of **values** (`ProductAttributeValue`), managed by the operator in the Admin Panel.
32
+
33
+ ## Global vs product-scoped
34
+
35
+ - **Global attributes** (`product_id = null`) live in the marketplace-wide catalog. They can be attached to any product and linked to categories, so the right attributes surface for the right product types.
36
+ - **Product-scoped attributes** are created inline from a single product's form — a one-off axis or field that doesn't belong in the shared catalog. They don't appear in the global attribute list.
37
+
38
+ ## Variant axes and native product options
39
+
40
+ Attributes marked `is_variant_axis` are not a parallel system — **a variant-axis attribute is backed by a native Medusa global product option**. The attribute and its values mirror one-to-one onto a `ProductOption` and its option values:
41
+
42
+ - A **global** axis attribute maps to a shared product option that many products link to, each restricted to its selected subset of values.
43
+ - A **product-scoped** axis attribute maps to an exclusive, product-owned option.
44
+
45
+ Because axes are real product options, variants are built with Medusa's standard machinery — `variants[].options` maps axis titles to value names, exactly as in a plain Medusa project. Non-axis attributes never become options; they attach as plain value links.
46
+
47
+ Only `multi_select` attributes can be variant axes — an axis needs an enumerable set of values to combine into variants.
48
+
49
+ ## Attaching attributes to products
50
+
51
+ Products manage their attributes through a single **batch** endpoint that adds, removes, and updates in one request:
52
+
53
+ ```bash
54
+ curl -X POST "http://localhost:9000/vendor/products/prod_123/attributes/batch" \
55
+ -H "Authorization: Bearer <token>" \
56
+ -H "Content-Type: application/json" \
57
+ -d '{
58
+ "add": [
59
+ { "id": "pattr_material", "value_ids": ["pattrval_cotton"] },
60
+ { "title": "Fit", "values": ["Slim", "Regular"], "is_variant_axis": true }
61
+ ],
62
+ "remove": ["pattr_old"]
63
+ }'
64
+ ```
65
+
66
+ An entry either references an **existing** attribute by `id` (with the selected `value_ids`, or a `value` for text/unit/toggle types) or defines an **inline** one by `title` — created product-scoped on the fly.
67
+
68
+ At product create time, the same shape is passed as a unified `attributes[]` array.
69
+
70
+ ## Who manages what
71
+
72
+ | Surface | Capability |
73
+ |---------|-----------|
74
+ | Admin Panel | Owns the attribute catalog — create attributes, manage possible values, set ranking, edit flags |
75
+ | Vendor Portal | Consumes attributes on products — select values, propose inline attributes as part of product submissions |
76
+ | Store API | Reads attributes for display and filtering |
77
+
78
+ Attribute changes on products submitted by vendors flow through the same [change-request pipeline](/rc/learn/product-requests) as other product edits.
79
+
80
+ ## Next steps
81
+
82
+ <CardGroup cols={2}>
83
+ <Card title="Products" href="/rc/learn/products">
84
+ The master catalog attributes describe.
85
+ </Card>
86
+ <Card title="Product Requests & Approvals" href="/rc/learn/product-requests">
87
+ How attribute edits are reviewed.
88
+ </Card>
89
+ </CardGroup>
@@ -0,0 +1,99 @@
1
+ ---
2
+ title: "Blocks"
3
+ description: "Self-contained pieces of marketplace functionality that get copied into your project as source code."
4
+ ---
5
+
6
+ Blocks are the unit of distribution in Mercur. Each block is a self-contained feature — a reviews system, a wishlist, product import/export — that you install directly into your project. Unlike packages, blocks are copied as source code. You own every file and can modify anything.
7
+
8
+ ## Installing blocks
9
+
10
+ ```bash
11
+ bunx @mercurjs/cli@rc add reviews
12
+ bunx @mercurjs/cli@rc add wishlist product-import-export
13
+ ```
14
+
15
+ The CLI fetches the block from the [registry](/rc/learn/registry), resolves dependencies, transforms imports to match your project's path aliases, and copies the files into the right directories.
16
+
17
+ ## What's inside a block
18
+
19
+ A block can contain any combination of:
20
+
21
+ | Type | What it is | Example |
22
+ |------|-----------|---------|
23
+ | **Modules** | Data models and business logic | Review model, wishlist service |
24
+ | **Workflows** | Multi-step business processes | Create review, export products |
25
+ | **API Routes** | HTTP endpoints | `GET /store/reviews`, `POST /vendor/products/import` |
26
+ | **Links** | Relationships between modules | Product-review link, customer-wishlist link |
27
+ | **Vendor extensions** | Vendor portal pages and components | Reviews list page, import drawer |
28
+ | **Admin extensions** | Admin panel pages and components | Reviews moderation page |
29
+
30
+ For example, the `reviews` block includes a module (data model + service), workflows (create/update/delete), API routes (store, vendor, admin), links (product-review, seller-review), and UI pages for both the vendor portal and admin panel.
31
+
32
+ ## Block structure
33
+
34
+ Blocks follow a consistent directory convention:
35
+
36
+ ```
37
+ reviews/
38
+ ├── modules/reviews/ # Data model, service, types
39
+ ├── workflows/review/ # Steps and workflow definitions
40
+ ├── links/ # product-review, seller-review, etc.
41
+ ├── api/
42
+ │ ├── admin/reviews/ # Admin API routes
43
+ │ ├── vendor/reviews/ # Vendor API routes
44
+ │ └── store/reviews/ # Store API routes
45
+ ├── vendor/pages/reviews/ # Vendor portal UI
46
+ └── admin/pages/reviews/ # Admin panel UI
47
+ ```
48
+
49
+ Files are placed into your project based on the aliases in your `blocks.json`:
50
+
51
+ ```json blocks.json
52
+ {
53
+ "aliases": {
54
+ "api": "packages/api/src",
55
+ "vendor": "apps/vendor/src",
56
+ "admin": "apps/admin/src"
57
+ }
58
+ }
59
+ ```
60
+
61
+ ## Post-installation
62
+
63
+ After adding a block, the CLI shows setup instructions. Typically you need to:
64
+
65
+ 1. **Register the module** in `medusa-config.ts`
66
+ 2. **Add middlewares** to your `api/middlewares.ts`
67
+ 3. **Run migrations** with `bunx medusa db:generate` and `bunx medusa db:migrate`
68
+ 4. **Regenerate types** with `bunx @mercurjs/cli@rc codegen`
69
+
70
+ ## Updating blocks
71
+
72
+ Check for changes against the registry:
73
+
74
+ ```bash
75
+ bunx @mercurjs/cli@rc diff reviews
76
+ ```
77
+
78
+ If there are updates you want, re-install with the overwrite flag:
79
+
80
+ ```bash
81
+ bunx @mercurjs/cli@rc add reviews --overwrite
82
+ ```
83
+
84
+ Since blocks are source code in your project, you control when and how updates are applied.
85
+
86
+ ## Available blocks
87
+
88
+ Search the registry to see what's available:
89
+
90
+ ```bash
91
+ bunx @mercurjs/cli@rc search
92
+ bunx @mercurjs/cli@rc search --query wishlist
93
+ ```
94
+
95
+ View details about a specific block:
96
+
97
+ ```bash
98
+ bunx @mercurjs/cli@rc view reviews
99
+ ```