project/medusa-foundation-audit
Cloud Style Guide
The cloud project (www/apps/cloud/) covers how developers and technical users manage their Medusa applications on Cloud: creating projects, managing environments and deployments, configuring resources, and monitoring usage.
Constraints
- Never touch
www/apps/cloud/generated/— auto-generated byyarn prep, will be overwritten. The one exception isgenerated/changelog/{YYYY-MM-DD}.mjs, the changelog entry files, which are written by hand;generated/changelog/index.mjsis still generated and off-limits. - Never invent Cloudinary screenshot URLs — will be added manually later.
- No YAML frontmatter — cloud pages use only a
metadataexport (nosidebar_label, notags). - Don't document internal platform details — only user-visible behaviors, UI flows, and settings.
Audience
The cloud docs are for developers and technical users who deploy and manage Medusa applications on Cloud. Assume the reader:
- Is comfortable with Git, GitHub, and web development concepts
- Is not necessarily a Medusa expert — define Cloud-specific terms on first use
- Wants task-oriented guidance, not architecture explanations
Page Structure
Every cloud page follows this pattern:
import { Note } from "docs-ui"
export const metadata = {
title: `Page Title`,
}
# {metadata.title}
In this guide, you'll learn about <topic>.
## Section One
[Content]
---
## Section Two
[Content]
Key rules:
importstatements come before themetadataexport- Only import what is actually used on the page
- Opening paragraph states what the reader will learn — 1-2 sentences
- H2 sections are separated by
---dividers - No YAML frontmatter
Writing Style
- Cloud naming: Never write "Medusa Cloud". Use "Medusa" when referring to it as a noun/subject ("Medusa allows you to..."), and "Cloud" when referring to it as a location or service ("Deploy to Cloud", "the Cloud dashboard")
- Second person: "You create a project..." not "We create..." or "One can create..."
- Task-based H2 titles: "Create a Project", "Manage Environment Variables", "Delete an Environment"
- Imperative numbered steps: "Click Save", "Enter the environment name", "Select a region"
- Present tense: "The deployment appears in the list", not "The deployment will appear"
- Bold UI elements: buttons, labels, field names, section titles —
**Create Project**,**Save**,**Environment name** - Contextual intro per section: Each H2 section starts with 1–2 sentences explaining what the section covers before the numbered steps
Available Components
Import these from docs-ui as needed:
Note
Use for important notices, warnings, or tips:
import { Note } from "docs-ui"
<Note>
Content here. Can include links and formatting.
</Note>
For warnings, add type="warning":
<Note type="warning">
Deleting an environment is irreversible and will remove all associated resources.
</Note>
InlineIcon
Use to reference a specific UI icon inline:
import { InlineIcon } from "docs-ui"
import { EllipsisHorizontal } from "@medusajs/icons"
Click the <InlineIcon Icon={EllipsisHorizontal} alt="three dots" /> icon next to the environment.
Only use InlineIcon when a numbered step refers to an icon that has no visible text label.
Prerequisites
Use when prerequisites exist for a task:
import { Prerequisites } from "docs-ui"
<Prerequisites items={[
{ title: "Create a project", link: "/projects" },
]} />
Table
Use for structured comparisons or multi-column data:
import { Table } from "docs-ui"
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
Column
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
Value
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
Put each cell's content on its own line, indented one level deeper than its tag. When a cell's content uses markdown, such as inline code or a link, surround it with blank lines so MDX parses it:
<Table.Cell>
[`deployment.created`](#deploymentcreated)
</Table.Cell>
Cross-Project Links
Link to other cloud pages using relative paths:
[Environments](../environments/page.mdx)
[Projects](../projects/page.mdx)
Link to other doc projects using the cross-project prefixes:
[text](!docs!/learn/path) → book
[text](!resources!/path) → resources
[text](!user-guide!/path) → user-guide
Navigation (Sidebar)
The sidebar is in www/apps/cloud/sidebar.mjs. Add entries under the appropriate category:
{
type: "link",
path: "/<section>/<topic>",
title: "Page Title",
}
For nested pages, add a children array to the parent:
{
type: "link",
title: "Environments",
path: "/environments",
children: [
{
type: "link",
title: "Long-Lived",
path: "/environments/long-lived",
},
],
}
Note: Always add the page to the sidebar when creating a new page — otherwise it won't appear in navigation.
File Placement
Pages live at www/apps/cloud/app/<path>/page.mdx. Match the sidebar path exactly:
| Sidebar path | File path |
|---|---|
/projects |
www/apps/cloud/app/projects/page.mdx |
/environments/long-lived |
www/apps/cloud/app/environments/long-lived/page.mdx |
/billing/plans |
www/apps/cloud/app/billing/plans/page.mdx |
CLI Documentation
The Cloud CLI (mcloud) docs live under www/apps/cloud/app/cli/. Each command topic has its own page at www/apps/cloud/app/cli/commands/<topic>/page.mdx.
CLI Page Structure
Each command page documents all subcommands for that topic. For example, the deployments page covers deployments list, deployments get, and deployments build-logs.
import { Table, CodeTabs, CodeTab } from "docs-ui"
export const metadata = {
title: `<topic> Command - Medusa Cloud CLI Reference`,
}
# {metadata.title}
In this guide, you'll learn how to <what the commands do>.
## <topic> <subcommand>
Description of what the subcommand does.
<CodeTabs group="cli-auth">
<CodeTab label="With Flags" value="flags">
```bash
mcloud <topic> <subcommand> --organization org_123 --project proj_123
# Run once: mcloud use --organization org_123 --project proj_123
mcloud <topic> <subcommand>
Options
Option Description Required Default `-o `, `--organization ` The organization ID. Yes Falls back to the [active context](../use/page.mdx).
### CLI Writing Rules
- **Command syntax**: Always show the full command (e.g. `mcloud deployments list`), not just the subcommand
- **Flag format**: Show both short and long forms where available (e.g. `` `-o <id>`, `--organization <id>` ``)
- **CodeTabs for auth**: Use `<CodeTabs group="cli-auth">` with "With Flags" and "Using mcloud use" tabs to show both explicit and context-based usage
- **Arguments section**: Add an Arguments table (Option, Description, Required) for positional arguments
- **Options section**: Use a four-column Table (Option, Description, Required, Default)
- **Subcommand separation**: Separate subcommand sections with `---` dividers
- **Cross-references**: Link to related command pages using relative paths (e.g. `[active context](../use/page.mdx)`)
- **JSON flag**: If a command supports `--json`, include it in the Options table
- **New commands**: When adding a command page, also add it to the CLI category in `www/apps/cloud/sidebar.mjs`
### When to Update CLI Docs
Update CLI docs when a Cloud CLI change:
- Adds a new command or subcommand
- Removes an existing command or subcommand
- Adds, changes, or removes a flag or positional argument
- Changes a command's description or help text
- Changes the output format (table columns, JSON structure)
- Changes shared flags that affect multiple commands
Do not update CLI docs for internal refactors that don't change the CLI's external behavior.
---
## Cloud Changelog
Cloud has three separate changelogs, and each change belongs to exactly one of them:
| Changelog | File | Covers |
|---|---|---|
| Cloud | `www/apps/cloud/generated/changelog/{YYYY-MM-DD}.mjs` | Dashboard changes |
| Cloud CLI | `www/apps/cloud/app/cli/changelog/page.mdx` | `mcloud` releases |
| Webhooks | `www/apps/cloud/app/webhooks/changelog/page.mdx` | Webhook event changes |
The Cloud changelog links to the other two at the top of the page, and never repeats their entries.
Dashboard changes are **dated, not versioned**, since the dashboard has no user-facing version number.
Unlike the other two, the Cloud changelog isn't written in its page. `www/apps/cloud/app/changelog/page.mdx` holds only the intro and a `<ChangelogList />` component — **never add entries to it**. Each date is its own entry file in `www/apps/cloud/generated/changelog`, which the page renders and the public `/cloud/api/changelog` endpoint serves:
```js
/** @type {import("../../utils/changelog").ChangelogEntry} */
export default {
date: "2026-08-10",
title: "Build-time environment variables and provisioning failures",
summary:
"Environment variables can be scoped to build time or runtime, and environment cards report failed provisioning.",
content: `- You can now set an environment variable as available at build time, runtime, or both. Refer to [Environment Variables](https://docs.medusajs.com/cloud/environments/environment-variables) for more details.
- An environment's card now shows a **Provisioning failed** state. The card previously kept showing a loading preview.`,
}
- The file name is the entry's date,
{YYYY-MM-DD}.mjs, anddatematches it exactly titleis a short headline naming what shipped — 3–8 words, under 60 characters, sentence case, no trailing period, no Markdown. It's the entry's heading on the page, with the date shown next to it, so don't put the date in it. When merging into an existing entry, rewrite the title to cover the merged bulletssummaryis one plain sentence covering the entry as a whole, under 160 characters, with no Markdown or links. It's never rendered on the page — it's returned by the public/cloud/api/changelogendpoint. When merging into an existing entry, rewrite the summary to cover the merged bullets- Never write an
imageproperty. The entry's banner is rendered from its date and patched in by the automation workflow, and it's returned by the endpoint rather than rendered on the page contentholds only the bullet points. The heading is rendered fromtitle, so never write a##line in the content- One bullet point per change, written in the present tense from the user's perspective
- When a change replaces earlier behavior, add a sentence on what it was before, as in "Previously, the card kept showing a loading preview"
- Every link in
contentmust be a full URL, since the/cloud/api/changelogendpoint serves these entries to other websites, where a relative path resolves to the wrong domain. Link to a cloud page withhttps://docs.medusajs.com/cloud/<path>, omitting thepage.mdxsuffix, such as[Environment Variables](https://docs.medusajs.com/cloud/environments/environment-variables). Links to other documentation projects are full URLs too contentis a template literal, so escape any backtick or${inside it- If an entry file for that date already exists, merge the bullet points into its
contentinstead of adding a second file - Never edit
generated/changelog/index.mjs. It's a manifest regenerated byyarn prepinwww/apps/cloud
Only functional and design changes belong in the changelog:
| Include | Exclude |
|---|---|
| New functionality, such as a new page, setting, or action | Copy changes, such as a renamed label or an added note |
| Changed behavior, such as a new default, validation, or limit | Visual polish that doesn't change behavior |
| New or removed form inputs, and why the input was added | Bug fixes with no user-visible change |
| Design and navigation changes, such as a new navigation style | Internal or performance work |
Webhooks Documentation
Cloud's webhook events are documented on two pages only:
| Page | File |
|---|---|
| Events reference | www/apps/cloud/app/webhooks/page.mdx |
| Changelog | www/apps/cloud/app/webhooks/changelog/page.mdx |
Never create a page per event. Every event is a section on the single reference page.
Reference Page Structure
import { Note, Table, TypeList } from "docs-ui"
export const metadata = {
title: `Webhooks`,
}
# {metadata.title}
## Webhooks Overview → what webhooks are, how Medusa delivers them
## Delivery Details → headers, signature verification, retries
## Webhook Events → summary table linking to every event's section
## Webhook <Resource> Events → one section per resource, holding its events
### <event name> → one subsection per event
Events are grouped by the resource they belong to, taken from the part of the event name before the dot. For example, build.created and build.updated both live under ## Build Events. Separate resource groups with --- dividers, but not the events within a group.
Each resource group follows this shape:
## Deployment Events
Medusa sends these events related to an environment's deployments, which happen after a build succeeds.
### deployment.created
Medusa sends this event when it creates a deployment for an environment.
<Note title="Changes">
- Medusa removed the `data.commit_sha` property on August 4, 2026.
</Note>
#### Payload
<TypeList
types={[
{
name: "deployment",
type: "`object`",
description: `The details of the deployment.`,
},
]}
sectionTitle="deployment.created"
/>
#### Example Payload
```json
{
"type": "deployment.created"
}
```
### deployment.updated
Medusa sends this event when a deployment finishes.
Rules:
- The
##group heading is the resource in title case, followed by "Events", such as## Build Events. It starts with one sentence covering the whole group - The
###heading is the event name exactly as delivered, in code-free plain text (### deployment.created, not### `deployment.created`), so anchors stay stable - Order groups alphabetically by their heading, and order events alphabetically within a group. The
## Eventstable follows the same order sectionTitleonTypeListmatches the event nameTypeListtypevalues are wrapped in backticks inside a double-quoted string (type: "`string`"), anddescriptionvalues use template literals- Nest object properties with the
childrenarray instead of flattening them intodata.xnames - The
## Eventstable lists every event, across all groups, with a link to its section anchor. Anchors strip dots, sodeployment.createdlinks to#deploymentcreated - When you remove the last event of a group, remove the group's
##heading and its intro too
Changelog Page
Webhook changes are dated, not versioned. Never write a version number on either page.
- Each entry uses a
## {Month} {Day}, {Year}heading, for example## August 4, 2026 - Entries are newest-first, directly below the intro
- Under each date, use a
### <event name>subsection with bullet points describing what changed - Use a
### Deliverysubsection for changes that aren't tied to a single event, such as header, signature, or retry changes - If an entry for that date already exists, merge into it instead of adding a duplicate
Inline Change Notes
When an event's payload changes, add a <Note title="Changes"> block after the section intro of that event, listing the change and the date it went live. Write these actively, since Vale flags passive voice:
- Medusa removed the `data.commit_sha` property on August 4, 2026.
- Medusa added the `data.build_id` property on August 4, 2026.
Keep previous entries in the note and add new bullet points at the top.
When to Update Cloud Docs
Update or create cloud docs when a dashboard change:
- Adds a new page, section, or setting visible to users
- Changes an existing form (new fields, renamed fields, removed options)
- Changes a navigation flow or UI structure
- Adds a new environment type, resource, or configuration option
- Changes billing plans, limits, or pricing visible to users
- Adds a new monitoring or notification option
Or when a CLI change adds, modifies, or removes commands, flags, or output formats (see the CLI Documentation section above).
Every dashboard change in that list also gets a changelog entry (see the Cloud Changelog section above).
Example Page
A minimal page adding a new "Custom Domains" feature:
import { Note } from "docs-ui"
export const metadata = {
title: `Custom Domains`,
}
# {metadata.title}
In this guide, you'll learn how to configure a custom domain for your Cloud project.
## What is a Custom Domain?
A custom domain lets you serve your Medusa application from your own domain name instead of the default Cloud subdomain.
---
## Add a Custom Domain
<Note>
Custom domains are available on the Pro plan and above. Learn more in the [Plans & Pricing](../pricing/page.mdx) guide.
</Note>
To add a custom domain to your project:
1. Navigate to your project's dashboard.
2. Click **Settings** in the sidebar.
3. Under the **Custom Domain** section, click **Add Domain**.
4. Enter your domain in the **Domain** field.
5. Click **Save**.
After saving, Cloud provides the DNS records you need to add with your domain registrar.
---
## Remove a Custom Domain
To remove a custom domain:
1. Navigate to your project's **Settings**.
2. Under **Custom Domain**, click the **Remove** button next to the domain.
3. Confirm the removal.