# mercurjs/mercur architecture

> Architecture diagram of the GitHub repository mercurjs/mercur, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mercurjs/mercur
- Repository: https://github.com/mercurjs/mercur

## Overview

Mercur is a headless multi-vendor marketplace platform built on Medusa. Its customer workflow spans marketplace browsing and offer discovery, cart and checkout, then order and post-purchase actions; operators and sellers manage marketplace entities through dashboards and APIs. The graph also preserves messaging, wishlists, search, and payment integrations documented by the README. Source evidence is sampled unevenly: product creation and messaging calls are visible, while several dashboard, storefront, search, and payout links are documented capabilities rather than inspected runtime wiring.

Main entry points: [`apps/storefront/src/app`](https://github.com/mercurjs/mercur/tree/main/apps/storefront/src/app) (Storefront), [`packages/registry/src/messaging/api/store/messages/route.ts`](https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/api/store/messages/route.ts) (Messaging API), [`packages/core/src/api/admin/products/route.ts`](https://github.com/mercurjs/mercur/blob/main/packages/core/src/api/admin/products/route.ts) (Admin products API), [`packages/admin/src/app.tsx`](https://github.com/mercurjs/mercur/blob/main/packages/admin/src/app.tsx) (Admin dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Marketplace experience"]
  node_storefront["Storefront"]
  node_cart["Cart and checkout"]
  node_orders["Orders and returns"]
end

subgraph group_engine["Marketplace engine"]
  node_catalog["Catalog and offers<br/>[route.ts]"]
  node_coreapi["Marketplace APIs"]
  node_productroute["Admin products API<br/>[route.ts]"]
  node_productflow["Product workflows<br/>[create-products.ts]"]
  node_attributes["Product attributes<br/>[route.ts]"]
  node_medusa["Medusa commerce core"]
  node_database[("PostgreSQL and Redis")]
end

subgraph group_operations["Operations and seller tools"]
  node_admin["Admin dashboard<br/>[app.tsx]"]
  node_seller["Seller dashboard<br/>[get-route-map.tsx]"]
end

subgraph group_extensions["Marketplace extensions"]
  node_search["Product search<br/>[route.ts]"]
  node_messagingapi["Messaging API<br/>[route.ts]"]
  node_messaging["Messaging service<br/>[service.ts]"]
  node_conversations["Conversation workflows"]
  node_messages["Message workflow<br/>[send-message.ts]"]
  node_wishlist["Wishlist API<br/>[route.ts]"]
  node_payments["Stripe Connect payouts<br/>[route.ts]"]
end

node_customer(("Customer"))
node_selleractor(("Seller"))
node_operator(("Marketplace operator"))

node_customer -->|"browses and buys"| node_storefront
node_storefront -.->|"requests catalog"| node_catalog
node_storefront -.->|"searches products"| node_search
node_storefront -.->|"builds cart"| node_cart
node_cart -.->|"completes checkout"| node_orders
node_storefront -.->|"manages wishlist"| node_wishlist
node_storefront -.->|"starts conversations"| node_messagingapi
node_selleractor -->|"manages listings"| node_seller
node_operator -->|"manages marketplace"| node_admin
node_admin -.->|"creates products"| node_productroute
node_productroute -->|"runs workflow"| node_productflow
node_productroute -->|"lists products"| node_catalog
node_admin -.->|"manages attributes"| node_attributes
node_coreapi -->|"extends commerce"| node_medusa
node_medusa -->|"persists marketplace data"| node_database
node_messagingapi -->|"queries conversations"| node_messaging
node_messagingapi -->|"creates conversation"| node_conversations
node_messagingapi -->|"sends message"| node_messages
node_messaging -->|"reads and writes"| node_database
node_payments -.->|"integrates payments"| node_medusa
node_medusa -.->|"routes payouts"| node_payments

click node_storefront "https://github.com/mercurjs/mercur/tree/main/apps/storefront/src/app"
click node_catalog "https://github.com/mercurjs/mercur/blob/main/packages/core/src/api/store/products/route.ts"
click node_search "https://github.com/mercurjs/mercur/blob/main/packages/registry/src/algolia/api/store/products/search/route.ts"
click node_cart "https://github.com/mercurjs/mercur/tree/main/apps/storefront/src/components/sections/Cart"
click node_orders "https://github.com/mercurjs/mercur/blob/main/apps/storefront/src/components/sections/OrderDetailsSection/OrderDetailsSection.tsx"
click node_coreapi "https://github.com/mercurjs/mercur/tree/main/packages/core/src/api"
click node_productroute "https://github.com/mercurjs/mercur/blob/main/packages/core/src/api/admin/products/route.ts"
click node_productflow "https://github.com/mercurjs/mercur/blob/main/packages/core/src/workflows/product/workflows/create-products.ts"
click node_attributes "https://github.com/mercurjs/mercur/blob/main/packages/core/src/api/admin/product-attributes/route.ts"
click node_admin "https://github.com/mercurjs/mercur/blob/main/packages/admin/src/app.tsx"
click node_seller "https://github.com/mercurjs/mercur/blob/main/packages/admin/src/get-route-map.tsx"
click node_messagingapi "https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/api/store/messages/route.ts"
click node_messaging "https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/modules/messaging/service.ts"
click node_conversations "https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/workflows/messaging/workflows/create-conversation.ts"
click node_messages "https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/workflows/messaging/workflows/send-message.ts"
click node_wishlist "https://github.com/mercurjs/mercur/blob/main/packages/registry/src/wishlist/api/store/wishlist/route.ts"
click node_payments "https://github.com/mercurjs/mercur/blob/main/packages/plugins/stripe-connector/src/api/admin/stripe/settlements/route.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_storefront,node_cart,node_orders toneBlue
class node_catalog,node_coreapi,node_productroute,node_productflow,node_attributes,node_medusa,node_database toneAmber
class node_admin,node_seller toneMint
class node_search,node_messagingapi,node_messaging,node_conversations,node_messages,node_wishlist,node_payments toneRose
class node_customer,node_selleractor,node_operator toneIndigo
```

## Components

### Marketplace experience

- [Storefront](https://github.com/mercurjs/mercur/tree/main/apps/storefront/src/app): `apps/storefront/src/app`
- [Cart and checkout](https://github.com/mercurjs/mercur/tree/main/apps/storefront/src/components/sections/Cart): `apps/storefront/src/components/sections/Cart`
- [Orders and returns](https://github.com/mercurjs/mercur/blob/main/apps/storefront/src/components/sections/OrderDetailsSection/OrderDetailsSection.tsx): `apps/storefront/src/components/sections/OrderDetailsSection/OrderDetailsSection.tsx`

### Marketplace engine

- [Catalog and offers](https://github.com/mercurjs/mercur/blob/main/packages/core/src/api/store/products/route.ts): `packages/core/src/api/store/products/route.ts`
- [Marketplace APIs](https://github.com/mercurjs/mercur/tree/main/packages/core/src/api): `packages/core/src/api`
- [Admin products API](https://github.com/mercurjs/mercur/blob/main/packages/core/src/api/admin/products/route.ts): `packages/core/src/api/admin/products/route.ts`
- [Product workflows](https://github.com/mercurjs/mercur/blob/main/packages/core/src/workflows/product/workflows/create-products.ts): `packages/core/src/workflows/product/workflows/create-products.ts`
- [Product attributes](https://github.com/mercurjs/mercur/blob/main/packages/core/src/api/admin/product-attributes/route.ts): `packages/core/src/api/admin/product-attributes/route.ts`
- **Medusa commerce core**
- **PostgreSQL and Redis**

### Operations and seller tools

- [Admin dashboard](https://github.com/mercurjs/mercur/blob/main/packages/admin/src/app.tsx): `packages/admin/src/app.tsx`
- [Seller dashboard](https://github.com/mercurjs/mercur/blob/main/packages/admin/src/get-route-map.tsx): `packages/admin/src/get-route-map.tsx`

### Marketplace extensions

- [Product search](https://github.com/mercurjs/mercur/blob/main/packages/registry/src/algolia/api/store/products/search/route.ts): `packages/registry/src/algolia/api/store/products/search/route.ts`
- [Messaging API](https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/api/store/messages/route.ts): `packages/registry/src/messaging/api/store/messages/route.ts`
- [Messaging service](https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/modules/messaging/service.ts): `packages/registry/src/messaging/modules/messaging/service.ts`
- [Conversation workflows](https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/workflows/messaging/workflows/create-conversation.ts): `packages/registry/src/messaging/workflows/messaging/workflows/create-conversation.ts`
- [Message workflow](https://github.com/mercurjs/mercur/blob/main/packages/registry/src/messaging/workflows/messaging/workflows/send-message.ts): `packages/registry/src/messaging/workflows/messaging/workflows/send-message.ts`
- [Wishlist API](https://github.com/mercurjs/mercur/blob/main/packages/registry/src/wishlist/api/store/wishlist/route.ts): `packages/registry/src/wishlist/api/store/wishlist/route.ts`
- [Stripe Connect payouts](https://github.com/mercurjs/mercur/blob/main/packages/plugins/stripe-connector/src/api/admin/stripe/settlements/route.ts): `packages/plugins/stripe-connector/src/api/admin/stripe/settlements/route.ts`

### Other components

- **Customer**
- **Seller**
- **Marketplace operator**

## Connections

- Customer → Storefront: browses and buys (evidence: `README.md`)
- Storefront → Catalog and offers: requests catalog
- Storefront → Product search: searches products
- Storefront → Cart and checkout: builds cart
- Cart and checkout → Orders and returns: completes checkout
- Storefront → Wishlist API: manages wishlist
- Storefront → Messaging API: starts conversations
- Seller → Seller dashboard: manages listings (evidence: `README.md`)
- Marketplace operator → Admin dashboard: manages marketplace (evidence: `README.md`)
- Admin dashboard → Admin products API: creates products
- Admin products API → Product workflows: runs workflow (evidence: `packages/core/src/api/admin/products/route.ts`)
- Admin products API → Catalog and offers: lists products (evidence: `packages/core/src/api/admin/products/route.ts`)
- Admin dashboard → Product attributes: manages attributes
- Marketplace APIs → Medusa commerce core: extends commerce (evidence: `README.md`)
- Medusa commerce core → PostgreSQL and Redis: persists marketplace data (evidence: `README.md`)
- Messaging API → Messaging service: queries conversations (evidence: `packages/registry/src/messaging/api/store/messages/route.ts`)
- Messaging API → Conversation workflows: creates conversation (evidence: `packages/registry/src/messaging/api/store/messages/route.ts`)
- Messaging API → Message workflow: sends message (evidence: `packages/registry/src/messaging/api/store/messages/route.ts`)
- Messaging service → PostgreSQL and Redis: reads and writes (evidence: `packages/registry/src/messaging/modules/messaging/service.ts`)
- Stripe Connect payouts → Medusa commerce core: integrates payments
- Medusa commerce core → Stripe Connect payouts: routes payouts
