Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

chore: v2.0.0-canary.35

vholike0c2234b74c6
diff --git a/packages/admin/package.json b/packages/admin/package.json
index c34adc276..5d50b744c 100644
--- a/packages/admin/package.json
+++ b/packages/admin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/admin",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index d214b3ea3..d6f8e1b80 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/cli",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/client/package.json b/packages/client/package.json
index 76ffe5492..4f80299a6 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/client",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/core-plugin/package.json b/packages/core-plugin/package.json
index 99df07c82..2b469f15f 100644
--- a/packages/core-plugin/package.json
+++ b/packages/core-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/core-plugin",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/dashboard-sdk/package.json b/packages/dashboard-sdk/package.json
index 21c36bccd..e3581b4eb 100644
--- a/packages/dashboard-sdk/package.json
+++ b/packages/dashboard-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-sdk",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/dashboard-shared/package.json b/packages/dashboard-shared/package.json
index 3a9310ec2..d05bbe3d8 100644
--- a/packages/dashboard-shared/package.json
+++ b/packages/dashboard-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-shared",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/types/package.json b/packages/types/package.json
index e7ced8fda..2db21de0a 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/types",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/vendor/package.json b/packages/vendor/package.json
index 3b5203b79..710711a6b 100644
--- a/packages/vendor/package.json
+++ b/packages/vendor/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/vendor",
- "version": "2.0.0-canary.34",
+ "version": "2.0.0-canary.35",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/templates/basic/apps/admin/.gitignore b/templates/basic/apps/admin/.gitignore
new file mode 100644
index 000000000..a547bf36d
--- /dev/null
+++ b/templates/basic/apps/admin/.gitignore
@@ -0,0 +1,24 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/templates/basic/apps/admin/README.md b/templates/basic/apps/admin/README.md
new file mode 100644
index 000000000..d2e77611f
--- /dev/null
+++ b/templates/basic/apps/admin/README.md
@@ -0,0 +1,73 @@
+# React + TypeScript + Vite
+
+This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
+
+Currently, two official plugins are available:
+
+- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
+- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
+
+## React Compiler
+
+The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
+
+## Expanding the ESLint configuration
+
+If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
+
+```js
+export default defineConfig([
+ globalIgnores(['dist']),
+ {
+ files: ['**/*.{ts,tsx}'],
+ extends: [
+ // Other configs...
+
+ // Remove tseslint.configs.recommended and replace with this
+ tseslint.configs.recommendedTypeChecked,
+ // Alternatively, use this for stricter rules
+ tseslint.configs.strictTypeChecked,
+ // Optionally, add this for stylistic rules
+ tseslint.configs.stylisticTypeChecked,
+
+ // Other configs...
+ ],
+ languageOptions: {
+ parserOptions: {
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
+ tsconfigRootDir: import.meta.dirname,
+ },
+ // other options...
+ },
+ },
+])
+```
+
+You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
+
+```js
+// eslint.config.js
+import reactX from 'eslint-plugin-react-x'
+import reactDom from 'eslint-plugin-react-dom'
+
+export default defineConfig([
+ globalIgnores(['dist']),
+ {
+ files: ['**/*.{ts,tsx}'],
+ extends: [
+ // Other configs...
+ // Enable lint rules for React
+ reactX.configs['recommended-typescript'],
+ // Enable lint rules for React DOM
+ reactDom.configs.recommended,
+ ],
+ languageOptions: {
+ parserOptions: {
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
+ tsconfigRootDir: import.meta.dirname,
+ },
+ // other options...
+ },
+ },
+])
+```
diff --git a/templates/basic/apps/admin/eslint.config.js b/templates/basic/apps/admin/eslint.config.js
new file mode 100644
index 000000000..97fee7139
--- /dev/null
+++ b/templates/basic/apps/admin/eslint.config.js
@@ -0,0 +1,26 @@
+import js from '@eslint/js'
+import globals from 'globals'
+import reactHooks from 'eslint-plugin-react-hooks'
+import reactRefresh from 'eslint-plugin-react-refresh'
+import tseslint from 'typescript-eslint'
+import { defineConfig, globalIgnores } from 'eslint/config'
+
+export default defineConfig([
+ globalIgnores(['dist']),
+ {
+ files: ['**/*.{ts,tsx}'],
+ extends: [
+ js.configs.recommended,
+ tseslint.configs.recommended,
+ reactHooks.configs.flat.recommended,
+ reactRefresh.configs.vite,
+ ],
+ languageOptions: {
+ ecmaVersion: 2020,
+ globals: globals.browser,
+ parserOptions: {
+ tsconfigRootDir: import.meta.dirname,
+ },
+ },
+ },
+])
diff --git a/templates/basic/apps/admin/index.html b/templates/basic/apps/admin/index.html
new file mode 100644
index 000000000..d4a430de6
--- /dev/null
+++ b/templates/basic/apps/admin/index.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <link rel="icon" type="image/svg+xml" href="/public/logo.svg" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Mercur Admin</title>
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="/src/main.tsx"></script>
+ </body>
+</html>
diff --git a/templates/basic/apps/admin/mercur.config.ts b/templates/basic/apps/admin/mercur.config.ts
new file mode 100644
index 000000000..6bf37ce77
--- /dev/null
+++ b/templates/basic/apps/admin/mercur.config.ts
@@ -0,0 +1,3 @@
+import { defineConfig } from '@mercurjs/dashboard-sdk'
+
+export default defineConfig({})
diff --git a/templates/basic/apps/admin/package.json b/templates/basic/apps/admin/package.json
new file mode 100644
index 000000000..f5dc0b2b9
--- /dev/null
+++ b/templates/basic/apps/admin/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "@acme/admin",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite --port 7000",
+ "build": "tsc -b && vite build",
+ "lint": "eslint .",
+ "preview": "vite preview --port 7000"
+ },
+ "dependencies": {
+ "@medusajs/icons": "^2.13.3",
+ "@mercurjs/dashboard-sdk": "2.0.0-canary.24",
+ "@mercurjs/dashboard-shared": "2.0.0-canary.24",
+ "@mercurjs/admin": "2.0.0-canary.35",
+ "react": "^18.0.0",
+ "react-dom": "^18.0.0",
+ "react-i18next": "13.5.0",
+ "@tanstack/react-query": "5.64.2",
+ "@medusajs/ui": "4.1.1",
+ "react-router-dom": "6.30.3",
+ "@mercurjs/client": "2.0.0-canary.24",
+ "@acme/api": "*",
+ "@tanstack/react-table": "8.20.5",
+ "react-hook-form": "7.49.1",
+ "@hookform/resolvers": "3.4.2",
+ "jsonwebtoken": "9.0.2",
+ "react-jwt": "^2.0.0",
+ "zod": "3.25.76"
+ },
+ "devDependencies": {
+ "@eslint/js": "^9.39.1",
+ "@types/jsonwebtoken": "^9.0.9",
+ "@types/node": "^24.10.1",
+ "@types/react": "^18.2.66",
+ "@types/react-dom": "^18.2.22",
+ "@vitejs/plugin-react": "^4.2.1",
+ "eslint": "^9.39.1",
+ "eslint-plugin-react-hooks": "^7.0.1",
+ "eslint-plugin-react-refresh": "^0.4.24",
+ "globals": "^16.5.0",
+ "typescript": "5.9.3",
+ "typescript-eslint": "^8.46.4",
+ "vite": "^5.4.21"
+ }
+}
\ No newline at end of file
diff --git a/templates/basic/apps/admin/public/logo.svg b/templates/basic/apps/admin/public/logo.svg
new file mode 100644
index 000000000..8c2518166
--- /dev/null
+++ b/templates/basic/apps/admin/public/logo.svg
@@ -0,0 +1,38 @@
+ <svg
+ width='44'
+ height='44'
+ viewBox='0 0 44 44'
+ fill='none'
+ xmlns='http://www.w3.org/2000/svg'
+ >
+ <rect
+ width='44'
+ height='44'
+ rx='10'
+ fill='#FAFAFA'
+ />
+ <g clipPath='url(#clip0_11_175)'>
+ <path
+ d='M8 7V20.7349L19.821 13.8675L8 7Z'
+ fill='#4C24DD'
+ />
+ <path
+ d='M36.0002 37.0001V23.2651L24.1792 30.1326L36.0002 37.0001Z'
+ fill='#4C24DD'
+ />
+ <path
+ d='M8 23.2651V37L36 20.7349V7L8 23.2651Z'
+ fill='#4C24DD'
+ />
+ </g>
+ <defs>
+ <clipPath id='clip0_11_175'>
+ <rect
+ width='28'
+ height='30'
+ fill='white'
+ transform='translate(8 7)'
+ />
+ </clipPath>
+ </defs>
+ </svg>
\ No newline at end of file
diff --git a/templates/basic/apps/admin/src/README.md b/templates/basic/apps/admin/src/README.md
new file mode 100644
index 000000000..1b2697508
--- /dev/null
+++ b/templates/basic/apps/admin/src/README.md
@@ -0,0 +1,130 @@
+# Custom Pages
+
+A custom page lets you add new views to the vendor portal. Pages are automatically discovered using file-based routing powered by the `@mercurjs/dashboard-sdk` Vite plugin.
+
+> Learn more about the dashboard SDK in the [Mercur documentation](https://docs.mercurjs.com).
+
+To create a custom page:
+
+## 1. Create a Page File
+
+Create a `page.tsx` file inside the `src/pages/` directory. The file path determines the URL route.
+
+For example, create the file `src/pages/blog/page.tsx` with the following content:
+
+```tsx
+const BlogPage = () => {
+ return (
+ <div>
+ <h1>Blog Posts</h1>
+ <p>My custom vendor page</p>
+ </div>
+ )
+}
+
+export default BlogPage
+```
+
+This page will be accessible at `/blog` in the vendor portal.
+
+## 2. File-Based Routing
+
+The route is derived from the file path relative to `src/pages/`. Each route must be defined in a file named `page.tsx` (or `.ts`, `.jsx`, `.js`).
+
+| File Path | Route |
+|---|---|
+| `src/pages/page.tsx` | `/` |
+| `src/pages/blog/page.tsx` | `/blog` |
+| `src/pages/blog/[id]/page.tsx` | `/blog/:id` (dynamic) |
+| `src/pages/blog/[[id]]/page.tsx` | `/blog/:id?` (optional dynamic) |
+| `src/pages/blog/[*]/page.tsx` | `/blog/*` (splat/catch-all) |
+| `src/pages/(group)/foo/page.tsx` | `/foo` (route grouping) |
+| `src/pages/dashboard/@sidebar/page.tsx` | Parallel route (nested child) |
+
+## 3. Add a Sidebar Menu Item
+
+To add your page to the sidebar navigation, export a `config` object from the page file:
+
+```tsx
+import { Building } from "lucide-react"
+import type { RouteConfig } from "@mercurjs/dashboard-sdk"
+
+export const config: RouteConfig = {
+ label: "Blog",
+ icon: Building,
+}
+
+const BlogPage = () => {
+ return (
+ <div>
+ <h1>Blog Posts</h1>
+ </div>
+ )
+}
+
+export default BlogPage
+```
+
+### Config Options
+
+| Property | Type | Description |
+|---|---|---|
+| `label` | `string` | **(required)** Display name in the sidebar |
+| `icon` | `ComponentType` | Icon component shown next to the label |
+| `rank` | `number` | Controls ordering in the sidebar |
+| `nested` | `string` | Parent menu item path to nest under |
+| `translationNs` | `string` | i18n translation namespace for the label |
+
+## 4. Add Data Loading
+
+Use React Router's loader pattern to pre-fetch data before the page renders:
+
+```tsx
+import { useLoaderData } from "react-router-dom"
+import type { LoaderFunctionArgs } from "react-router-dom"
+
+export const loader = async ({ params }: LoaderFunctionArgs) => {
+ const response = await fetch(`/api/blog/${params.id}`)
+ return response.json()
+}
+
+const BlogDetailPage = () => {
+ const data = useLoaderData()
+
+ return (
+ <div>
+ <h1>{data.title}</h1>
+ <p>{data.content}</p>
+ </div>
+ )
+}
+
+export default BlogDetailPage
+```
+
+## 5. Add Route Metadata
+
+Export a `handle` object to attach metadata to the route, accessible via React Router's `useMatches()`:
+
+```tsx
+export const handle = {
+ breadcrumb: "Blog",
+}
+
+const BlogPage = () => {
+ return <div>Blog</div>
+}
+
+export default BlogPage
+```
+
+## Summary
+
+Each `page.tsx` file supports these exports:
+
+| Export | Required | Description |
+|---|---|---|
+| `default` | Yes | The React component to render |
+| `config` | No | Sidebar menu item configuration |
+| `loader` | No | Data loading function (React Router) |
+| `handle` | No | Route metadata (React Router) |
diff --git a/templates/basic/apps/admin/src/i18n/en.json b/templates/basic/apps/admin/src/i18n/en.json
new file mode 100644
index 000000000..72011729b
--- /dev/null
+++ b/templates/basic/apps/admin/src/i18n/en.json
@@ -0,0 +1,7 @@
+{
+ "customFields": {
+ "title": "Custom Fields",
+ "description": "Manage your custom fields and configurations",
+ "noFields": "No custom fields configured yet"
+ }
+}
diff --git a/templates/basic/apps/admin/src/i18n/index.ts b/templates/basic/apps/admin/src/i18n/index.ts
new file mode 100644
index 000000000..84da0cb86
--- /dev/null
+++ b/templates/basic/apps/admin/src/i18n/index.ts
@@ -0,0 +1,9 @@
+import en from "./en.json"
+
+const i18nResources = {
+ en: {
+ translation: en,
+ },
+}
+
+export default i18nResources
diff --git a/templates/basic/apps/admin/src/lib/client.ts b/templates/basic/apps/admin/src/lib/client.ts
new file mode 100644
index 000000000..078a11c58
--- /dev/null
+++ b/templates/basic/apps/admin/src/lib/client.ts
@@ -0,0 +1,11 @@
+import { createClient, type InferClient } from "@mercurjs/client"
+import type { Routes } from '@acme/api/_generated'
+
+declare const __BACKEND_URL__: string
+
+export const client: InferClient<Routes> = createClient({
+ baseUrl: __BACKEND_URL__,
+ fetchOptions: {
+ credentials: 'include',
+ }
+})
diff --git a/templates/basic/apps/admin/src/main.tsx b/templates/basic/apps/admin/src/main.tsx
new file mode 100644
index 000000000..659e6d16f
--- /dev/null
+++ b/templates/basic/apps/admin/src/main.tsx
@@ -0,0 +1,10 @@
+import { StrictMode } from "react";
+import { createRoot } from "react-dom/client";
+import "@mercurjs/admin/index.css";
+import App from "@mercurjs/admin";
+
+createRoot(document.getElementById("root")!).render(
+ <StrictMode>
+ <App />
+ </StrictMode>,
+);
diff --git a/templates/basic/apps/admin/tsconfig.app.json b/templates/basic/apps/admin/tsconfig.app.json
new file mode 100644
index 000000000..a5eded23c
--- /dev/null
+++ b/templates/basic/apps/admin/tsconfig.app.json
@@ -0,0 +1,35 @@
+{
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
+ "target": "ES2022",
+ "useDefineForClassFields": true,
+ "lib": [
+ "ES2022",
+ "DOM",
+ "DOM.Iterable"
+ ],
+ "module": "ESNext",
+ "types": [
+ "vite/client"
+ ],
+ "skipLibCheck": true,
+ "baseUrl": ".",
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": false,
+ "moduleDetection": "force",
+ "noEmit": true,
+ "jsx": "react-jsx",
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "erasableSyntaxOnly": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedSideEffectImports": true
+ },
+ "include": [
+ "src",
+ ]
+}
\ No newline at end of file
diff --git a/templates/basic/apps/admin/tsconfig.json b/templates/basic/apps/admin/tsconfig.json
new file mode 100644
index 000000000..1ffef600d
--- /dev/null
+++ b/templates/basic/apps/admin/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "files": [],
+ "references": [
+ { "path": "./tsconfig.app.json" },
+ { "path": "./tsconfig.node.json" }
+ ]
+}
diff --git a/templates/basic/apps/admin/tsconfig.node.json b/templates/basic/apps/admin/tsconfig.node.json
new file mode 100644
index 000000000..ed01be245
--- /dev/null
+++ b/templates/basic/apps/admin/tsconfig.node.json
@@ -0,0 +1,32 @@
+{
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
+ "target": "ES2023",
+ "lib": [
+ "ES2023"
+ ],
+ "module": "ESNext",
+ "jsx": "react-jsx",
+ "types": [
+ "node"
+ ],
+ "skipLibCheck": true,
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "noEmit": true,
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "erasableSyntaxOnly": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedSideEffectImports": true
+ },
+ "include": [
+ "vite.config.ts",
+ "mercur.config.ts"
+ ]
+}
\ No newline at end of file
diff --git a/templates/basic/apps/admin/vite.config.ts b/templates/basic/apps/admin/vite.config.ts
new file mode 100644
index 000000000..2d9bc2f9b
--- /dev/null
+++ b/templates/basic/apps/admin/vite.config.ts
@@ -0,0 +1,8 @@
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+import { dashboardPlugin } from '@mercurjs/dashboard-sdk'
+
+// https://vite.dev/config/
+export default defineConfig({
+ plugins: [react(), dashboardPlugin()],
+})
diff --git a/templates/basic/apps/vendor/index.html b/templates/basic/apps/vendor/index.html
index 3eba2070a..9d702be40 100644
--- a/templates/basic/apps/vendor/index.html
+++ b/templates/basic/apps/vendor/index.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/public/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Vendor Hub</title>
+ <title>Mercur Vendor Hub</title>
</head>
<body>
<div id="root"></div>