@mercurjs/docs 2.2.0 → 2.2.1-canary.1
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.
- package/README.md +2 -1
- package/content/blocks.mdx +4 -4
- package/content/learn/architecture.mdx +1 -1
- package/content/learn/blocks.mdx +8 -8
- package/content/learn/concepts.mdx +2 -2
- package/content/learn/installation.mdx +4 -4
- package/content/learn/introduction.mdx +3 -3
- package/content/learn/mirakl-alternative.mdx +86 -0
- package/content/learn/registry.mdx +4 -4
- package/content/migration/from-1-x-to-2-0.mdx +1 -1
- package/content/resources/ai/overview.mdx +2 -2
- package/content/resources/integrations/search.mdx +2 -2
- package/content/resources/tutorials/add-a-block.mdx +6 -6
- package/content/resources/tutorials/build-a-block.mdx +4 -4
- package/content/resources/tutorials/custom-api-route.mdx +2 -2
- package/content/resources/tutorials/import-export-products.mdx +3 -3
- package/content/tools/api-client.mdx +2 -2
- package/content/tools/cli.mdx +17 -17
- package/llms.txt +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,5 +20,6 @@ Paths in `llms.txt` are relative to this package
|
|
|
20
20
|
|
|
21
21
|
## Build
|
|
22
22
|
|
|
23
|
-
`content/` and `llms.txt` are generated from `apps/docs
|
|
23
|
+
`content/` and `llms.txt` are generated from the root of `apps/docs`
|
|
24
|
+
(archived versions such as `apps/docs/v1` are excluded) by
|
|
24
25
|
`scripts/build.mjs` (run via `turbo run build`). They are not committed.
|
package/content/blocks.mdx
CHANGED
|
@@ -13,7 +13,7 @@ mode: "custom"
|
|
|
13
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
14
|
</p>
|
|
15
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@
|
|
16
|
+
<code className="text-sm font-mono text-gray-800 dark:text-gray-100">bunx @mercurjs/cli@latest add <block-name></code>
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
@@ -170,7 +170,7 @@ mode: "custom"
|
|
|
170
170
|
<h3 className="text-lg font-semibold mb-2">Install a block</h3>
|
|
171
171
|
|
|
172
172
|
```bash
|
|
173
|
-
bunx @mercurjs/cli@
|
|
173
|
+
bunx @mercurjs/cli@latest add reviews
|
|
174
174
|
```
|
|
175
175
|
|
|
176
176
|
This copies the block source code into your project:
|
|
@@ -195,13 +195,13 @@ src/
|
|
|
195
195
|
<h3 className="text-lg font-semibold mt-6 mb-2">Search blocks</h3>
|
|
196
196
|
|
|
197
197
|
```bash
|
|
198
|
-
bunx @mercurjs/cli@
|
|
198
|
+
bunx @mercurjs/cli@latest search -q "reviews"
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
<h3 className="text-lg font-semibold mt-6 mb-2">Compare local changes against registry</h3>
|
|
202
202
|
|
|
203
203
|
```bash
|
|
204
|
-
bunx @mercurjs/cli@
|
|
204
|
+
bunx @mercurjs/cli@latest diff reviews
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
</div>
|
|
@@ -163,7 +163,7 @@ This means:
|
|
|
163
163
|
- There are no hidden abstractions or version conflicts
|
|
164
164
|
- Updates are explicit — you diff and apply changes from the registry
|
|
165
165
|
|
|
166
|
-
The CLI (`@mercurjs/cli@
|
|
166
|
+
The CLI (`@mercurjs/cli@latest`) manages this process: scaffolding projects, installing blocks, searching the registry, and comparing local changes against upstream versions.
|
|
167
167
|
|
|
168
168
|
## Workflow example
|
|
169
169
|
|
package/content/learn/blocks.mdx
CHANGED
|
@@ -8,8 +8,8 @@ Blocks are the unit of distribution in Mercur. Each block is a self-contained fe
|
|
|
8
8
|
## Installing blocks
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
bunx @mercurjs/cli@
|
|
12
|
-
bunx @mercurjs/cli@
|
|
11
|
+
bunx @mercurjs/cli@latest add reviews
|
|
12
|
+
bunx @mercurjs/cli@latest add wishlist product-import-export
|
|
13
13
|
```
|
|
14
14
|
|
|
15
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.
|
|
@@ -65,20 +65,20 @@ After adding a block, the CLI shows setup instructions. Typically you need to:
|
|
|
65
65
|
1. **Register the module** in `medusa-config.ts`
|
|
66
66
|
2. **Add middlewares** to your `api/middlewares.ts`
|
|
67
67
|
3. **Run migrations** with `bunx medusa db:generate` and `bunx medusa db:migrate`
|
|
68
|
-
4. **Regenerate types** with `bunx @mercurjs/cli@
|
|
68
|
+
4. **Regenerate types** with `bunx @mercurjs/cli@latest codegen`
|
|
69
69
|
|
|
70
70
|
## Updating blocks
|
|
71
71
|
|
|
72
72
|
Check for changes against the registry:
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
bunx @mercurjs/cli@
|
|
75
|
+
bunx @mercurjs/cli@latest diff reviews
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
If there are updates you want, re-install with the overwrite flag:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
bunx @mercurjs/cli@
|
|
81
|
+
bunx @mercurjs/cli@latest add reviews --overwrite
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
Since blocks are source code in your project, you control when and how updates are applied.
|
|
@@ -88,12 +88,12 @@ Since blocks are source code in your project, you control when and how updates a
|
|
|
88
88
|
Search the registry to see what's available:
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
|
-
bunx @mercurjs/cli@
|
|
92
|
-
bunx @mercurjs/cli@
|
|
91
|
+
bunx @mercurjs/cli@latest search
|
|
92
|
+
bunx @mercurjs/cli@latest search --query wishlist
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
View details about a specific block:
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
|
-
bunx @mercurjs/cli@
|
|
98
|
+
bunx @mercurjs/cli@latest view reviews
|
|
99
99
|
```
|
|
@@ -73,7 +73,7 @@ A registry is a collection of blocks available for installation. The official Me
|
|
|
73
73
|
|
|
74
74
|
## CLI
|
|
75
75
|
|
|
76
|
-
The [Mercur CLI](/rc/tools/cli) (`@mercurjs/cli@
|
|
76
|
+
The [Mercur CLI](/rc/tools/cli) (`@mercurjs/cli@latest`) manages your project — scaffolding from templates, installing blocks, searching registries, generating types, and diffing local changes against upstream versions.
|
|
77
77
|
|
|
78
78
|
## Dashboard SDK
|
|
79
79
|
|
|
@@ -81,4 +81,4 @@ The [Dashboard SDK](/rc/tools/dashboard-sdk) (`@mercurjs/dashboard-sdk`) is a Vi
|
|
|
81
81
|
|
|
82
82
|
## API Client
|
|
83
83
|
|
|
84
|
-
The [API Client](/rc/tools/api-client) (`@mercurjs/client`) provides type-safe access to all Mercur API endpoints. Types are generated from your actual API routes using `bunx @mercurjs/cli@
|
|
84
|
+
The [API Client](/rc/tools/api-client) (`@mercurjs/client`) provides type-safe access to all Mercur API endpoints. Types are generated from your actual API routes using `bunx @mercurjs/cli@latest codegen`, so requests and responses are always in sync with your backend.
|
|
@@ -29,7 +29,7 @@ description: "Install Mercur and set up your marketplace project."
|
|
|
29
29
|
## Create a new project
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
bun create mercur-app@
|
|
32
|
+
bun create mercur-app@latest
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
The CLI will prompt for a project name and template, then handle everything automatically:
|
|
@@ -88,7 +88,7 @@ bun dev
|
|
|
88
88
|
If you have an existing Medusa project, initialize Mercur in it:
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
|
-
bunx @mercurjs/cli@
|
|
91
|
+
bunx @mercurjs/cli@latest init
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
This creates a `blocks.json` configuration file in your project.
|
|
@@ -98,13 +98,13 @@ This creates a `blocks.json` configuration file in your project.
|
|
|
98
98
|
Install blocks from the registry:
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
|
-
bunx @mercurjs/cli@
|
|
101
|
+
bunx @mercurjs/cli@latest add <block-name>
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
Browse available blocks:
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
bunx @mercurjs/cli@
|
|
107
|
+
bunx @mercurjs/cli@latest search
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
## Run database migrations
|
|
@@ -41,11 +41,11 @@ Most AI coding tools generate loose snippets that you have to wire together your
|
|
|
41
41
|
|
|
42
42
|
Here's what that looks like in practice:
|
|
43
43
|
|
|
44
|
-
- **Adding features via CLI** — An AI agent can run `bunx @mercurjs/cli@
|
|
44
|
+
- **Adding features via CLI** — An AI agent can run `bunx @mercurjs/cli@latest add reviews` to install a complete review system — data models, API routes, workflows, and UI — in one command. No guessing at file structure or imports. The CLI handles wiring automatically.
|
|
45
45
|
- **Extending workflows without rebuilding them** — Need custom logic when an order is placed? AI can hook into the existing `complete-cart-with-split-orders` workflow and inject a step — without rewriting the entire cart flow. Medusa's workflow hooks make this safe and predictable.
|
|
46
|
-
- **Generating typed integrations** — AI reads the generated route types from `bunx @mercurjs/cli@
|
|
46
|
+
- **Generating typed integrations** — AI reads the generated route types from `bunx @mercurjs/cli@latest codegen` and produces API calls that are correct by construction. No hallucinated endpoints, no wrong payloads — the types are the source of truth.
|
|
47
47
|
- **Building UI pages** — AI can scaffold an admin or vendor page by creating a file in `src/routes/`. The dashboard SDK picks it up automatically through file-based routing. No manual route registration, no config files to update.
|
|
48
|
-
- **Modifying blocks it can diff** — AI can compare local code against the registry with `bunx @mercurjs/cli@
|
|
48
|
+
- **Modifying blocks it can diff** — AI can compare local code against the registry with `bunx @mercurjs/cli@latest diff`, understand what changed, and make targeted modifications instead of blind overwrites.
|
|
49
49
|
|
|
50
50
|
### Connect your AI tools
|
|
51
51
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Mercur - an open-source Mirakl alternative"
|
|
3
|
+
description: "How Mercur compares to Mirakl and other marketplace platforms: open-source, self-hosted, no GMV fees, full code ownership."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
If you're evaluating [Mirakl](https://www.mirakl.com/) - or any hosted, enterprise marketplace SaaS - Mercur is the open-source alternative built for teams that want to own their marketplace outright instead of renting it.
|
|
7
|
+
|
|
8
|
+
Mirakl is a mature, capable platform. It's also closed-source, priced as a percentage of the GMV that flows through it, and delivered as a hosted service you don't control. Mercur takes the opposite position: MIT-licensed core, self-hosted on your own infrastructure, no per-transaction cut, and full access to every line of code.
|
|
9
|
+
|
|
10
|
+
This page is an honest comparison. Mirakl is the right choice for some teams; Mercur is the right choice for others. The goal here is to help you tell which one you are.
|
|
11
|
+
|
|
12
|
+
## At a glance
|
|
13
|
+
|
|
14
|
+
| | **Mercur** | **Mirakl** |
|
|
15
|
+
| ----------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------- |
|
|
16
|
+
| **License** | Open source (MIT core) | Proprietary / closed source |
|
|
17
|
+
| **Hosting** | Self-host anywhere, or fully managed (Medusa Cloud / Rigby-hosted) | Vendor-hosted SaaS only |
|
|
18
|
+
| **Pricing model** | No GMV fees, no per-transaction cut | Percentage of GMV + platform fees |
|
|
19
|
+
| **Code ownership** | Full source access; fork or modify freely | No source access |
|
|
20
|
+
| **Customization** | Extend/override workflows, APIs, and UI without forking | Configuration within platform limits |
|
|
21
|
+
| **Data ownership** | Your database, your infrastructure | Vendor-controlled |
|
|
22
|
+
| **Tech stack** | TypeScript, Node.js, React, PostgreSQL | Proprietary |
|
|
23
|
+
| **Extensibility** | Composable blocks, typed API client, workflow hooks, Dashboard SDK | Connectors and APIs within the platform |
|
|
24
|
+
| **Storefront** | Bring your own (headless, API-first) | Integrated / connector-based |
|
|
25
|
+
| **Enterprise features** | Mercur Enterprise: Buy Box, dedup, master-data governance, KYC - on your own infra | Included in the platform |
|
|
26
|
+
| **Support & SLAs** | Contractual SLAs and named contact via Mercur Enterprise | Vendor support contract |
|
|
27
|
+
| **Delivery help** | Rigby builds/launches marketplaces with you | Sales-led onboarding |
|
|
28
|
+
| **Time to first marketplace** | `bun create mercur-app` in minutes | Sales-led onboarding |
|
|
29
|
+
|
|
30
|
+
## Where Mercur is the better fit
|
|
31
|
+
|
|
32
|
+
- **You want to own your marketplace, not rent it.** No percentage of GMV, no per-transaction cut, no vendor lock-in. Your data, customers, and roadmap stay yours.
|
|
33
|
+
- **You have (or want) an engineering team.** Mercur is code you control end-to-end. If you plan to customize deeply - bespoke commission logic, custom vendor onboarding, non-standard order flows - an open, hackable core is a decisive advantage over a configuration-bound SaaS.
|
|
34
|
+
- **You need to control where data lives.** Self-host on your own cloud, on-prem, or inside an air-gapped network. There's no proprietary runtime to adopt and no hosting tier you're forced onto.
|
|
35
|
+
- **You want to avoid platform risk.** MIT license means the core can never be taken away from you, re-priced out from under you, or discontinued.
|
|
36
|
+
|
|
37
|
+
## Enterprise-grade, without giving up ownership
|
|
38
|
+
|
|
39
|
+
The features that usually pull teams toward Mirakl - a winning-offer engine, product deduplication, master-data governance, multi-channel stock sync, vendor KYC - aren't a reason to accept closed source and GMV fees. **[Mercur Enterprise](https://www.mercurjs.com/enterprise)** delivers that same enterprise surface area as a licensed module suite you deploy and run on your own infrastructure, exactly like the open-source core:
|
|
40
|
+
|
|
41
|
+
- **Buy Box / winning-offer engine** - pick the winning offer across competing sellers, the way large marketplaces do.
|
|
42
|
+
- **EAN matching & deduplication** - collapse duplicate seller submissions into a single master product.
|
|
43
|
+
- **Master-data governance** - controlled, auditable catalog data across thousands of vendors.
|
|
44
|
+
- **Multi-channel stock sync** - keep inventory consistent across sales channels and feeds.
|
|
45
|
+
- **Automated split payouts & vendor KYC** - compliant onboarding and settlement at scale.
|
|
46
|
+
|
|
47
|
+
…and more, with new modules added over time.
|
|
48
|
+
|
|
49
|
+
Everything is maintained, tested, and upgraded by the core team, and backed by a direct support relationship: a dedicated support channel, contractual SLAs with guaranteed response times, prioritized bug fixes and security patches, and hands-on onboarding and architecture guidance. Higher tiers add priority escalation and a named technical contact.
|
|
50
|
+
|
|
51
|
+
The difference from Mirakl: you still own the code, host it yourself, and pay no percentage of GMV.
|
|
52
|
+
|
|
53
|
+
## Don't want to build it yourself? We'll build it with you
|
|
54
|
+
|
|
55
|
+
Mercur is built and maintained by [Rigby](https://rigbyjs.com), a team that has designed, built, and launched multi-vendor marketplaces in production. If you'd rather not staff the whole project, we work alongside your team - architecture reviews, integrating Mercur with your existing stack, hardening, scaling, and getting your marketplace live on schedule.
|
|
56
|
+
|
|
57
|
+
This closes the usual "we don't have engineering capacity" gap that sends teams to a fully managed SaaS: you get a done-with-you (or done-for-you) delivery path _and_ keep an open-source core you own. [Talk to our team](https://www.mercurjs.com/contact).
|
|
58
|
+
|
|
59
|
+
### Don't want to run the infrastructure either?
|
|
60
|
+
|
|
61
|
+
You don't have to. Not wanting to manage servers is not a reason to accept closed source and GMV fees - Mercur runs as a fully managed deployment too. Ship it to [Medusa Cloud](https://medusajs.com/pricing/) with push-to-deploy and auto-scaling, or have Rigby deploy, host, and operate it for you. Either way you get the zero-ops experience of a SaaS while keeping the open-source core, your data, and no percentage of GMV.
|
|
62
|
+
|
|
63
|
+
## Migrating from Mirakl
|
|
64
|
+
|
|
65
|
+
Already live on Mirakl? Rigby helps you move - porting your catalog, sellers, offers, orders, and commission structure onto Mercur, then hardening and cutting over without disrupting your marketplace. [Talk to our team](https://www.mercurjs.com/contact) to scope a migration.
|
|
66
|
+
|
|
67
|
+
## What Mercur gives you
|
|
68
|
+
|
|
69
|
+
Built on the [Medusa](https://medusajs.com) commerce framework, Mercur adds the marketplace layer on top:
|
|
70
|
+
|
|
71
|
+
- **Multi-vendor sellers** - onboarding, approval, suspension, and member management.
|
|
72
|
+
- **Master products & offers** - a shared catalog where multiple sellers list offers (SKU, price, inventory, shipping) against the same product.
|
|
73
|
+
- **Commissions** - configurable fixed or percentage rules matching across product, type, collection, category, and seller.
|
|
74
|
+
- **Automated vendor payouts** - a pluggable payout pipeline with Stripe Connect out of the box.
|
|
75
|
+
- **Order splitting** - a single customer cart spanning multiple sellers splits into per-seller orders under an order group.
|
|
76
|
+
- **Admin and Vendor panels** - role-specific dashboards, plus a headless Store API for any storefront.
|
|
77
|
+
|
|
78
|
+
See [Concepts](/rc/learn/concepts) and [Architecture](/rc/learn/architecture) for the full picture, or jump straight to [Installation](/rc/learn/installation) to spin up a marketplace locally.
|
|
79
|
+
|
|
80
|
+
## Get started
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
bun create mercur-app@latest my-marketplace
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Then head to the [Installation guide](/rc/learn/installation) to run it locally, or [talk to our team](https://www.mercurjs.com/contact) if you're migrating from an existing platform.
|
|
@@ -7,7 +7,7 @@ A registry is a collection of blocks that can be installed into any Mercur proje
|
|
|
7
7
|
|
|
8
8
|
## How it works
|
|
9
9
|
|
|
10
|
-
A registry is a set of JSON files — one per block — served over HTTP. When you run `bunx @mercurjs/cli@
|
|
10
|
+
A registry is a set of JSON files — one per block — served over HTTP. When you run `bunx @mercurjs/cli@latest add`, the CLI fetches the block's JSON, resolves its dependencies, and copies the source files into your project.
|
|
11
11
|
|
|
12
12
|
```
|
|
13
13
|
registry/
|
|
@@ -62,7 +62,7 @@ The `registry.json` file defines your registry and all its blocks:
|
|
|
62
62
|
|
|
63
63
|
| Property | Description |
|
|
64
64
|
| ---------------------- | -------------------------------------------------------------- |
|
|
65
|
-
| `name` | Block identifier used in `bunx @mercurjs/cli@
|
|
65
|
+
| `name` | Block identifier used in `bunx @mercurjs/cli@latest add` |
|
|
66
66
|
| `description` | Short description shown in search results |
|
|
67
67
|
| `dependencies` | NPM packages to install |
|
|
68
68
|
| `registryDependencies` | Other blocks this block depends on (e.g. `@mercurjs/wishlist`) |
|
|
@@ -91,7 +91,7 @@ These map to the aliases defined in the consumer's `blocks.json`.
|
|
|
91
91
|
Build your registry into distributable JSON files:
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
bunx @mercurjs/cli@
|
|
94
|
+
bunx @mercurjs/cli@latest build
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
This reads `registry.json`, resolves all imports for each block, embeds the file contents, and outputs one JSON file per block to the `r/` directory.
|
|
@@ -122,7 +122,7 @@ Add your registry to `blocks.json` in any Mercur project:
|
|
|
122
122
|
Use `{name}` as a placeholder for block names. Then install blocks from it:
|
|
123
123
|
|
|
124
124
|
```bash
|
|
125
|
-
bunx @mercurjs/cli@
|
|
125
|
+
bunx @mercurjs/cli@latest add @my-org/reviews
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
### Authentication
|
|
@@ -30,7 +30,7 @@ Because the docs travel with the package, an agent always has documentation that
|
|
|
30
30
|
|
|
31
31
|
### New projects
|
|
32
32
|
|
|
33
|
-
Projects created with `bunx @mercurjs/cli@
|
|
33
|
+
Projects created with `bunx @mercurjs/cli@latest create` are ready out of the box. The template ships:
|
|
34
34
|
|
|
35
35
|
- `@mercurjs/docs` as a dependency, so the docs land in `node_modules` on install
|
|
36
36
|
- an `AGENTS.md` and a `CLAUDE.md` at the project root that tell agents to read the bundled docs first
|
|
@@ -79,7 +79,7 @@ Mercur gives an agent a fast, machine-checkable way to know whether a change is
|
|
|
79
79
|
| `bun run build` | Types resolve and the generated client matches the routes |
|
|
80
80
|
| `bun run lint` | Code conforms to the project's rules |
|
|
81
81
|
| Integration tests (`packages/api`) | Backend behavior still holds |
|
|
82
|
-
| `bunx @mercurjs/cli@
|
|
82
|
+
| `bunx @mercurjs/cli@latest diff` | Local blocks vs. the registry — what changed and what drifted |
|
|
83
83
|
|
|
84
84
|
Because these are objective, an agent can define what "done" looks like, run the checks, read the output, and iterate until they pass — instead of stopping at "looks plausible."
|
|
85
85
|
|
|
@@ -58,9 +58,9 @@ The bundled `search-orama` provider keeps the index in RAM inside the API proces
|
|
|
58
58
|
Ready-made provider integrations ship as blocks:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
bunx @mercurjs/cli@
|
|
61
|
+
bunx @mercurjs/cli@latest add algolia
|
|
62
62
|
# or
|
|
63
|
-
bunx @mercurjs/cli@
|
|
63
|
+
bunx @mercurjs/cli@latest add meilisearch
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
| Provider | Hosting | Best for |
|
|
@@ -20,15 +20,15 @@ Install reviews as a block and see it running everywhere it appears.
|
|
|
20
20
|
Search the registry and inspect what the block ships before installing:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
bunx @mercurjs/cli@
|
|
24
|
-
bunx @mercurjs/cli@
|
|
23
|
+
bunx @mercurjs/cli@latest search --query reviews
|
|
24
|
+
bunx @mercurjs/cli@latest view reviews
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
`view` lists the block's files by target (API, admin, vendor) and its dependencies.
|
|
28
28
|
</Step>
|
|
29
29
|
<Step title="Install it">
|
|
30
30
|
```bash
|
|
31
|
-
bunx @mercurjs/cli@
|
|
31
|
+
bunx @mercurjs/cli@latest add reviews
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
The CLI copies the source into the directories mapped by your `blocks.json` aliases and prints the block's post-install instructions — module registration, middlewares, migrations.
|
|
@@ -40,7 +40,7 @@ Install reviews as a block and see it running everywhere it appears.
|
|
|
40
40
|
cd packages/api
|
|
41
41
|
bunx medusa db:generate reviews
|
|
42
42
|
bunx medusa db:migrate
|
|
43
|
-
bunx @mercurjs/cli@
|
|
43
|
+
bunx @mercurjs/cli@latest codegen
|
|
44
44
|
```
|
|
45
45
|
</Step>
|
|
46
46
|
<Step title="See it live">
|
|
@@ -53,7 +53,7 @@ Install reviews as a block and see it running everywhere it appears.
|
|
|
53
53
|
1. The block's files exist in your repo under the alias-mapped paths.
|
|
54
54
|
2. Migrations ran cleanly and the API boots.
|
|
55
55
|
3. The admin and vendor panels show their reviews pages; the store review endpoints respond.
|
|
56
|
-
4. `bunx @mercurjs/cli@
|
|
56
|
+
4. `bunx @mercurjs/cli@latest diff reviews` reports no drift from the registry.
|
|
57
57
|
|
|
58
58
|
## FAQ
|
|
59
59
|
|
|
@@ -62,7 +62,7 @@ Install reviews as a block and see it running everywhere it appears.
|
|
|
62
62
|
The CLI asks before overwriting existing files (or force it with `--overwrite`). If you've customized a page the block also ships, merge by hand — you're merging source, not resolving package versions.
|
|
63
63
|
</Accordion>
|
|
64
64
|
<Accordion title="How do I update a block later?">
|
|
65
|
-
`bunx @mercurjs/cli@
|
|
65
|
+
`bunx @mercurjs/cli@latest diff reviews` shows what changed in the registry since you installed. Take updates with `add reviews --overwrite`, re-applying any local edits afterwards.
|
|
66
66
|
</Accordion>
|
|
67
67
|
</AccordionGroup>
|
|
68
68
|
|
|
@@ -58,7 +58,7 @@ Each file in a block carries a `type` that maps to an alias in the consumer's `b
|
|
|
58
58
|
"description": "Marketplace announcements with a vendor portal feed.",
|
|
59
59
|
"dependencies": [],
|
|
60
60
|
"registryDependencies": [],
|
|
61
|
-
"docs": "## Setup\n\nRegister the module in `medusa-config.ts`, then run `bunx medusa db:generate announcements && bunx medusa db:migrate`, and finally `bunx @mercurjs/cli@
|
|
61
|
+
"docs": "## Setup\n\nRegister the module in `medusa-config.ts`, then run `bunx medusa db:generate announcements && bunx medusa db:migrate`, and finally `bunx @mercurjs/cli@latest codegen`.",
|
|
62
62
|
"categories": ["module", "api", "vendor"],
|
|
63
63
|
"files": [
|
|
64
64
|
{ "path": "announcements/modules/announcements/index.ts", "type": "registry:module" },
|
|
@@ -74,7 +74,7 @@ Each file in a block carries a `type` that maps to an alias in the consumer's `b
|
|
|
74
74
|
</Step>
|
|
75
75
|
<Step title="Build the registry">
|
|
76
76
|
```bash
|
|
77
|
-
bunx @mercurjs/cli@
|
|
77
|
+
bunx @mercurjs/cli@latest build
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
This reads `registry.json`, resolves each block's imports, embeds file contents, and writes one JSON per block into `r/` — `r/announcements.json`, plus an index `r/registry.json`.
|
|
@@ -94,7 +94,7 @@ Each file in a block carries a `type` that maps to an alias in the consumer's `b
|
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
-
bunx @mercurjs/cli@
|
|
97
|
+
bunx @mercurjs/cli@latest add @my-org/announcements
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
The CLI fetches the JSON, maps each file's `type` to the consumer's aliases, rewrites imports, and prints your `docs` instructions.
|
|
@@ -106,7 +106,7 @@ Each file in a block carries a `type` that maps to an alias in the consumer's `b
|
|
|
106
106
|
1. `r/announcements.json` exists after the build and embeds every file's content.
|
|
107
107
|
2. In the consumer project, the files landed under the alias-mapped paths and imports resolve.
|
|
108
108
|
3. After following your own `docs` steps (module registration, migrations, codegen), `bun run build` passes and the vendor portal shows the Announcements page.
|
|
109
|
-
4. `bunx @mercurjs/cli@
|
|
109
|
+
4. `bunx @mercurjs/cli@latest diff @my-org/announcements` reports no changes — the installed copy matches the registry.
|
|
110
110
|
|
|
111
111
|
## FAQ
|
|
112
112
|
|
|
@@ -43,7 +43,7 @@ A `GET /vendor/sales-summary` endpoint returning the seller's order count, calle
|
|
|
43
43
|
</Step>
|
|
44
44
|
<Step title="Regenerate the route map">
|
|
45
45
|
```bash
|
|
46
|
-
bunx @mercurjs/cli@
|
|
46
|
+
bunx @mercurjs/cli@latest codegen
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Codegen scans your route files and rewrites the generated `Routes` type that your panel apps already import:
|
|
@@ -63,7 +63,7 @@ A `GET /vendor/sales-summary` endpoint returning the seller's order count, calle
|
|
|
63
63
|
This file ships with the starter template — you don't need to touch it. After codegen, `client.vendor.salesSummary` simply exists, typed.
|
|
64
64
|
|
|
65
65
|
<Tip>
|
|
66
|
-
Run `bunx @mercurjs/cli@
|
|
66
|
+
Run `bunx @mercurjs/cli@latest codegen --watch` during development so the route map regenerates as you edit route files.
|
|
67
67
|
</Tip>
|
|
68
68
|
</Step>
|
|
69
69
|
<Step title="Call it from a panel page">
|
|
@@ -18,7 +18,7 @@ A vendor product list with **Import** and **Export** header buttons, a working C
|
|
|
18
18
|
<Steps>
|
|
19
19
|
<Step title="Install the block">
|
|
20
20
|
```bash
|
|
21
|
-
bunx @mercurjs/cli@
|
|
21
|
+
bunx @mercurjs/cli@latest add product-import-export
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
The CLI copies the block's files into the directories mapped by your `blocks.json` aliases — workflows and routes into the API package, pages and hooks into the vendor app.
|
|
@@ -47,7 +47,7 @@ A vendor product list with **Import** and **Export** header buttons, a working C
|
|
|
47
47
|
The block added `POST /vendor/products/import` and `GET /vendor/products/export`. Regenerate the route map so the vendor app's typed client knows about them:
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
bunx @mercurjs/cli@
|
|
50
|
+
bunx @mercurjs/cli@latest codegen
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
<Note>
|
|
@@ -68,7 +68,7 @@ A vendor product list with **Import** and **Export** header buttons, a working C
|
|
|
68
68
|
1. The Products header shows Import and Export buttons; the rest of the page (search, filters, pagination) behaves exactly as before.
|
|
69
69
|
2. The exported CSV contains the seller's products — and only theirs; the workflow scopes to the authenticated seller.
|
|
70
70
|
3. After importing the edited CSV, the changed title appears in the product list.
|
|
71
|
-
4. The block's source lives in your repo (e.g. `packages/api/src/workflows/import-seller-products.ts`, `apps/vendor/src/routes/products/page.tsx`) — run `bunx @mercurjs/cli@
|
|
71
|
+
4. The block's source lives in your repo (e.g. `packages/api/src/workflows/import-seller-products.ts`, `apps/vendor/src/routes/products/page.tsx`) — run `bunx @mercurjs/cli@latest diff product-import-export` to compare against the registry later.
|
|
72
72
|
|
|
73
73
|
## FAQ
|
|
74
74
|
|
|
@@ -23,7 +23,7 @@ export const client = createClient<Routes>({
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
<Info>
|
|
26
|
-
The `Routes` type is generated from your backend using `@mercurjs/cli@
|
|
26
|
+
The `Routes` type is generated from your backend using `@mercurjs/cli@latest
|
|
27
27
|
codegen`. This gives the client full type safety with zero manual type
|
|
28
28
|
definitions.
|
|
29
29
|
</Info>
|
|
@@ -133,7 +133,7 @@ try {
|
|
|
133
133
|
|
|
134
134
|
<AccordionGroup>
|
|
135
135
|
<Accordion title="Why is a route missing from the client after I added it?">
|
|
136
|
-
The client's types come from the generated route map — run `bunx @mercurjs/cli@
|
|
136
|
+
The client's types come from the generated route map — run `bunx @mercurjs/cli@latest codegen` after adding or changing route files. During development, `codegen --watch` keeps the map current automatically.
|
|
137
137
|
</Accordion>
|
|
138
138
|
<Accordion title="How are URLs derived from property access?">
|
|
139
139
|
Each property becomes a kebab-cased path segment (`client.vendor.salesSummary` → `/vendor/sales-summary`), `$`-prefixed keys fill path parameters, and the terminal method picks the HTTP verb: `query` → GET, `mutate` → POST, `delete` → DELETE.
|
package/content/tools/cli.mdx
CHANGED
|
@@ -3,12 +3,12 @@ title: "CLI"
|
|
|
3
3
|
description: "Install blocks, scaffold projects, and generate types from the command line."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
The Mercur CLI (`@mercurjs/cli@
|
|
6
|
+
The Mercur CLI (`@mercurjs/cli@latest`) manages your marketplace project — installing blocks, generating types, and checking for updates. To create a new project, use [`create-mercur-app`](https://www.npmjs.com/package/create-mercur-app).
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
bun add -g @mercurjs/cli@
|
|
11
|
+
bun add -g @mercurjs/cli@latest
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Commands
|
|
@@ -18,9 +18,9 @@ bun add -g @mercurjs/cli@rc
|
|
|
18
18
|
Scaffolding new projects lives in the standalone [`create-mercur-app`](https://www.npmjs.com/package/create-mercur-app) package, so it downloads fast and works with every package manager's `create` command.
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
bun create mercur-app@
|
|
21
|
+
bun create mercur-app@latest my-marketplace
|
|
22
22
|
# or
|
|
23
|
-
npm create mercur-app@
|
|
23
|
+
npm create mercur-app@latest my-marketplace
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
It will prompt you for database credentials and install dependencies automatically.
|
|
@@ -37,7 +37,7 @@ It will prompt you for database credentials and install dependencies automatical
|
|
|
37
37
|
Initialize an existing project by creating a `blocks.json` configuration file.
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
bunx @mercurjs/cli@
|
|
40
|
+
bunx @mercurjs/cli@latest init
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
This sets up path aliases so the CLI knows where to place blocks in your project:
|
|
@@ -62,8 +62,8 @@ This sets up path aliases so the CLI knows where to place blocks in your project
|
|
|
62
62
|
Install blocks from the registry into your project.
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
|
-
bunx @mercurjs/cli@
|
|
66
|
-
bunx @mercurjs/cli@
|
|
65
|
+
bunx @mercurjs/cli@latest add wishlist
|
|
66
|
+
bunx @mercurjs/cli@latest add product-review order-tracking
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
Blocks are copied directly into your project as source code. The CLI resolves dependencies, transforms imports to match your path aliases, and installs required packages.
|
|
@@ -79,7 +79,7 @@ Blocks are copied directly into your project as source code. The CLI resolves de
|
|
|
79
79
|
Find available blocks in the registry.
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
bunx @mercurjs/cli@
|
|
82
|
+
bunx @mercurjs/cli@latest search --query wishlist
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
| Option | Description |
|
|
@@ -92,7 +92,7 @@ bunx @mercurjs/cli@rc search --query wishlist
|
|
|
92
92
|
Display detailed information about a block.
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
|
-
bunx @mercurjs/cli@
|
|
95
|
+
bunx @mercurjs/cli@latest view wishlist
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
### diff
|
|
@@ -100,13 +100,13 @@ bunx @mercurjs/cli@rc view wishlist
|
|
|
100
100
|
Compare local blocks against registry versions to check for updates.
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
bunx @mercurjs/cli@
|
|
103
|
+
bunx @mercurjs/cli@latest diff wishlist
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
If there are changes you want, update with:
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
|
-
bunx @mercurjs/cli@
|
|
109
|
+
bunx @mercurjs/cli@latest add wishlist --overwrite
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
### codegen
|
|
@@ -114,7 +114,7 @@ bunx @mercurjs/cli@rc add wishlist --overwrite
|
|
|
114
114
|
Generate TypeScript types from your API routes. Used by the [API Client](/rc/tools/api-client) for type-safe requests.
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
|
-
bunx @mercurjs/cli@
|
|
117
|
+
bunx @mercurjs/cli@latest codegen
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
| Option | Description |
|
|
@@ -126,7 +126,7 @@ bunx @mercurjs/cli@rc codegen
|
|
|
126
126
|
Build a custom registry from a `registry.json` file.
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
|
-
bunx @mercurjs/cli@
|
|
129
|
+
bunx @mercurjs/cli@latest build
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
| Option | Description |
|
|
@@ -139,7 +139,7 @@ bunx @mercurjs/cli@rc build
|
|
|
139
139
|
Display project configuration and diagnostics.
|
|
140
140
|
|
|
141
141
|
```bash
|
|
142
|
-
bunx @mercurjs/cli@
|
|
142
|
+
bunx @mercurjs/cli@latest info
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
### telemetry
|
|
@@ -147,8 +147,8 @@ bunx @mercurjs/cli@rc info
|
|
|
147
147
|
Control anonymous usage data collection.
|
|
148
148
|
|
|
149
149
|
```bash
|
|
150
|
-
bunx @mercurjs/cli@
|
|
151
|
-
bunx @mercurjs/cli@
|
|
150
|
+
bunx @mercurjs/cli@latest telemetry --disable
|
|
151
|
+
bunx @mercurjs/cli@latest telemetry --enable
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
## Custom registries
|
|
@@ -167,7 +167,7 @@ Add custom block registries to your `blocks.json`:
|
|
|
167
167
|
Use `{name}` as a placeholder for block names. Reference custom registries with the `-r` flag:
|
|
168
168
|
|
|
169
169
|
```bash
|
|
170
|
-
bunx @mercurjs/cli@
|
|
170
|
+
bunx @mercurjs/cli@latest search --query review --registry @my-registry
|
|
171
171
|
```
|
|
172
172
|
|
|
173
173
|
## FAQ
|
package/llms.txt
CHANGED
|
@@ -14,6 +14,7 @@ package (`node_modules/@mercurjs/docs/`).
|
|
|
14
14
|
- [Concepts](content/learn/concepts.mdx) — Core concepts behind Mercur — from the Medusa foundation to blocks, panels, and the registry.
|
|
15
15
|
- [Installation](content/learn/installation.mdx) — Install Mercur and set up your marketplace project.
|
|
16
16
|
- [Introduction](content/learn/introduction.mdx) — Mercur is an open-source marketplace platform built on MedusaJS with a block-based architecture.
|
|
17
|
+
- [Mercur - an open-source Mirakl alternative](content/learn/mirakl-alternative.mdx) — How Mercur compares to Mirakl and other marketplace platforms: open-source, self-hosted, no GMV fees, full code ownership.
|
|
17
18
|
- [Offers](content/learn/offers.mdx) — An offer is a seller's sellable listing against a master product — their own SKU, price, inventory, and shipping.
|
|
18
19
|
- [Order Groups](content/learn/order-groups.mdx) — How multi-seller checkout creates order groups — the container that ties a single cart to multiple seller orders.
|
|
19
20
|
- [Payout](content/learn/payouts.mdx) — How seller payouts work in Mercur — accounts, onboarding, payment capture, and the transfer pipeline.
|