1 # Cloud Style Guide
2
3 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.
4
5 ## Constraints
6
7 - **Never touch `www/apps/cloud/generated/`** — auto-generated by `yarn prep`, will be overwritten. The one exception is `generated/changelog/{YYYY-MM-DD}.mjs`, the changelog entry files, which are written by hand; `generated/changelog/index.mjs` is still generated and off-limits.
8 - **Never invent Cloudinary screenshot URLs** — will be added manually later.
9 - **No YAML frontmatter** — cloud pages use only a `metadata` export (no `sidebar_label`, no `tags`).
10 - **Don't document internal platform details** — only user-visible behaviors, UI flows, and settings.
11
12 ## Audience
13
14 The cloud docs are for developers and technical users who deploy and manage Medusa applications on Cloud. Assume the reader:
15
16 - Is comfortable with Git, GitHub, and web development concepts
17 - Is not necessarily a Medusa expert — define Cloud-specific terms on first use
18 - Wants task-oriented guidance, not architecture explanations
19
20 ## Page Structure
21
22 Every cloud page follows this pattern:
23
24 ```mdx
25 import { Note } from "docs-ui"
26
27 export const metadata = {
28 title: `Page Title`,
29 }
30
31 # {metadata.title}
32
33 In this guide, you'll learn about <topic>.
34
35 ## Section One
36
37 [Content]
38
39 ---
40
41 ## Section Two
42
43 [Content]
44 ```
45
46 **Key rules:**
47
48 - `import` statements come before the `metadata` export
49 - Only import what is actually used on the page
50 - Opening paragraph states what the reader will learn — 1-2 sentences
51 - H2 sections are separated by `---` dividers
52 - No YAML frontmatter
53
54 ## Writing Style
55
56 - **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")
57 - **Second person**: "You create a project..." not "We create..." or "One can create..."
58 - **Task-based H2 titles**: "Create a Project", "Manage Environment Variables", "Delete an Environment"
59 - **Imperative numbered steps**: "Click **Save**", "Enter the environment name", "Select a region"
60 - **Present tense**: "The deployment appears in the list", not "The deployment will appear"
61 - **Bold UI elements**: buttons, labels, field names, section titles — `**Create Project**`, `**Save**`, `**Environment name**`
62 - **Contextual intro per section**: Each H2 section starts with 1–2 sentences explaining what the section covers before the numbered steps
63
64 ## Available Components
65
66 Import these from `docs-ui` as needed:
67
68 ### Note
69
70 Use for important notices, warnings, or tips:
71
72 ```mdx
73 import { Note } from "docs-ui"
74
75 <Note>
76
77 Content here. Can include links and formatting.
78
79 </Note>
80 ```
81
82 For warnings, add `type="warning"`:
83
84 ```mdx
85 <Note type="warning">
86
87 Deleting an environment is irreversible and will remove all associated resources.
88
89 </Note>
90 ```
91
92 ### InlineIcon
93
94 Use to reference a specific UI icon inline:
95
96 ```mdx
97 import { InlineIcon } from "docs-ui"
98 import { EllipsisHorizontal } from "@medusajs/icons"
99
100 Click the <InlineIcon Icon={EllipsisHorizontal} alt="three dots" /> icon next to the environment.
101 ```
102
103 Only use `InlineIcon` when a numbered step refers to an icon that has no visible text label.
104
105 ### Prerequisites
106
107 Use when prerequisites exist for a task:
108
109 ```mdx
110 import { Prerequisites } from "docs-ui"
111
112 <Prerequisites items={[
113 { title: "Create a project", link: "/projects" },
114 ]} />
115 ```
116
117 ### Table
118
119 Use for structured comparisons or multi-column data:
120
121 ```mdx
122 import { Table } from "docs-ui"
123
124 <Table>
125 <Table.Header>
126 <Table.Row>
127 <Table.HeaderCell>
128 Column
129 </Table.HeaderCell>
130 </Table.Row>
131 </Table.Header>
132 <Table.Body>
133 <Table.Row>
134 <Table.Cell>
135 Value
136 </Table.Cell>
137 </Table.Row>
138 </Table.Body>
139 </Table>
140 ```
141
142 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:
143
144 ```mdx
145 <Table.Cell>
146
147 [`deployment.created`](#deploymentcreated)
148
149 </Table.Cell>
150 ```
151
152 ## Cross-Project Links
153
154 Link to other cloud pages using relative paths:
155
156 ```mdx
157 [Environments](../environments/page.mdx)
158 [Projects](../projects/page.mdx)
159 ```
160
161 Link to other doc projects using the cross-project prefixes:
162
163 ```mdx
164 [text](!docs!/learn/path) → book
165 [text](!resources!/path) → resources
166 [text](!user-guide!/path) → user-guide
167 ```
168
169 ## Navigation (Sidebar)
170
171 The sidebar is in `www/apps/cloud/sidebar.mjs`. Add entries under the appropriate category:
172
173 ```javascript
174 {
175 type: "link",
176 path: "/<section>/<topic>",
177 title: "Page Title",
178 }
179 ```
180
181 For nested pages, add a `children` array to the parent:
182
183 ```javascript
184 {
185 type: "link",
186 title: "Environments",
187 path: "/environments",
188 children: [
189 {
190 type: "link",
191 title: "Long-Lived",
192 path: "/environments/long-lived",
193 },
194 ],
195 }
196 ```
197
198 > **Note:** Always add the page to the sidebar when creating a new page — otherwise it won't appear in navigation.
199
200 ## File Placement
201
202 Pages live at `www/apps/cloud/app/<path>/page.mdx`. Match the sidebar path exactly:
203
204 | Sidebar path | File path |
205 |---|---|
206 | `/projects` | `www/apps/cloud/app/projects/page.mdx` |
207 | `/environments/long-lived` | `www/apps/cloud/app/environments/long-lived/page.mdx` |
208 | `/billing/plans` | `www/apps/cloud/app/billing/plans/page.mdx` |
209
210 ## CLI Documentation
211
212 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`.
213
214 ### CLI Page Structure
215
216 Each command page documents all subcommands for that topic. For example, the `deployments` page covers `deployments list`, `deployments get`, and `deployments build-logs`.
217
218 ```mdx
219 import { Table, CodeTabs, CodeTab } from "docs-ui"
220
221 export const metadata = {
222 title: `<topic> Command - Medusa Cloud CLI Reference`,
223 }
224
225 # {metadata.title}
226
227 In this guide, you'll learn how to <what the commands do>.
228
229 ## <topic> <subcommand>
230
231 Description of what the subcommand does.
232
233 <CodeTabs group="cli-auth">
234 <CodeTab label="With Flags" value="flags">
235
236 ```bash
237 mcloud <topic> <subcommand> --organization org_123 --project proj_123
238 ```
239
240 </CodeTab>
241 <CodeTab label="Using mcloud use" value="use">
242
243 ```bash
244 # Run once: mcloud use --organization org_123 --project proj_123
245
246 mcloud <topic> <subcommand>
247 ```
248
249 </CodeTab>
250 </CodeTabs>
251
252 ### Options
253
254 <Table>
255 <Table.Header>
256 <Table.Row>
257 <Table.HeaderCell>Option</Table.HeaderCell>
258 <Table.HeaderCell>Description</Table.HeaderCell>
259 <Table.HeaderCell>Required</Table.HeaderCell>
260 <Table.HeaderCell>Default</Table.HeaderCell>
261 </Table.Row>
262 </Table.Header>
263 <Table.Body>
264 <Table.Row>
265 <Table.Cell>`-o <id>`, `--organization <id>`</Table.Cell>
266 <Table.Cell>The organization ID.</Table.Cell>
267 <Table.Cell>Yes</Table.Cell>
268 <Table.Cell>Falls back to the [active context](../use/page.mdx).</Table.Cell>
269 </Table.Row>
270 </Table.Body>
271 </Table>
272 ```
273
274 ### CLI Writing Rules
275
276 - **Command syntax**: Always show the full command (e.g. `mcloud deployments list`), not just the subcommand
277 - **Flag format**: Show both short and long forms where available (e.g. `` `-o <id>`, `--organization <id>` ``)
278 - **CodeTabs for auth**: Use `<CodeTabs group="cli-auth">` with "With Flags" and "Using mcloud use" tabs to show both explicit and context-based usage
279 - **Arguments section**: Add an Arguments table (Option, Description, Required) for positional arguments
280 - **Options section**: Use a four-column Table (Option, Description, Required, Default)
281 - **Subcommand separation**: Separate subcommand sections with `---` dividers
282 - **Cross-references**: Link to related command pages using relative paths (e.g. `[active context](../use/page.mdx)`)
283 - **JSON flag**: If a command supports `--json`, include it in the Options table
284 - **New commands**: When adding a command page, also add it to the CLI category in `www/apps/cloud/sidebar.mjs`
285
286 ### When to Update CLI Docs
287
288 Update CLI docs when a Cloud CLI change:
289
290 - Adds a new command or subcommand
291 - Removes an existing command or subcommand
292 - Adds, changes, or removes a flag or positional argument
293 - Changes a command's description or help text
294 - Changes the output format (table columns, JSON structure)
295 - Changes shared flags that affect multiple commands
296
297 Do not update CLI docs for internal refactors that don't change the CLI's external behavior.
298
299 ---
300
301 ## Cloud Changelog
302
303 Cloud has three separate changelogs, and each change belongs to exactly one of them:
304
305 | Changelog | File | Covers |
306 |---|---|---|
307 | Cloud | `www/apps/cloud/generated/changelog/{YYYY-MM-DD}.mjs` | Dashboard changes |
308 | Cloud CLI | `www/apps/cloud/app/cli/changelog/page.mdx` | `mcloud` releases |
309 | Webhooks | `www/apps/cloud/app/webhooks/changelog/page.mdx` | Webhook event changes |
310
311 The Cloud changelog links to the other two at the top of the page, and never repeats their entries.
312
313 Dashboard changes are **dated, not versioned**, since the dashboard has no user-facing version number.
314
315 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:
316
317 ```js
318 /** @type {import("../../utils/changelog").ChangelogEntry} */
319 export default {
320 date: "2026-08-10",
321 title: "Build-time environment variables and provisioning failures",
322 summary:
323 "Environment variables can be scoped to build time or runtime, and environment cards report failed provisioning.",
324 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.
325 - An environment's card now shows a **Provisioning failed** state. The card previously kept showing a loading preview.`,
326 }
327 ```
328
329 - The file name is the entry's date, `{YYYY-MM-DD}.mjs`, and `date` matches it exactly
330 - `title` is 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 bullets
331 - `summary` is **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/changelog` endpoint. When merging into an existing entry, rewrite the summary to cover the merged bullets
332 - Never write an `image` property. 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
333 - `content` holds **only** the bullet points. The heading is rendered from `title`, so never write a `##` line in the content
334 - One bullet point per change, written in the present tense from the user's perspective
335 - When a change replaces earlier behavior, add a sentence on what it was before, as in "Previously, the card kept showing a loading preview"
336 - Every link in `content` must be a **full URL**, since the `/cloud/api/changelog` endpoint serves these entries to other websites, where a relative path resolves to the wrong domain. Link to a cloud page with `https://docs.medusajs.com/cloud/<path>`, omitting the `page.mdx` suffix, such as `[Environment Variables](https://docs.medusajs.com/cloud/environments/environment-variables)`. Links to other documentation projects are full URLs too
337 - `content` is a template literal, so escape any backtick or `${` inside it
338 - If an entry file for that date already exists, merge the bullet points into its `content` instead of adding a second file
339 - Never edit `generated/changelog/index.mjs`. It's a manifest regenerated by `yarn prep` in `www/apps/cloud`
340
341 Only functional and design changes belong in the changelog:
342
343 | Include | Exclude |
344 |---|---|
345 | New functionality, such as a new page, setting, or action | Copy changes, such as a renamed label or an added note |
346 | Changed behavior, such as a new default, validation, or limit | Visual polish that doesn't change behavior |
347 | New or removed form inputs, and why the input was added | Bug fixes with no user-visible change |
348 | Design and navigation changes, such as a new navigation style | Internal or performance work |
349
350 ---
351
352 ## Webhooks Documentation
353
354 Cloud's webhook events are documented on **two pages only**:
355
356 | Page | File |
357 |---|---|
358 | Events reference | `www/apps/cloud/app/webhooks/page.mdx` |
359 | Changelog | `www/apps/cloud/app/webhooks/changelog/page.mdx` |
360
361 Never create a page per event. Every event is a section on the single reference page.
362
363 ### Reference Page Structure
364
365 ```mdx
366 import { Note, Table, TypeList } from "docs-ui"
367
368 export const metadata = {
369 title: `Webhooks`,
370 }
371
372 # {metadata.title}
373
374 ## Webhooks Overview → what webhooks are, how Medusa delivers them
375 ## Delivery Details → headers, signature verification, retries
376 ## Webhook Events → summary table linking to every event's section
377 ## Webhook <Resource> Events → one section per resource, holding its events
378 ### <event name> → one subsection per event
379 ```
380
381 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.
382
383 Each resource group follows this shape:
384
385 ````mdx
386 ## Deployment Events
387
388 Medusa sends these events related to an environment's deployments, which happen after a build succeeds.
389
390 ### deployment.created
391
392 Medusa sends this event when it creates a deployment for an environment.
393
394 <Note title="Changes">
395
396 - Medusa removed the `data.commit_sha` property on August 4, 2026.
397
398 </Note>
399
400 #### Payload
401
402 <TypeList
403 types={[
404 {
405 name: "deployment",
406 type: "`object`",
407 description: `The details of the deployment.`,
408 },
409 ]}
410 sectionTitle="deployment.created"
411 />
412
413 #### Example Payload
414
415 ```json
416 {
417 "type": "deployment.created"
418 }
419 ```
420
421 ### deployment.updated
422
423 Medusa sends this event when a deployment finishes.
424 ````
425
426 **Rules:**
427
428 - 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
429 - The `###` heading is the event name exactly as delivered, in code-free plain text (`### deployment.created`, not `` ### `deployment.created` ``), so anchors stay stable
430 - Order groups alphabetically by their heading, and order events alphabetically within a group. The `## Events` table follows the same order
431 - `sectionTitle` on `TypeList` matches the event name
432 - `TypeList` `type` values are wrapped in backticks inside a double-quoted string (`` type: "`string`" ``), and `description` values use template literals
433 - Nest object properties with the `children` array instead of flattening them into `data.x` names
434 - The `## Events` table lists every event, across all groups, with a link to its section anchor. Anchors strip dots, so `deployment.created` links to `#deploymentcreated`
435 - When you remove the last event of a group, remove the group's `##` heading and its intro too
436
437 ### Changelog Page
438
439 Webhook changes are **dated, not versioned**. Never write a version number on either page.
440
441 - Each entry uses a `## {Month} {Day}, {Year}` heading, for example `## August 4, 2026`
442 - Entries are newest-first, directly below the intro
443 - Under each date, use a `### <event name>` subsection with bullet points describing what changed
444 - Use a `### Delivery` subsection for changes that aren't tied to a single event, such as header, signature, or retry changes
445 - If an entry for that date already exists, merge into it instead of adding a duplicate
446
447 ### Inline Change Notes
448
449 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:
450
451 ```mdx
452 - Medusa removed the `data.commit_sha` property on August 4, 2026.
453 - Medusa added the `data.build_id` property on August 4, 2026.
454 ```
455
456 Keep previous entries in the note and add new bullet points at the top.
457
458 ---
459
460 ## When to Update Cloud Docs
461
462 Update or create cloud docs when a dashboard change:
463
464 - Adds a new page, section, or setting visible to users
465 - Changes an existing form (new fields, renamed fields, removed options)
466 - Changes a navigation flow or UI structure
467 - Adds a new environment type, resource, or configuration option
468 - Changes billing plans, limits, or pricing visible to users
469 - Adds a new monitoring or notification option
470
471 Or when a CLI change adds, modifies, or removes commands, flags, or output formats (see the [CLI Documentation](#cli-documentation) section above).
472
473 Every dashboard change in that list also gets a changelog entry (see the [Cloud Changelog](#cloud-changelog) section above).
474
475 ## Example Page
476
477 A minimal page adding a new "Custom Domains" feature:
478
479 ```mdx
480 import { Note } from "docs-ui"
481
482 export const metadata = {
483 title: `Custom Domains`,
484 }
485
486 # {metadata.title}
487
488 In this guide, you'll learn how to configure a custom domain for your Cloud project.
489
490 ## What is a Custom Domain?
491
492 A custom domain lets you serve your Medusa application from your own domain name instead of the default Cloud subdomain.
493
494 ---
495
496 ## Add a Custom Domain
497
498 <Note>
499
500 Custom domains are available on the Pro plan and above. Learn more in the [Plans & Pricing](../pricing/page.mdx) guide.
501
502 </Note>
503
504 To add a custom domain to your project:
505
506 1. Navigate to your project's dashboard.
507 2. Click **Settings** in the sidebar.
508 3. Under the **Custom Domain** section, click **Add Domain**.
509 4. Enter your domain in the **Domain** field.
510 5. Click **Save**.
511
512 After saving, Cloud provides the DNS records you need to add with your domain registrar.
513
514 ---
515
516 ## Remove a Custom Domain
517
518 To remove a custom domain:
519
520 1. Navigate to your project's **Settings**.
521 2. Under **Custom Domain**, click the **Remove** button next to the domain.
522 3. Confirm the removal.
523
524 ```