Modules, Order Lifecycle Events and Routing Proxy (proxy.ts)
In addition to standard e-commerce features, this source code includes custom modules for reviews, Q&A, wishlists, shipping, order lifecycle event listeners, and the Next.js 16 request proxy layer (proxy.ts).
1. Product Reviews Module
This module is implemented in the store-admin/src/modules/product-review/ path and allows submitting ratings (1 to 5 stars), reviews, and reactions (Like/Dislike).
const res = await fetch("/api/store/reviews", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ product_id: "prod_123", rating: 5, title: "Great Quality", comment: "The fabric is amazing and stitching is neat.", }),});2. Product Questions & Answers Module
The product-question module allows users to ask questions about the product before purchasing. Answers are submitted by the admin from the panel or by other users.
3. Wishlist System Module
The wishlist module allows logged-in customers to save their favorite products and manage them in their personal profile.
5. 2-Way Product Sync with Strapi
Using Medusa Workflows (like create-product-in-strapi and update-product-in-strapi), any changes to Medusa products are synced to the Strapi database and vice versa via Webhook, keeping both databases in sync.
6. Subscribers & Order Lifecycle
Listeners for all order stages are embedded in the store-admin/src/subscribers/ folder:
order-placed.ts: Send SMS and order confirmation email to the buyer immediately after payment.order-shipment-created.ts: Send postal tracking code to the customer's mobile number.return-requested.tsandreturn-received.ts: Manage returns.order-canceled.tsandrefund-created.ts: Order cancellation and refund.
7. Request Proxy Layer and Auto Region Mapping (`proxy.ts`)
In **Next.js 16**, the legacy middleware pattern has been modernized to use store/src/proxy.ts with the exported proxy(request) handler. This proxy intercepts incoming traffic, extracts the user's country code from the URL path or IP header, resolves the corresponding Medusa Region and currency, and automatically manages session and cache cookies.