|
1
|
import { Table, Note, CodeTabs, CodeTab } from "docs-ui" |
|
2
|
|
|
3
|
export const metadata = { |
|
4
|
title: `projects Command - Medusa Cloud CLI Reference`, |
|
5
|
} |
|
6
|
|
|
7
|
# {metadata.title} |
|
8
|
|
|
9
|
In this guide, you'll learn how to manage your Cloud projects using the CLI. |
|
10
|
|
|
11
|
## projects list |
|
12
|
|
|
13
|
List all projects in an organization. If you don't specify an organization, either through the `--organization` flag or the [active context](../use/page.mdx), the command lists projects across all organizations you have access to, grouped by organization. |
|
14
|
|
|
15
|
<CodeTabs group="cli-auth"> |
|
16
|
<CodeTab label="With Flags" value="flags"> |
|
17
|
|
|
18
|
```bash |
|
19
|
mcloud projects list --organization org_123 |
|
20
|
``` |
|
21
|
|
|
22
|
</CodeTab> |
|
23
|
<CodeTab label="Using mcloud use" value="use"> |
|
24
|
|
|
25
|
```bash |
|
26
|
# Run once: mcloud use --organization org_123 |
|
27
|
|
|
28
|
mcloud projects list |
|
29
|
``` |
|
30
|
|
|
31
|
</CodeTab> |
|
32
|
</CodeTabs> |
|
33
|
|
|
34
|
### Options |
|
35
|
|
|
36
|
<Table> |
|
37
|
<Table.Header> |
|
38
|
<Table.Row> |
|
39
|
<Table.HeaderCell> |
|
40
|
Option |
|
41
|
</Table.HeaderCell> |
|
42
|
<Table.HeaderCell> |
|
43
|
Description |
|
44
|
</Table.HeaderCell> |
|
45
|
<Table.HeaderCell> |
|
46
|
Required |
|
47
|
</Table.HeaderCell> |
|
48
|
<Table.HeaderCell> |
|
49
|
Default |
|
50
|
</Table.HeaderCell> |
|
51
|
</Table.Row> |
|
52
|
</Table.Header> |
|
53
|
<Table.Body> |
|
54
|
<Table.Row> |
|
55
|
<Table.Cell> |
|
56
|
|
|
57
|
`-o <id>`, `--organization <id>` |
|
58
|
|
|
59
|
</Table.Cell> |
|
60
|
<Table.Cell> |
|
61
|
|
|
62
|
The [ID of the organization](../organizations/page.mdx#find-organization-id) to list projects from. If omitted, projects across all your organizations are listed. |
|
63
|
|
|
64
|
</Table.Cell> |
|
65
|
<Table.Cell> |
|
66
|
|
|
67
|
No |
|
68
|
|
|
69
|
</Table.Cell> |
|
70
|
<Table.Cell> |
|
71
|
|
|
72
|
Falls back to the organization in the [active context](../use/page.mdx#set-the-active-context), if set. Otherwise, lists projects across all your organizations. |
|
73
|
|
|
74
|
</Table.Cell> |
|
75
|
</Table.Row> |
|
76
|
<Table.Row> |
|
77
|
<Table.Cell> |
|
78
|
|
|
79
|
`--json` |
|
80
|
|
|
81
|
</Table.Cell> |
|
82
|
<Table.Cell> |
|
83
|
|
|
84
|
Print the result as JSON instead of formatted text. |
|
85
|
|
|
86
|
</Table.Cell> |
|
87
|
<Table.Cell> |
|
88
|
|
|
89
|
No |
|
90
|
|
|
91
|
</Table.Cell> |
|
92
|
<Table.Cell> |
|
93
|
|
|
94
|
`false` |
|
95
|
|
|
96
|
</Table.Cell> |
|
97
|
</Table.Row> |
|
98
|
</Table.Body> |
|
99
|
</Table> |
|
100
|
|
|
101
|
--- |
|
102
|
|
|
103
|
## projects get |
|
104
|
|
|
105
|
Retrieve a single project by its ID or handle. This is useful if you want to get more details about the project, such as its status or region. |
|
106
|
|
|
107
|
<CodeTabs group="cli-auth"> |
|
108
|
<CodeTab label="With Flags" value="flags"> |
|
109
|
|
|
110
|
```bash |
|
111
|
mcloud projects get <project> --organization org_123 |
|
112
|
``` |
|
113
|
|
|
114
|
</CodeTab> |
|
115
|
<CodeTab label="Using mcloud use" value="use"> |
|
116
|
|
|
117
|
```bash |
|
118
|
# Run once: mcloud use --organization org_123 |
|
119
|
|
|
120
|
mcloud projects get <project> |
|
121
|
``` |
|
122
|
|
|
123
|
</CodeTab> |
|
124
|
</CodeTabs> |
|
125
|
|
|
126
|
Returns the following information: |
|
127
|
|
|
128
|
<CodeTabs group="cli-output"> |
|
129
|
<CodeTab label="Plaintext" value="plaintext"> |
|
130
|
|
|
131
|
```bash |
|
132
|
Name: My Store |
|
133
|
Handle: <project-handle> |
|
134
|
Organization: My Organization (<organization-id>) |
|
135
|
Status: ready |
|
136
|
Region: us-east-1 |
|
137
|
Repository: myuser/my-repo |
|
138
|
Root path: /apps/backend |
|
139
|
Production Backend URL: https://trusting-soft-form.medusajs.app/app |
|
140
|
Production Storefront URL: https://acme.com |
|
141
|
Environments: Production (<environment-handle>) |
|
142
|
Staging (staging) |
|
143
|
Created at: Apr 1, 2026, 11:44 AM GMT+2 |
|
144
|
``` |
|
145
|
|
|
146
|
</CodeTab> |
|
147
|
<CodeTab label="JSON (--json)" value="json"> |
|
148
|
|
|
149
|
```json |
|
150
|
{ |
|
151
|
"id": "<project-id>", |
|
152
|
"name": "My Store", |
|
153
|
"handle": "<project-handle>", |
|
154
|
"organization": { |
|
155
|
"id": "<organization-id>", |
|
156
|
"name": "My Organization", |
|
157
|
"created_at": "2024-10-10T08:24:32.382Z" |
|
158
|
}, |
|
159
|
"region": "us-east-1", |
|
160
|
"repository": "myuser/my-repo", |
|
161
|
"root_path": "/apps/backend", |
|
162
|
"status": "ready", |
|
163
|
"created_at": "2024-10-10T08:24:32.382Z", |
|
164
|
"updated_at": "2024-10-11T08:24:32.382Z", |
|
165
|
"metadata": null, |
|
166
|
"builds": [], |
|
167
|
"environments": [ |
|
168
|
{ |
|
169
|
"id": "<environment-id>", |
|
170
|
"project_id": "<project-id>", |
|
171
|
"handle": "<environment-handle>", |
|
172
|
"name": "Production", |
|
173
|
"type": "production", |
|
174
|
"default_subdomain": "trusting-soft-form", |
|
175
|
"custom_subdomain": "acme", |
|
176
|
"default_domain": "trusting-soft-form.medusajs.app", |
|
177
|
"custom_domain": "acme.com", |
|
178
|
"created_at": "2024-10-10T08:24:32.382Z", |
|
179
|
"updated_at": "2024-10-10T08:24:32.382Z", |
|
180
|
"deleted_at": null, |
|
181
|
"external_id": "main", |
|
182
|
"status": "ready", |
|
183
|
"metadata": null, |
|
184
|
"builds": [], |
|
185
|
"deployments": [], |
|
186
|
"variables": [], |
|
187
|
"storefront_environments": [ |
|
188
|
{ |
|
189
|
"id": "<storefront-environment-id>", |
|
190
|
"subdomain": "trusting-soft-form-storefront", |
|
191
|
"custom_domain": "www.acme.com" |
|
192
|
} |
|
193
|
], |
|
194
|
"configuration": { |
|
195
|
"read_replica_database_url": "postgresql://<user>:<password>@<host>/<database>?channel_binding=require&sslmode=require", |
|
196
|
"tent_handle": "<tent-handle>", |
|
197
|
"s3_file_url": "https://s3.us-east-1.amazonaws.com/<bucket>", |
|
198
|
"s3_endpoint": "https://s3.us-east-1.amazonaws.com", |
|
199
|
"upstash_external_id": "<upstash-id>" |
|
200
|
}, |
|
201
|
"rules": null, |
|
202
|
"active_deployment": null |
|
203
|
} |
|
204
|
] |
|
205
|
} |
|
206
|
``` |
|
207
|
|
|
208
|
</CodeTab> |
|
209
|
</CodeTabs> |
|
210
|
|
|
211
|
### Arguments |
|
212
|
|
|
213
|
<Table> |
|
214
|
<Table.Header> |
|
215
|
<Table.Row> |
|
216
|
<Table.HeaderCell> |
|
217
|
Option |
|
218
|
</Table.HeaderCell> |
|
219
|
<Table.HeaderCell> |
|
220
|
Description |
|
221
|
</Table.HeaderCell> |
|
222
|
<Table.HeaderCell> |
|
223
|
Required |
|
224
|
</Table.HeaderCell> |
|
225
|
<Table.HeaderCell> |
|
226
|
Default |
|
227
|
</Table.HeaderCell> |
|
228
|
</Table.Row> |
|
229
|
</Table.Header> |
|
230
|
<Table.Body> |
|
231
|
<Table.Row> |
|
232
|
<Table.Cell> |
|
233
|
|
|
234
|
`project` |
|
235
|
|
|
236
|
</Table.Cell> |
|
237
|
<Table.Cell> |
|
238
|
|
|
239
|
The ID, handle, or name of the project to retrieve. |
|
240
|
|
|
241
|
</Table.Cell> |
|
242
|
<Table.Cell> |
|
243
|
|
|
244
|
No |
|
245
|
|
|
246
|
</Table.Cell> |
|
247
|
<Table.Cell> |
|
248
|
|
|
249
|
Falls back to the project in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
250
|
|
|
251
|
</Table.Cell> |
|
252
|
</Table.Row> |
|
253
|
</Table.Body> |
|
254
|
</Table> |
|
255
|
|
|
256
|
### Options |
|
257
|
|
|
258
|
<Table> |
|
259
|
<Table.Header> |
|
260
|
<Table.Row> |
|
261
|
<Table.HeaderCell> |
|
262
|
Option |
|
263
|
</Table.HeaderCell> |
|
264
|
<Table.HeaderCell> |
|
265
|
Description |
|
266
|
</Table.HeaderCell> |
|
267
|
<Table.HeaderCell> |
|
268
|
Required |
|
269
|
</Table.HeaderCell> |
|
270
|
<Table.HeaderCell> |
|
271
|
Default |
|
272
|
</Table.HeaderCell> |
|
273
|
</Table.Row> |
|
274
|
</Table.Header> |
|
275
|
<Table.Body> |
|
276
|
<Table.Row> |
|
277
|
<Table.Cell> |
|
278
|
|
|
279
|
`-p <id-handle-or-name>`, `--project <id-handle-or-name>` |
|
280
|
|
|
281
|
</Table.Cell> |
|
282
|
<Table.Cell> |
|
283
|
|
|
284
|
The ID, handle, or name of the project to retrieve. Interchangeable with the positional argument. |
|
285
|
|
|
286
|
</Table.Cell> |
|
287
|
<Table.Cell> |
|
288
|
|
|
289
|
No |
|
290
|
|
|
291
|
</Table.Cell> |
|
292
|
<Table.Cell> |
|
293
|
|
|
294
|
Falls back to the project in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
295
|
|
|
296
|
</Table.Cell> |
|
297
|
</Table.Row> |
|
298
|
<Table.Row> |
|
299
|
<Table.Cell> |
|
300
|
|
|
301
|
`-o <id>`, `--organization <id>` |
|
302
|
|
|
303
|
</Table.Cell> |
|
304
|
<Table.Cell> |
|
305
|
|
|
306
|
The [ID of the organization](../organizations/page.mdx#find-organization-id) to get the project from. |
|
307
|
|
|
308
|
</Table.Cell> |
|
309
|
<Table.Cell> |
|
310
|
|
|
311
|
Yes |
|
312
|
|
|
313
|
</Table.Cell> |
|
314
|
<Table.Cell> |
|
315
|
|
|
316
|
Falls back to the organization in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
317
|
|
|
318
|
</Table.Cell> |
|
319
|
</Table.Row> |
|
320
|
<Table.Row> |
|
321
|
<Table.Cell> |
|
322
|
|
|
323
|
`--json` |
|
324
|
|
|
325
|
</Table.Cell> |
|
326
|
<Table.Cell> |
|
327
|
|
|
328
|
Print the result as JSON instead of formatted text. |
|
329
|
|
|
330
|
</Table.Cell> |
|
331
|
<Table.Cell> |
|
332
|
|
|
333
|
No |
|
334
|
|
|
335
|
</Table.Cell> |
|
336
|
<Table.Cell> |
|
337
|
|
|
338
|
`false` |
|
339
|
|
|
340
|
</Table.Cell> |
|
341
|
</Table.Row> |
|
342
|
</Table.Body> |
|
343
|
</Table> |
|
344
|
|
|
345
|
--- |
|
346
|
|
|
347
|
## projects delete |
|
348
|
|
|
349
|
Delete a project by its ID or handle. |
|
350
|
|
|
351
|
<Note type="warning"> |
|
352
|
|
|
353
|
Deleting a project is irreversible and removes all associated environments, |
|
354
|
deployments, and resources. |
|
355
|
|
|
356
|
</Note> |
|
357
|
|
|
358
|
<CodeTabs group="cli-auth"> |
|
359
|
<CodeTab label="With Flags" value="flags"> |
|
360
|
|
|
361
|
```bash |
|
362
|
mcloud projects delete <project> --organization org_123 |
|
363
|
``` |
|
364
|
|
|
365
|
</CodeTab> |
|
366
|
<CodeTab label="Using mcloud use" value="use"> |
|
367
|
|
|
368
|
```bash |
|
369
|
# Run once: mcloud use --organization org_123 |
|
370
|
|
|
371
|
mcloud projects delete <project> |
|
372
|
``` |
|
373
|
|
|
374
|
</CodeTab> |
|
375
|
</CodeTabs> |
|
376
|
|
|
377
|
### Arguments |
|
378
|
|
|
379
|
<Table> |
|
380
|
<Table.Header> |
|
381
|
<Table.Row> |
|
382
|
<Table.HeaderCell> |
|
383
|
Option |
|
384
|
</Table.HeaderCell> |
|
385
|
<Table.HeaderCell> |
|
386
|
Description |
|
387
|
</Table.HeaderCell> |
|
388
|
<Table.HeaderCell> |
|
389
|
Required |
|
390
|
</Table.HeaderCell> |
|
391
|
<Table.HeaderCell> |
|
392
|
Default |
|
393
|
</Table.HeaderCell> |
|
394
|
</Table.Row> |
|
395
|
</Table.Header> |
|
396
|
<Table.Body> |
|
397
|
<Table.Row> |
|
398
|
<Table.Cell> |
|
399
|
|
|
400
|
`project` |
|
401
|
|
|
402
|
</Table.Cell> |
|
403
|
<Table.Cell> |
|
404
|
|
|
405
|
The ID, handle, or name of the project to delete. |
|
406
|
|
|
407
|
</Table.Cell> |
|
408
|
<Table.Cell> |
|
409
|
|
|
410
|
No |
|
411
|
|
|
412
|
</Table.Cell> |
|
413
|
<Table.Cell> |
|
414
|
|
|
415
|
Falls back to the project in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
416
|
|
|
417
|
</Table.Cell> |
|
418
|
</Table.Row> |
|
419
|
</Table.Body> |
|
420
|
</Table> |
|
421
|
|
|
422
|
### Options |
|
423
|
|
|
424
|
<Table> |
|
425
|
<Table.Header> |
|
426
|
<Table.Row> |
|
427
|
<Table.HeaderCell> |
|
428
|
Option |
|
429
|
</Table.HeaderCell> |
|
430
|
<Table.HeaderCell> |
|
431
|
Description |
|
432
|
</Table.HeaderCell> |
|
433
|
<Table.HeaderCell> |
|
434
|
Required |
|
435
|
</Table.HeaderCell> |
|
436
|
<Table.HeaderCell> |
|
437
|
Default |
|
438
|
</Table.HeaderCell> |
|
439
|
</Table.Row> |
|
440
|
</Table.Header> |
|
441
|
<Table.Body> |
|
442
|
<Table.Row> |
|
443
|
<Table.Cell> |
|
444
|
|
|
445
|
`-p <id-handle-or-name>`, `--project <id-handle-or-name>` |
|
446
|
|
|
447
|
</Table.Cell> |
|
448
|
<Table.Cell> |
|
449
|
|
|
450
|
The ID, handle, or name of the project to delete. Interchangeable with the positional argument. |
|
451
|
|
|
452
|
</Table.Cell> |
|
453
|
<Table.Cell> |
|
454
|
|
|
455
|
No |
|
456
|
|
|
457
|
</Table.Cell> |
|
458
|
<Table.Cell> |
|
459
|
|
|
460
|
Falls back to the project in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
461
|
|
|
462
|
</Table.Cell> |
|
463
|
</Table.Row> |
|
464
|
<Table.Row> |
|
465
|
<Table.Cell> |
|
466
|
|
|
467
|
`-o <id>`, `--organization <id>` |
|
468
|
|
|
469
|
</Table.Cell> |
|
470
|
<Table.Cell> |
|
471
|
|
|
472
|
The [ID of the organization](../organizations/page.mdx#find-organization-id) to get the project from. |
|
473
|
|
|
474
|
</Table.Cell> |
|
475
|
<Table.Cell> |
|
476
|
|
|
477
|
Yes |
|
478
|
|
|
479
|
</Table.Cell> |
|
480
|
<Table.Cell> |
|
481
|
|
|
482
|
Falls back to the organization in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
483
|
|
|
484
|
</Table.Cell> |
|
485
|
</Table.Row> |
|
486
|
<Table.Row> |
|
487
|
<Table.Cell> |
|
488
|
|
|
489
|
`-y`, `--yes` |
|
490
|
|
|
491
|
</Table.Cell> |
|
492
|
<Table.Cell> |
|
493
|
|
|
494
|
Skip the confirmation prompt. Use this in scripts and pipelines where |
|
495
|
interactive input is not possible. |
|
496
|
|
|
497
|
</Table.Cell> |
|
498
|
<Table.Cell> |
|
499
|
|
|
500
|
No |
|
501
|
|
|
502
|
</Table.Cell> |
|
503
|
<Table.Cell> |
|
504
|
|
|
505
|
`false` |
|
506
|
|
|
507
|
</Table.Cell> |
|
508
|
</Table.Row> |
|
509
|
<Table.Row> |
|
510
|
<Table.Cell> |
|
511
|
|
|
512
|
`--json` |
|
513
|
|
|
514
|
</Table.Cell> |
|
515
|
<Table.Cell> |
|
516
|
|
|
517
|
Print the result as JSON instead of formatted text. |
|
518
|
|
|
519
|
</Table.Cell> |
|
520
|
<Table.Cell> |
|
521
|
|
|
522
|
No |
|
523
|
|
|
524
|
</Table.Cell> |
|
525
|
<Table.Cell> |
|
526
|
|
|
527
|
`false` |
|
528
|
|
|
529
|
</Table.Cell> |
|
530
|
</Table.Row> |
|
531
|
</Table.Body> |
|
532
|
</Table> |
|
533
|
|
|
534
|
--- |
|
535
|
|
|
536
|
## Find Project IDs and Handles |
|
537
|
|
|
538
|
Commands that operate on projects require a project ID or handle. You can either: |
|
539
|
|
|
540
|
- Use the interactive selector in [mcloud use](../use/page.mdx#set-the-active-context) to set an active project for the current context. Once set, you can omit the `--project` flag from all subsequent commands; |
|
541
|
- Or use `projects list --json` to get machine-readable project data. Pipe the output to `jq` to extract IDs or handles for use in subsequent commands. This is useful if you want to set the active project through an AI agent, script, or CI/CD pipeline. |
|
542
|
|
|
543
|
For example, to set the first project in the list as the active project: |
|
544
|
|
|
545
|
<CodeTabs group="os"> |
|
546
|
<CodeTab label="macOS / Linux" value="unix"> |
|
547
|
|
|
548
|
```bash |
|
549
|
PROJECT_HANDLE=$( |
|
550
|
mcloud projects list --json \ |
|
551
|
| jq -r '.[0].handle' |
|
552
|
) |
|
553
|
mcloud use --project "$PROJECT_HANDLE" |
|
554
|
``` |
|
555
|
|
|
556
|
</CodeTab> |
|
557
|
<CodeTab label="Windows (PowerShell)" value="powershell"> |
|
558
|
|
|
559
|
```powershell |
|
560
|
$PROJECT_HANDLE = ( |
|
561
|
mcloud projects list --json | |
|
562
|
jq -r '.[0].handle' |
|
563
|
) |
|
564
|
mcloud use --project $PROJECT_HANDLE |
|
565
|
``` |
|
566
|
|
|
567
|
</CodeTab> |
|
568
|
</CodeTabs> |
|
569
|
|
|
570
|
To set a project by name as the active project: |
|
571
|
|
|
572
|
<CodeTabs group="os"> |
|
573
|
<CodeTab label="macOS / Linux" value="unix"> |
|
574
|
|
|
575
|
```bash |
|
576
|
PROJECT_HANDLE=$( |
|
577
|
mcloud projects list --json \ |
|
578
|
| jq -r '.[] | select(.name == "My Store") | .handle' |
|
579
|
) |
|
580
|
mcloud use --project "$PROJECT_HANDLE" |
|
581
|
``` |
|
582
|
|
|
583
|
</CodeTab> |
|
584
|
<CodeTab label="Windows (PowerShell)" value="powershell"> |
|
585
|
|
|
586
|
```powershell |
|
587
|
$PROJECT_HANDLE = ( |
|
588
|
mcloud projects list --json | |
|
589
|
jq -r '.[] | select(.name == "My Store") | .handle' |
|
590
|
) |
|
591
|
mcloud use --project $PROJECT_HANDLE |
|
592
|
``` |
|
593
|
|
|
594
|
</CodeTab> |
|
595
|
</CodeTabs> |
|
596
|
|
|
597
|
Once set, you can omit the `--project` flag from all subsequent commands. |
|
598
|
|
|
599
|
--- |
|
600
|
|
|
601
|
## Delete a Project Without Confirmation |
|
602
|
|
|
603
|
In automated cleanup scripts, use `--yes` to skip the interactive |
|
604
|
confirmation prompt: |
|
605
|
|
|
606
|
<Note type="warning"> |
|
607
|
|
|
608
|
Deleting a project is irreversible and removes all associated environments, |
|
609
|
deployments, and resources. |
|
610
|
|
|
611
|
</Note> |
|
612
|
|
|
613
|
```bash |
|
614
|
mcloud projects delete old-project --yes |
|
615
|
``` |