diff --git a/www/apps/docs/content/cli/reference.mdx b/www/apps/docs/content/cli/reference.mdx index 507e305aac..34d2c94a1e 100644 --- a/www/apps/docs/content/cli/reference.mdx +++ b/www/apps/docs/content/cli/reference.mdx @@ -127,11 +127,11 @@ medusa new [ []] | `--skip-db` | If the flag is set the command will not attempt to complete the database setup. | | `--skip-migrations` | If the flag is set the command will not attempt to complete the database migration. | | `--skip-env` | If the flag is set the command will not attempt to populate .env. | -| `--db-user` | The database user to use for database setup and migrations. | -| `--db-database` | The database used for database setup and migrations. | -| `--db-pass` | The database password to use for database setup and migrations. | -| `--db-port` | The database port to use for database setup and migrations. | -| `--db-host` | The database host to use for database setup and migrations. | +| `--db-user ` | The database user to use for database setup and migrations. | +| `--db-database ` | The database used for database setup and migrations. | +| `--db-pass ` | The database password to use for database setup and migrations. | +| `--db-port ` | The database port to use for database setup and migrations. | +| `--db-host ` | The database host to use for database setup and migrations. | ### develop @@ -145,8 +145,8 @@ medusa develop | Name | Description | | --- | --- | -| `-H`, `--host` | Set host. Defaults to localhost. | -| `-p`, `--port` | Set port. Defaults to 9000. | +| `-H `, `--host ` | Set host. Defaults to `localhost`. | +| `-p `, `--port ` | Set port. Defaults to `9000`. | ### start @@ -160,8 +160,8 @@ medusa start | Name | Description | | --- | --- | -| `-H`, `--host` | Set host. Defaults to localhost. | -| `-p`, `--port` | Set port. Defaults to 9000. | +| `-H `, `--host ` | Set host. Defaults to `localhost`. | +| `-p `, `--port ` | Set port. Defaults to `9000`. | ### migrations @@ -189,7 +189,7 @@ medusa seed --seed-file= | Name | Description | | --- | --- | -| `-f`, `--seed-file` | Path to the file where the seed is defined. (required) | +| `-f=`, `--seed-file=` | Path to the file where the seed is defined. (required) | | `-m`, `--migrate` | Flag to indicate if migrations should be run prior to seeding the database. Default is true. | ### user @@ -209,6 +209,24 @@ medusa user --email [--password ] | `-i `, `--id ` | The user’s ID. By default it is automatically generated. | | `--invite` | Whether to create an invite instead of a user. When using this option, you don't need to specify a password. If ran successfully, you'll receive the invite token in the output. | +### start-cluster + +Starts the Medusa backend in [cluster mode](https://expressjs.com/en/advanced/best-practice-performance.html#run-your-app-in-a-cluster). Running in cluster mode will likely significantly improve performance as the workload and tasks are distributed among all available instances instead of a single one. + +```bash +medusa start-cluster +``` + +#### Options + +| Name | Description | +| --- | --- | +| `--cpus ` | The number of CPUs that Medusa can consume. By default, Medusa will try to consume all CPUs in cluster mode if this option isn't specified. | +| `--cpus ` | The number of CPUs that Medusa can consume. By default, Medusa will try to consume all CPUs in cluster mode if this option isn't specified. | +| `-c `, `--cpus ` | The number of CPUs that Medusa can consume. By default, Medusa will try to consume all CPUs in cluster mode if this option isn't specified. | +| `-H `, `--host ` | Set host. Defaults to `localhost`. | +| `-p `, `--port ` | Set port. Defaults to `9000`. | + ### telemetry Enable or disable the collection of anonymous data usage. If no option is provided, the command will enable the collection of anonymous data usage. diff --git a/www/apps/docs/content/medusa-react/overview.mdx b/www/apps/docs/content/medusa-react/overview.mdx index d1fbc9c2ce..00b9264145 100644 --- a/www/apps/docs/content/medusa-react/overview.mdx +++ b/www/apps/docs/content/medusa-react/overview.mdx @@ -45,9 +45,9 @@ Part of the Medusa roadmap is to move the types into a separate package, removin ## Usage -To use the hooks exposed by Medusa React, you need to include the `MedusaProvider` somewhere up in your component tree. +To use the hooks exposed by Medusa React, you need to include the `MedusaProvider` somewhere up in your component tree. -The `MedusaProvider` requires two props: +The `MedusaProvider` requires two props: 1. `baseUrl`: The URL to your Medusa backend 2. `queryClientProviderProps`: An object used to set the Tanstack Query client. The object requires a `client` property, which should be an instance of [QueryClient](https://tanstack.com/query/v4/docs/react/reference/QueryClient). @@ -108,10 +108,12 @@ You can also pass the following props to Medusa Provider: | ------------------- | ------------------------- | --------------------------------------------------------- | | `apiKey` | `''` | Optional API key used for authenticating admin requests. Follow [this guide](https://docs.medusajs.com/api/admin#authentication) to learn how to create an API key for an admin user. | | `publishableApiKey` | `''` | Optional publishable API key used for storefront requests. You can create a publishable API key either using the [admin APIs](../development/publishable-api-keys/admin/manage-publishable-api-keys.mdx) or the [Medusa admin](../user-guide/settings/publishable-api-keys.mdx). | +| `maxRetries` | `3` | Number of times to retry a request if it fails. | +| `customHeaders` | `{}` | An object of custom headers to pass with every request. Each key of the object is the name of the header, and its value is the header's value. | ### Queries -To fetch data from the Medusa backend (in other words, perform `GET` requests), you can use [Queries](https://tanstack.com/query/v4/docs/react/guides/queries). Query hooks simply wrap around Tanstack Query's `useQuery` hook to fetch data from your Medusa backend. +To fetch data from the Medusa backend (in other words, perform `GET` requests), you can use [Queries](https://tanstack.com/query/v4/docs/react/guides/queries). Query hooks simply wrap around Tanstack Query's `useQuery` hook to fetch data from your Medusa backend. For example, to fetch products from your Medusa backend: @@ -156,7 +158,7 @@ You can learn more about using queries in [Tanstack Query’s documentation](htt ### Mutations -To create, update, or delete data on the Medusa backend (in other words, perform `POST`, `PUT`, and `DELETE` requests), you can use [Mutations](https://tanstack.com/query/v4/docs/react/guides/mutations). Mutation hooks wrap around Tanstack Query's `useMutation` to mutate data on your Medusa backend. +To create, update, or delete data on the Medusa backend (in other words, perform `POST`, `PUT`, and `DELETE` requests), you can use [Mutations](https://tanstack.com/query/v4/docs/react/guides/mutations). Mutation hooks wrap around Tanstack Query's `useMutation` to mutate data on your Medusa backend. For example, to create a cart: @@ -643,11 +645,11 @@ This is an experimental feature. ::: -To facilitate building custom storefronts, `medusa-react` also exposes a `CartProvider` and a `SessionCartProvider`. +To facilitate building custom storefronts, `medusa-react` also exposes a `CartProvider` and a `SessionCartProvider`. ### CartProvider -`CartProvider` makes use of some of the hooks already exposed by `medusa-react` to perform cart operations on the Medusa backend. You can use it to create a cart, start the checkout flow, authorize payment sessions, and so on. +`CartProvider` makes use of some of the hooks already exposed by `medusa-react` to perform cart operations on the Medusa backend. You can use it to create a cart, start the checkout flow, authorize payment sessions, and so on. It also manages one single global piece of state which represents a cart, exactly like the one created on your Medusa backend. diff --git a/www/apps/docs/content/modules/carts-and-checkout/backend/cart-completion-strategy.md b/www/apps/docs/content/modules/carts-and-checkout/backend/cart-completion-strategy.md index aa3ad1118d..bc333f84dc 100644 --- a/www/apps/docs/content/modules/carts-and-checkout/backend/cart-completion-strategy.md +++ b/www/apps/docs/content/modules/carts-and-checkout/backend/cart-completion-strategy.md @@ -98,7 +98,7 @@ The completion strategy is expected to return an object with the following prope - `response_code`: a number indicating the response code. - `response_body`: an object that will be returned to the client. -You can refer to this guide to learn how the cart conceptual guide is implemented in the Medusa backend. This can help you understand how details such as inventory, taxes, and more are handled. +You can refer to [this guide](../cart.md#cart-completion-process) to learn how the cart conceptual guide is implemented in the Medusa backend. This can help you understand how details such as inventory, taxes, and more are handled. --- diff --git a/www/apps/docs/content/upgrade-guides/medusa-core/1-19.mdx b/www/apps/docs/content/upgrade-guides/medusa-core/1-19.mdx new file mode 100644 index 0000000000..8a7726e25e --- /dev/null +++ b/www/apps/docs/content/upgrade-guides/medusa-core/1-19.mdx @@ -0,0 +1,59 @@ +--- +description: "Actions Required for v.1.19" +sidebar_custom_props: + iconName: "server-stack-solid" +--- + +# v1.19 + +Version 1.19 of Medusa ships performance improvements, bug fixes, and some breaking changes. + + + +## Breaking Changes + +### Change in Cart-Completion Strategy Response + +In previous versions, if you attempt to complete a cart that's already completed, you will receive a response with status code`409`, indicating a conflict. + +In v1.19 of the Medusa backend, the order or swap associated with the completed cart is returned instead with status code 200: + +``` +// completing a regular cart +{ + response_code: 200, + response_body: { data: order, type: "order" }, +} + +// completing a swap cart +{ + response_code: 200, + response_body: { data: swap, type: "swap" }, +} +``` + +### Replaced node-redis with ioredis + +In previous versions, the Medusa backend used `node-redis` to manage the Express session store. + +In v1.19, `node-redis` is replaced with `ioredis` for higher configurability of the Redis client used for session management, and to make Redis configurations consistent with Redis modules (such as the Redis Event or Cache modules) which use `ioredis`. + +--- + +## How to Update + +Run the following command in your project: + +```bash npm2yarn +npm install @medusajs/medusa@1.19 +``` + +To avoid unexpected issues with dependencies, it's also recommended to update all other Medusa plugins or packages you have installed. diff --git a/www/apps/docs/src/theme/Icon/index.tsx b/www/apps/docs/src/theme/Icon/index.tsx index 191304aa15..113e459bc4 100644 --- a/www/apps/docs/src/theme/Icon/index.tsx +++ b/www/apps/docs/src/theme/Icon/index.tsx @@ -52,7 +52,6 @@ import { FolderOpen, Gatsby, GiftSolid, - Github, GlobeEurope, GlobeEuropeSolid, InformationCircleSolid, @@ -103,6 +102,7 @@ import IconPuzzleSolid from "./PuzzleSolid" import IconNextjs from "./Nextjs" import IconFlagMini from "./FlagMini" import IconBeaker from "./Beaker" +import IconGitHub from "./GitHub" export default { "academic-cap-solid": AcademicCapSolid, @@ -163,7 +163,7 @@ export default { gatsby: Gatsby, "gift-solid": GiftSolid, "flag-mini": IconFlagMini, - github: Github, + github: IconGitHub, "globe-europe": GlobeEurope, "globe-europe-solid": GlobeEuropeSolid, "information-circle-solid": InformationCircleSolid, diff --git a/www/apps/docs/src/theme/MDXComponents/index.tsx b/www/apps/docs/src/theme/MDXComponents/index.tsx index 240fe69f99..a068bb74a0 100644 --- a/www/apps/docs/src/theme/MDXComponents/index.tsx +++ b/www/apps/docs/src/theme/MDXComponents/index.tsx @@ -6,6 +6,8 @@ import { Kbd, DetailsSummary } from "docs-ui" import H1 from "./H1" import MDXCode from "./Code" import MDXDetails from "./Details" +import DocCard from "@theme/DocCard" +import DocCardList from "@theme/DocCardList" export default { // Re-use the default mapping @@ -18,4 +20,6 @@ export default { a: MDXA, kbd: Kbd, h1: H1, + DocCard, + DocCardList, }