Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
env:
NODE_OPTIONS: "--max-old-space-size=8192"
API_URL: "https://docs.medusajs.com"
POSTHOG_API_KEY: "temp"
POSTHOG_HOST: "https://eu.i.posthog.com"
run: yarn build:docs

vale-docs:
Expand Down
4 changes: 3 additions & 1 deletion www/apps/api-reference/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ NEXT_PUBLIC_API_V2_URL=
ALGOLIA_WRITE_API_KEY=
NEXT_PUBLIC_AI_ASSISTANT_URL=
NEXT_PUBLIC_AI_WEBSITE_ID=
NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY=
NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY=
NEXT_PUBLIC_POSTHOG_API_KEY=
NEXT_PUBLIC_POSTHOG_HOST=
1 change: 1 addition & 0 deletions www/apps/api-reference/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"openapi-sampler": "^1.3.1",
"openapi-types": "^12.1.3",
"postcss": "8.4.27",
"posthog-js": "^1.285.1",
"prism-react-renderer": "2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
5 changes: 4 additions & 1 deletion www/apps/api-reference/providers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ type ProvidersProps = {

const Providers = ({ children }: ProvidersProps) => {
return (
<AnalyticsProvider writeKey={process.env.NEXT_PUBLIC_SEGMENT_API_KEY}>
<AnalyticsProvider
posthogApiKey={process.env.NEXT_PUBLIC_POSTHOG_API_KEY}
posthogHost={process.env.NEXT_PUBLIC_POSTHOG_HOST}
>
<PageLoadingProvider>
<ModalProvider>
<ColorModeProvider>
Expand Down
4 changes: 3 additions & 1 deletion www/apps/docs/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ AI_API_ASSISTANT_TOKEN=
AI_WEBSITE_ID=
AI_API_ASSISTANT_RECAPTCHA_SITE_KEY=
CLOUDINARY_CLOUD_NAME=
BASE_PATH=
BASE_PATH=
POSTHOG_API_KEY=
POSTHOG_HOST=
17 changes: 16 additions & 1 deletion www/apps/docs/content/deployments/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@ import { getCategoryItems } from '@site/src/utils/get-first-category-item';

# Deployment Overview

In this document, you’ll learn about the different ways you can deploy your Medusa project.
In this document, you’ll learn about the different ways you can deploy your Medusa v1 project.

<Note title="Deploy with Medusa Cloud">

This guide is intended for Medusa v1 users. If you're a Medusa v2 user, consider using [Medusa Cloud](https://docs.medusajs.com/cloud). By using Medusa Cloud, you can avoid the complexities and challenges of self-hosting, while benefiting from automated deployment, scaling, and maintenance.

With Medusa Cloud, you also maintain full customization control as you deploy your own modules and customizations directly from GitHub:

1. Push to deploy.
2. Multiple testing environments.
3. Preview environments for new PRs.
4. Test on production-like data.

Refer to the [Cloud vs. Self-Hosting comparison guide](https://docs.medusajs.com/cloud/comparison) for more details.

</Note>

## Overview

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@ addHowToData: true

# Deploy Your Medusa Backend to DigitalOcean Apps

In this document, you'll learn how to deploy your Medusa backend to a DigitalOcean App.
In this document, you'll learn how to deploy your Medusa v1 backend to a DigitalOcean App.

:::info[Deploy with Medusa Cloud]

This guide is intended for Medusa v1 users. If you're a Medusa v2 user, consider using [Medusa Cloud](https://docs.medusajs.com/cloud). By using Medusa Cloud, you can avoid the complexities and challenges of self-hosting, while benefiting from automated deployment, scaling, and maintenance.

With Medusa Cloud, you also maintain full customization control as you deploy your own modules and customizations directly from GitHub:

1. Push to deploy.
2. Multiple testing environments.
3. Preview environments for new PRs.
4. Test on production-like data.

Refer to the [Cloud vs. Self-Hosting comparison guide](https://docs.medusajs.com/cloud/comparison) for more details.

:::

DigitalOcean is a reliable hosting provider that provides different ways to host websites and servers. One way to host a backend is using their DigitalOcean App Platform.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ addHowToData: true

# Deploy Your Medusa Backend on Heroku

In this document, you'll learn how to deploy your Medusa backend on Heroku. Heroku is a PaaS (Platform as a Service) that allows you to easily deploy your applications in the cloud.
In this document, you'll learn how to deploy your Medusa v1 backend on Heroku. Heroku is a PaaS (Platform as a Service) that allows you to easily deploy your applications in the cloud.

Alternatively, you can use this button to deploy the Medusa backend to Heroku directly:
<Note title="Deploy with Medusa Cloud">

<a href="https://heroku.com/deploy?template=https://github.com/medusajs/medusa-starter-default/tree/feat/deploy-heroku" className="img-url">
<img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku" className="no-zoom-img" />
</a>
This guide is intended for Medusa v1 users. If you're a Medusa v2 user, consider using [Medusa Cloud](https://docs.medusajs.com/cloud). By using Medusa Cloud, you can avoid the complexities and challenges of self-hosting, while benefiting from automated deployment, scaling, and maintenance.

With Medusa Cloud, you also maintain full customization control as you deploy your own modules and customizations directly from GitHub:

1. Push to deploy.
2. Multiple testing environments.
3. Preview environments for new PRs.
4. Test on production-like data.

Refer to the [Cloud vs. Self-Hosting comparison guide](https://docs.medusajs.com/cloud/comparison) for more details.

</Note>

## Prerequisites

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@ addHowToData: true

# Deploy Your Medusa Backend on Microtica

In this document, you'll learn how to deploy your Medusa backend on your AWS account with Microtica.
In this document, you'll learn how to deploy your Medusa v1 backend on your AWS account with Microtica.

:::info[Deploy with Medusa Cloud]

This guide is intended for Medusa v1 users. If you're a Medusa v2 user, consider using [Medusa Cloud](https://docs.medusajs.com/cloud). By using Medusa Cloud, you can avoid the complexities and challenges of self-hosting, while benefiting from automated deployment, scaling, and maintenance.

With Medusa Cloud, you also maintain full customization control as you deploy your own modules and customizations directly from GitHub:

1. Push to deploy.
2. Multiple testing environments.
3. Preview environments for new PRs.
4. Test on production-like data.

Refer to the [Cloud vs. Self-Hosting comparison guide](https://docs.medusajs.com/cloud/comparison) for more details.

:::

:::note

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@ import MimeErrorTroubleshooting from "../../troubleshooting/mime-error.md"

# Deploy Your Medusa Backend to Railway

In this document, you’ll learn how to deploy your Medusa backend to Railway.
In this document, you’ll learn how to deploy your Medusa v1 backend to Railway.

## What is Railway
<Note title="Deploy with Medusa Cloud">

[Railway](https://railway.app/) is a hosting provider that you can use to deploy web applications and databases without having to worry about managing the full infrastructure.
This guide is intended for Medusa v1 users. If you're a Medusa v2 user, consider using [Medusa Cloud](https://docs.medusajs.com/cloud). By using Medusa Cloud, you can avoid the complexities and challenges of self-hosting, while benefiting from automated deployment, scaling, and maintenance.

With Medusa Cloud, you also maintain full customization control as you deploy your own modules and customizations directly from GitHub:

Railway provides a free trial (no credit card required) that allows you to deploy your Medusa backend along with PostgreSQL and Redis databases. This is useful mainly for development and demo purposes.
1. Push to deploy.
2. Multiple testing environments.
3. Preview environments for new PRs.
4. Test on production-like data.

<a
href="https://railway.app/template/zC7eOq?referralCode=TW4Qi0" className="img-url no-zoom-img mb-2 inline-block">
<img src="https://railway.app/button.svg" alt="Deploy with Railway" className="no-zoom-img"/>
</a>
Refer to the [Cloud vs. Self-Hosting comparison guide](https://docs.medusajs.com/cloud/comparison) for more details.

</Note>

## What is Railway

[Railway](https://railway.app/) is a hosting provider that you can use to deploy web applications and databases without having to worry about managing the full infrastructure.

<Note type="check">

Expand Down
17 changes: 16 additions & 1 deletion www/apps/docs/content/deployments/server/general-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@ addHowToData: true

# General Deployment Guide for Medusa Backend

In this guide, you’ll learn the general steps you need to take when deploying your Medusa backend. This is useful when the [platform-specific deployment guides](./index.mdx) do not include your selected hosting provider.
In this guide, you’ll learn the general steps you need to take when deploying your Medusa v1 backend. This is useful when the [platform-specific deployment guides](./index.mdx) do not include your selected hosting provider.

:::info[Deploy with Medusa Cloud]

This guide is intended for Medusa v1 users. If you're a Medusa v2 user, consider using [Medusa Cloud](https://docs.medusajs.com/cloud). By using Medusa Cloud, you can avoid the complexities and challenges of self-hosting, while benefiting from automated deployment, scaling, and maintenance.

With Medusa Cloud, you also maintain full customization control as you deploy your own modules and customizations directly from GitHub:

1. Push to deploy.
2. Multiple testing environments.
3. Preview environments for new PRs.
4. Test on production-like data.

Refer to the [Cloud vs. Self-Hosting comparison guide](https://docs.medusajs.com/cloud/comparison) for more details.

:::

## Prerequisites

Expand Down
15 changes: 15 additions & 0 deletions www/apps/docs/content/deployments/server/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,19 @@ import DocCardList from '@theme/DocCardList';

Find in this page guides to deploy your Medusa backend on different platforms.

<Note title="Deploy with Medusa Cloud">

The following guides are intended for Medusa v1 users. If you're a Medusa v2 user, consider using [Medusa Cloud](https://docs.medusajs.com/cloud). By using Medusa Cloud, you can avoid the complexities and challenges of self-hosting, while benefiting from automated deployment, scaling, and maintenance.

With Medusa Cloud, you also maintain full customization control as you deploy your own modules and customizations directly from GitHub:

1. Push to deploy.
2. Multiple testing environments.
3. Preview environments for new PRs.
4. Test on production-like data.

Refer to the [Cloud vs. Self-Hosting comparison guide](https://docs.medusajs.com/cloud/comparison) for more details.

</Note>

<DocCardList />
11 changes: 10 additions & 1 deletion www/apps/docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ const config = {
outputPath: path.join(__dirname, "src", "utils"),
},
],
[
"posthog-docusaurus",
{
apiKey: process.env.POSTHOG_API_KEY,
appUrl: process.env.POSTHOG_HOST,
enableInDevelopment: false, // optional
},
],
],
themes: ["@docusaurus/theme-mermaid"],
themeConfig: {
Expand Down Expand Up @@ -157,7 +165,8 @@ const config = {
defaultFilters: ["docs"],
},
analytics: {
apiKey: process.env.SEGMENT_API_KEY || "temp",
apiKey: process.env.POSTHOG_API_KEY || "temp",
host: process.env.POSTHOG_HOST || "https://us.i.posthog.com",
},
prism: {
defaultLanguage: "ts",
Expand Down
2 changes: 2 additions & 0 deletions www/apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"lodash": "^4.17.21",
"mdast-util-mdx": "^3.0.0",
"postcss": "^8.4.21",
"posthog-docusaurus": "^2.0.5",
"posthog-js": "^1.285.1",
"prism-react-renderer": "^2.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions www/apps/docs/src/providers/DocsProviders/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ type DocsProvidersProps = {

const DocsProviders = ({ children }: DocsProvidersProps) => {
const {
analytics: { apiKey },
analytics: { apiKey, host },
} = useThemeConfig() as ThemeConfig

return (
<AnalyticsProvider writeKey={apiKey}>
<AnalyticsProvider posthogApiKey={apiKey} posthogHost={host}>
<ColorModeProvider>
<ModalProvider>
<SearchProvider>
Expand Down
2 changes: 1 addition & 1 deletion www/apps/docs/src/theme/Admonition/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function AdmonitionContent({
)}
>
{title && (
<span className="txt-compact-medium-plus block mb-0.125">
<span className="text-compact-medium-plus block mb-docs_0.125 text-medusa-fg-base">
{transformAdmonitionTitle(title)}
</span>
)}
Expand Down
1 change: 1 addition & 0 deletions www/apps/docs/src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ declare module "@medusajs/docs" {
}
analytics?: {
apiKey: string
host?: string
}
aiAssistant?: {
apiUrl: string
Expand Down
2 changes: 2 additions & 0 deletions www/packages/docs-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"next": "*",
"posthog-js": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"dependencies": {
"@medusajs/icons": "^1.2.0",
"@medusajs/ui": "^2.4.1",
"@octokit/request": "^8.1.1",
"@posthog/react": "^1.3.0",
"@react-hook/resize-observer": "^1.2.6",
"@segment/analytics-next": "^1.55.0",
"@uidotdev/usehooks": "^2.4.1",
Expand Down
5 changes: 1 addition & 4 deletions www/packages/docs-ui/src/components/Feedback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@ export const Feedback = ({
: showForm
? inlineQuestionRef
: inlineFeedbackRef
const { loaded, track } = useAnalytics()
const { track } = useAnalytics()

function handleFeedback(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) {
if (!loaded) {
return
}
const feedback = (e.target as Element).classList.contains("positive")
setPositiveFeedback(feedback)
setShowForm(true)
Expand Down
3 changes: 0 additions & 3 deletions www/packages/docs-ui/src/providers/AiAssistant/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client"

import React, { createContext, useContext } from "react"
import { useAnalytics } from "@/providers"
import { AiAssistant } from "@/components"
import { RecaptchaAction, useRecaptcha } from "../../hooks/use-recaptcha"

Expand Down Expand Up @@ -30,7 +29,6 @@ export const AiAssistantProvider = ({
websiteId,
children,
}: AiAssistantProviderProps) => {
const { analytics } = useAnalytics()
const { execute: getReCaptchaToken } = useRecaptcha({
siteKey: recaptchaSiteKey,
})
Expand Down Expand Up @@ -77,7 +75,6 @@ export const AiAssistantProvider = ({
JSON.stringify({
question_id: questionId,
reaction,
user_identifier: analytics?.user().anonymousId() || "",
})
)
}
Expand Down
Loading
Loading