@nocobase/cli 2.1.0-beta.15 → 2.1.0-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/LICENSE.txt +107 -0
  2. package/README.md +307 -63
  3. package/README.zh-CN.md +332 -0
  4. package/bin/run.cmd +3 -0
  5. package/bin/run.js +114 -0
  6. package/dist/commands/api/resource/create.js +15 -0
  7. package/dist/commands/api/resource/destroy.js +15 -0
  8. package/dist/commands/api/resource/get.js +15 -0
  9. package/dist/commands/api/resource/index.js +20 -0
  10. package/dist/commands/api/resource/list.js +16 -0
  11. package/dist/commands/api/resource/query.js +15 -0
  12. package/dist/commands/api/resource/update.js +15 -0
  13. package/dist/commands/build.js +57 -0
  14. package/dist/commands/db/logs.js +85 -0
  15. package/dist/commands/db/ps.js +60 -0
  16. package/dist/commands/db/shared.js +81 -0
  17. package/dist/commands/db/start.js +70 -0
  18. package/dist/commands/db/stop.js +70 -0
  19. package/dist/commands/dev.js +149 -0
  20. package/dist/commands/down.js +193 -0
  21. package/dist/commands/download.js +779 -0
  22. package/dist/commands/env/add.js +327 -0
  23. package/dist/commands/env/auth.js +62 -0
  24. package/dist/commands/env/list.js +41 -0
  25. package/dist/commands/env/remove.js +65 -0
  26. package/dist/commands/env/update.js +73 -0
  27. package/dist/commands/env/use.js +36 -0
  28. package/dist/commands/init.js +813 -0
  29. package/dist/commands/install.js +1850 -0
  30. package/dist/commands/logs.js +90 -0
  31. package/dist/commands/pm/disable.js +63 -0
  32. package/dist/commands/pm/enable.js +63 -0
  33. package/dist/commands/pm/list.js +54 -0
  34. package/dist/commands/prompts-stages.js +150 -0
  35. package/dist/commands/prompts-test.js +181 -0
  36. package/dist/commands/ps.js +116 -0
  37. package/dist/commands/scaffold/migration.js +38 -0
  38. package/dist/commands/scaffold/plugin.js +37 -0
  39. package/dist/commands/start.js +211 -0
  40. package/dist/commands/stop.js +90 -0
  41. package/dist/commands/upgrade.js +583 -0
  42. package/dist/generated/command-registry.js +133 -0
  43. package/dist/help/runtime-help.js +20 -0
  44. package/dist/lib/api-client.js +243 -0
  45. package/dist/lib/app-runtime.js +142 -0
  46. package/dist/lib/auth-store.js +241 -0
  47. package/dist/lib/bootstrap.js +387 -0
  48. package/dist/lib/build-config.js +10 -0
  49. package/dist/lib/cli-home.js +30 -0
  50. package/dist/lib/cli-locale.js +115 -0
  51. package/dist/lib/command-discovery.js +39 -0
  52. package/dist/lib/env-auth.js +872 -0
  53. package/dist/lib/generated-command.js +142 -0
  54. package/dist/lib/naming.js +70 -0
  55. package/dist/lib/openapi.js +62 -0
  56. package/dist/lib/post-processors.js +23 -0
  57. package/dist/lib/prompt-catalog.js +574 -0
  58. package/dist/lib/prompt-validators.js +185 -0
  59. package/dist/lib/prompt-web-ui.js +2061 -0
  60. package/dist/lib/resource-command.js +335 -0
  61. package/dist/lib/resource-request.js +104 -0
  62. package/dist/lib/run-npm.js +123 -0
  63. package/dist/lib/runtime-generator.js +419 -0
  64. package/dist/lib/runtime-store.js +56 -0
  65. package/dist/lib/ui.js +175 -0
  66. package/dist/locale/en-US.json +319 -0
  67. package/dist/locale/zh-CN.json +319 -0
  68. package/dist/post-processors/data-modeling.js +66 -0
  69. package/dist/post-processors/data-source-manager.js +114 -0
  70. package/dist/post-processors/index.js +19 -0
  71. package/nocobase-ctl.config.json +287 -0
  72. package/package.json +53 -25
  73. package/LICENSE +0 -201
  74. package/bin/index.js +0 -39
  75. package/nocobase.conf.tpl +0 -95
  76. package/src/cli.js +0 -19
  77. package/src/commands/benchmark.js +0 -73
  78. package/src/commands/build.js +0 -49
  79. package/src/commands/clean.js +0 -30
  80. package/src/commands/client.js +0 -166
  81. package/src/commands/create-nginx-conf.js +0 -37
  82. package/src/commands/create-plugin.js +0 -33
  83. package/src/commands/dev.js +0 -200
  84. package/src/commands/doc.js +0 -76
  85. package/src/commands/e2e.js +0 -265
  86. package/src/commands/global.js +0 -43
  87. package/src/commands/index.js +0 -45
  88. package/src/commands/instance-id.js +0 -47
  89. package/src/commands/locale/cronstrue.js +0 -122
  90. package/src/commands/locale/react-js-cron/en-US.json +0 -75
  91. package/src/commands/locale/react-js-cron/index.js +0 -17
  92. package/src/commands/locale/react-js-cron/zh-CN.json +0 -33
  93. package/src/commands/locale/react-js-cron/zh-TW.json +0 -33
  94. package/src/commands/locale.js +0 -81
  95. package/src/commands/p-test.js +0 -88
  96. package/src/commands/perf.js +0 -63
  97. package/src/commands/pkg.js +0 -321
  98. package/src/commands/pm2.js +0 -37
  99. package/src/commands/postinstall.js +0 -88
  100. package/src/commands/start.js +0 -148
  101. package/src/commands/tar.js +0 -36
  102. package/src/commands/test-coverage.js +0 -55
  103. package/src/commands/test.js +0 -107
  104. package/src/commands/umi.js +0 -33
  105. package/src/commands/update-deps.js +0 -72
  106. package/src/commands/upgrade.js +0 -47
  107. package/src/commands/view-license-key.js +0 -44
  108. package/src/index.js +0 -14
  109. package/src/license.js +0 -76
  110. package/src/logger.js +0 -75
  111. package/src/plugin-generator.js +0 -80
  112. package/src/util.js +0 -517
  113. package/templates/bundle-status.html +0 -338
  114. package/templates/create-app-package.json +0 -39
  115. package/templates/plugin/.npmignore.tpl +0 -2
  116. package/templates/plugin/README.md.tpl +0 -1
  117. package/templates/plugin/client.d.ts +0 -2
  118. package/templates/plugin/client.js +0 -1
  119. package/templates/plugin/package.json.tpl +0 -11
  120. package/templates/plugin/server.d.ts +0 -2
  121. package/templates/plugin/server.js +0 -1
  122. package/templates/plugin/src/client/client.d.ts +0 -249
  123. package/templates/plugin/src/client/index.tsx.tpl +0 -1
  124. package/templates/plugin/src/client/locale.ts +0 -21
  125. package/templates/plugin/src/client/models/index.ts +0 -12
  126. package/templates/plugin/src/client/plugin.tsx.tpl +0 -10
  127. package/templates/plugin/src/index.ts +0 -2
  128. package/templates/plugin/src/locale/en-US.json +0 -1
  129. package/templates/plugin/src/locale/zh-CN.json +0 -1
  130. package/templates/plugin/src/server/collections/.gitkeep +0 -0
  131. package/templates/plugin/src/server/index.ts.tpl +0 -1
  132. package/templates/plugin/src/server/plugin.ts.tpl +0 -19
package/LICENSE.txt ADDED
@@ -0,0 +1,107 @@
1
+ Updated Date: February 24, 2026
2
+
3
+ NocoBase License Agreement
4
+
5
+ NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at 112 ROBINSON ROAD, #03-01, SINGAPORE ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("The User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
6
+
7
+ This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
8
+
9
+ The Company reserves the right to formulate and modify this Agreement from time to time as needed. If there are changes, the Company will announce them in the form of website announcements, without further individual notification. The changed Agreement will automatically take effect once it is announced, becoming part of this Agreement.
10
+
11
+ ==============
12
+ 1. Definitions
13
+ ==============
14
+
15
+ 1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
16
+
17
+ 1.2 "Community Edition" refers to the free version of the Software provided to the User through public channels.
18
+
19
+ 1.3 "Commercial Edition" refers to the paid version of the Software purchased by the User from the Company or its agents, downloaded through exclusive channels, and includes additional benefits. It consists of three versions: Standard Edition, Professional Edition, and Enterprise Edition.
20
+
21
+ 1.4 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
22
+
23
+ 1.5 "Customer" refers to the clients who purchase the User's Upper Layer Application.
24
+
25
+ 1.6 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
26
+
27
+ ===================================
28
+ 2. Intellectual Property Protection
29
+ ===================================
30
+
31
+ Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
32
+
33
+ =============
34
+ 3. Disclaimer
35
+ =============
36
+
37
+ 3.1 The User shall not use the Software and Commercial Plugins to engage in activities that contravene applicable laws and regulations or offend against public order or religious prohibitions. All legal liabilities and consequences arising from the User’s use shall be borne by the User.
38
+
39
+ 3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software and Commercial Plugins, even if it has been previously informed of the possibility of such damages.
40
+
41
+ ===============
42
+ 4. License Type
43
+ ===============
44
+
45
+ 4.1 This Agreement serves as the unified license agreement for NocoBase Software, applying to both the Community Edition and the Commercial Editions.
46
+
47
+ 4.2 This Agreement incorporates and references the full text of the Apache License, Version 2.0 ("Apache-2.0", available at: https://www.apache.org/licenses/LICENSE-2.0 ). Users must comply with the Apache-2.0 License as well as the supplementary terms set forth in this Agreement. In case of any inconsistency between Apache-2.0 and this Agreement, the supplementary terms of this Agreement shall prevail.
48
+
49
+ ================================================
50
+ 5. Rights and Obligations of Open Source License
51
+ ================================================
52
+
53
+ 5.1 The Software can be used for commercial purposes.
54
+
55
+ 5.2 It is not allowed to remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface, except for the main LOGO in the upper left corner of the page.
56
+
57
+ 5.3 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
58
+
59
+ 5.4 It is not allowed to provide to the public any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products using the original or modified Software.
60
+
61
+ ===============================
62
+ 6. Rights of Commercial License
63
+ ===============================
64
+
65
+ 6.1 Obtain a permanent commercial license of the Software.
66
+
67
+ 6.2 Get software upgrades and exclusive technical support during the upgrade validity period.
68
+
69
+ 6.3 The licensed Software can be used for commercial purposes with no restrictions on the number of applications and users.
70
+
71
+ 6.4 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
72
+
73
+ 6.5 The User holding a Professional or Enterprise Edition License can sell Upper Layer Application to its Customers.
74
+
75
+ 6.6 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
76
+
77
+ ====================================
78
+ 7. Obligations of Commercial License
79
+ ====================================
80
+
81
+ 7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
82
+
83
+ 7.2 It is not allowed to sell, transfer, lease, share, gift, or distribute the Commercial License.
84
+
85
+ 7.3 It is not allowed to sell, transfer, lease, share, or distribute any form of no-code, zero-code, low-code, AI platform, or developer tools developed based on Software.
86
+
87
+ 7.4 It is not allowed to provide any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products to the public using the original or modified Software.
88
+
89
+ 7.5 It is not allowed for the User holding a Standard Edition license to sell Upper Layer Application to Customers without a Commercial license.
90
+
91
+ 7.6 It is not allowed for the User holding a Professional or Enterprise Edition license to sell Upper Layer Application to Customers without a Commercial license with access to further development and configuration.
92
+
93
+ 7.7 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
94
+
95
+ 7.8 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
96
+
97
+ =============================================================
98
+ 8. Legal Jurisdiction, Interpretation, and Dispute Resolution
99
+ =============================================================
100
+
101
+ 8.1 Except for Mainland China, the interpretation, application, and all matters related to this agreement are subject to the jurisdiction of Singapore law.
102
+
103
+ 8.2 Any dispute related to this Agreement should first be resolved through friendly negotiation. If the negotiation fails to resolve the dispute, the dispute should be submitted to the International Chamber of Commerce (ICC) for arbitration. The arbitration venue should be Singapore, conducted in English.
104
+
105
+ 8.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
106
+
107
+ 8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
package/README.md CHANGED
@@ -1,99 +1,343 @@
1
- # NocoBase
1
+ # NocoBase CLI
2
2
 
3
- <video width="100%" controls>
4
- <source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
5
- </video>
3
+ NocoBase CLI (`nb`) is a command-line tool for setting up and managing NocoBase
4
+ apps in a local workspace. It helps you connect coding agents to NocoBase by
5
+ preparing the app, saving the CLI env config, and providing day-to-day commands
6
+ for start, stop, logs, upgrade, and cleanup.
6
7
 
7
- <p align="center">
8
- <a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
9
- <a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability&#0045;first&#0044;&#0032;open&#0045;source&#0032;no&#0045;code&#0032;platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
10
- </p>
8
+ The CLI supports two common setup paths:
11
9
 
12
- ## What is NocoBase
10
+ - Connect an existing NocoBase app so coding agents can use it.
11
+ - Install a new NocoBase app from Docker, npm, or Git, then connect it as a CLI env.
13
12
 
14
- NocoBase is the most extensible AI-powered no-code platform.
15
- Total control. Infinite extensibility. AI collaboration.
16
- Enable your team to adapt quickly and cut costs dramatically.
17
- No years of development. No millions wasted.
18
- Deploy NocoBase in minutes — and take control of everything.
13
+ ## Prerequisites
19
14
 
20
- Homepage:
21
- https://www.nocobase.com/
15
+ - Node.js v20+
16
+ - Yarn 1.x
17
+ - Git, required when installing from Git source
18
+ - Docker, required when installing with Docker or using the built-in database
22
19
 
23
- Online Demo:
24
- https://demo.nocobase.com/new
20
+ ## Installation
25
21
 
26
- Documents:
27
- https://docs.nocobase.com/
22
+ Install the CLI globally:
28
23
 
29
- Forum:
30
- https://forum.nocobase.com/
24
+ ```bash
25
+ npm install -g @nocobase/cli@alpha
26
+ ```
31
27
 
32
- Use Cases:
33
- https://www.nocobase.com/en/blog/tags/customer-stories
28
+ Check the available commands:
34
29
 
35
- ## Release Notes
30
+ ```bash
31
+ nb --help
32
+ nb init --help
33
+ ```
36
34
 
37
- Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
35
+ ## Core Concepts
38
36
 
39
- ## Distinctive features
37
+ - **Workspace**: the current project folder where `.nocobase` is stored.
38
+ - **Env**: a named NocoBase connection saved by the CLI. In `nb init`, the app name is also the env name.
39
+ - **Source**: how the local app is obtained. Supported values are `docker`, `npm`, and `git`.
40
+ - **Remote env**: an env that only stores an API connection to an existing NocoBase app.
41
+ - **Runtime resources**: local app process, Docker app container, built-in database container, source directory, and storage directory managed by CLI commands.
40
42
 
41
- ### 1. Data model-driven, not form/table–driven
43
+ ## Quick Start
42
44
 
43
- Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
45
+ ### Guided Setup
44
46
 
45
- - UI and data structure are fully decoupled
46
- - Multiple blocks and actions can be created for the same table or record in any quantity or form
47
- - Supports the main database, external databases, and third-party APIs as data sources
47
+ Run the guided terminal flow:
48
48
 
49
- ![model](https://static-docs.nocobase.com/model.png)
49
+ ```bash
50
+ nb init
51
+ ```
50
52
 
51
- ### 2. AI employees, integrated into your business systems
52
- Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
53
+ Use the browser-based setup form:
53
54
 
54
- - Define AI employees for roles such as translator, analyst, researcher, or assistant
55
- - Seamless AI–human collaboration in interfaces and workflows
56
- - Ensure AI usage is secure, transparent, and customizable for your business needs
55
+ ```bash
56
+ nb init --ui
57
+ ```
57
58
 
58
- ![AI-employee](https://static-docs.nocobase.com/ai-employee-home.png)
59
+ `nb init` can either connect to an existing NocoBase app or install a new one.
60
+ When creating a new app, it can also install NocoBase AI coding skills
61
+ (`nocobase/skills`) for the current workspace.
59
62
 
60
- ### 3. What you see is what you get, incredibly easy to use
63
+ ### Non-Interactive Setup
61
64
 
62
- While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
65
+ When prompts are skipped, an app/env name is required:
63
66
 
64
- - One-click switch between usage mode and configuration mode
65
- - Pages serve as a canvas to arrange blocks and actions, similar to Notion
66
- - Configuration mode is designed for ordinary users, not just programmers
67
+ ```bash
68
+ nb init --env app1 --yes
69
+ ```
67
70
 
68
- ![wysiwyg](https://static-docs.nocobase.com/wysiwyg.gif)
71
+ Install with Docker:
69
72
 
70
- ### 4. Everything is a plugin, designed for extension
71
- Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
73
+ ```bash
74
+ nb init --env app1 --yes --source docker --version alpha
75
+ ```
72
76
 
73
- - All functionalities are plugins, similar to WordPress
74
- - Plugins are ready to use upon installation
75
- - Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
77
+ Install from npm:
76
78
 
77
- ![plugins](https://static-docs.nocobase.com/plugins.png)
79
+ ```bash
80
+ nb init --env app1 --yes --source npm --version alpha --app-port 13080
81
+ ```
78
82
 
79
- ## Installation
83
+ Install from Git source:
84
+
85
+ ```bash
86
+ nb init --env app1 --yes --source git --version alpha
87
+ ```
88
+
89
+ For Git source installs, `--version alpha` resolves to the `develop` branch.
90
+
91
+ Install from a Git branch:
92
+
93
+ ```bash
94
+ nb init --env app1 --yes --source git --version fix/cli-v2
95
+ ```
96
+
97
+ `--version` is the shared version input across sources:
98
+
99
+ - npm: package version
100
+ - Docker: image tag
101
+ - Git: git ref such as a branch or tag
102
+
103
+ By default, a new local app uses:
104
+
105
+ - Source directory: `./<envName>/source/`
106
+ - Storage directory: `./<envName>/storage/`
107
+
108
+ ### Resume an Interrupted Setup
109
+
110
+ If `nb init` was interrupted after the env config had already been saved, you can continue the same setup:
111
+
112
+ ```bash
113
+ nb init --env app1 --resume
114
+ ```
115
+
116
+ The advanced low-level equivalent is:
117
+
118
+ ```bash
119
+ nb install --env app1 --resume
120
+ ```
121
+
122
+ `--resume` reuses the saved workspace env config for app, source, database, and env connection settings. In interactive mode, it only asks for any missing setup-only values.
123
+
124
+ In non-interactive mode, pass these setup-only flags again because they are not saved in env config:
125
+
126
+ - `--lang`
127
+ - `--root-username`
128
+ - `--root-email`
129
+ - `--root-password`
130
+ - `--root-nickname`
131
+
132
+ ## Daily Commands
133
+
134
+ | Command | Description |
135
+ | --- | --- |
136
+ | `nb init` | Set up NocoBase and connect it as a CLI env for coding agents. |
137
+ | `nb install` | Advanced command used by `nb init` to install a local NocoBase app and save env config. In most cases, use `nb init` instead. |
138
+ | `nb download` | Advanced command used by `nb init` or `nb upgrade` to fetch NocoBase from Docker, npm, or Git. It is rarely used directly. |
139
+ | `nb start` | Start the selected local app or Docker container. |
140
+ | `nb stop` | Stop the selected local app or Docker container. |
141
+ | `nb dev` | Run development mode for npm/Git source envs. |
142
+ | `nb logs` | Show app logs for npm/Git or Docker envs. |
143
+ | `nb ps` | Show runtime status for configured envs. |
144
+ | `nb db` | Inspect or manage built-in database runtime status for local envs. |
145
+ | `nb upgrade` | Refresh code/image and restart the selected app. |
146
+ | `nb down` | Stop and remove local runtime containers for an env. |
147
+ | `nb env` | Manage saved CLI env connections. |
148
+ | `nb api` | Call NocoBase API resources from the CLI. |
149
+ | `nb pm` | Manage plugins for the selected NocoBase env. |
150
+
151
+ Recommended style: use `--env` explicitly for app/runtime commands. `-e` is the short form:
152
+
153
+ ```bash
154
+ nb start --env app1
155
+ nb logs --env app1
156
+ nb ps --env app1
157
+ nb db ps --env app1
158
+ ```
159
+
160
+ Equivalent shorthand examples:
161
+
162
+ ```bash
163
+ nb start -e app1
164
+ nb logs -e app1
165
+ nb upgrade -e app1
166
+ nb db start -e app1
167
+ ```
168
+
169
+ ## Runtime Types
170
+
171
+ ### Docker
172
+
173
+ Docker envs are managed through saved Docker containers and images:
174
+
175
+ ```bash
176
+ nb init --env app1 --yes --source docker --version alpha
177
+ nb start --env app1
178
+ nb logs --env app1
179
+ nb stop --env app1
180
+ ```
181
+
182
+ Docker downloads support platform selection:
183
+
184
+ ```bash
185
+ nb download --source docker --version alpha --docker-platform auto
186
+ nb download --source docker --version alpha --docker-platform linux/amd64
187
+ nb download --source docker --version alpha --docker-platform linux/arm64
188
+ ```
189
+
190
+ ### npm and Git
191
+
192
+ npm and Git envs use a local source directory and can run development mode:
193
+
194
+ ```bash
195
+ nb init --env app1 --yes --source git --version alpha
196
+ nb dev --env app1
197
+ ```
198
+
199
+ `nb dev` only supports npm/Git source envs. Docker envs can be inspected with
200
+ `nb logs`, and remote envs only support API/env operations.
201
+
202
+ ### Existing NocoBase App
203
+
204
+ To connect an existing app, use `nb init` and choose the existing-app setup
205
+ path, or add the env directly:
206
+
207
+ ```bash
208
+ nb env add app1 --base-url http://localhost:13000/api
209
+ ```
210
+
211
+ `nb env add` will start the authentication flow automatically when needed.
212
+
213
+ ## Upgrade
214
+
215
+ Upgrade refreshes the saved source or image, then restarts the app:
216
+
217
+ ```bash
218
+ nb upgrade --env app1
219
+ ```
220
+
221
+ Use `--skip-code-update` or `-s` to restart with the saved local code or Docker
222
+ image without downloading updates first:
223
+
224
+ ```bash
225
+ nb upgrade --env app1 -s
226
+ ```
227
+
228
+ ## Database Commands
229
+
230
+ Use `nb db` to inspect or manage the built-in database runtime for a local env:
231
+
232
+ ```bash
233
+ nb db ps
234
+ nb db ps --env app1
235
+ nb db start --env app1
236
+ nb db stop --env app1
237
+ nb db logs --env app1
238
+ ```
239
+
240
+ Notes:
241
+
242
+ - `nb db start` and `nb db stop` only work for envs created with the built-in database option enabled.
243
+ - `nb db logs` only works for envs created with the built-in database option enabled.
244
+ - `nb db ps` can also show `external` or `remote` status for envs that do not have a CLI-managed database container.
245
+
246
+ ## Cleanup
247
+
248
+ Bring down a local env:
249
+
250
+ ```bash
251
+ nb down --env app1
252
+ ```
253
+
254
+ By default, `nb down` stops the app and removes app/database containers if they
255
+ exist. It keeps user data, source files, and CLI env config.
256
+
257
+ Use explicit flags for destructive cleanup:
258
+
259
+ ```bash
260
+ nb down --env app1 --remove-data
261
+ nb down --env app1 --remove-source
262
+ nb down --env app1 --remove-env
263
+ ```
264
+
265
+ - `--remove-data`: delete storage and managed database data. This requires confirmation unless `--yes` is used.
266
+ - `--remove-source`: delete the npm/Git source directory.
267
+ - `--remove-env`: remove the saved CLI env config.
268
+
269
+ ## Environment Management
270
+
271
+ Show the current env:
272
+
273
+ ```bash
274
+ nb env
275
+ ```
276
+
277
+ List configured envs:
278
+
279
+ ```bash
280
+ nb env list
281
+ ```
282
+
283
+ Switch the current env:
284
+
285
+ ```bash
286
+ nb env use app1
287
+ ```
288
+
289
+ Re-authenticate an env when credentials need to be refreshed:
290
+
291
+ ```bash
292
+ nb env auth app1
293
+ ```
294
+
295
+ Update runtime command metadata from the selected app:
296
+
297
+ ```bash
298
+ nb env update app1
299
+ ```
300
+
301
+ ## API Commands
302
+
303
+ The CLI can call NocoBase resources through the configured env:
80
304
 
81
- NocoBase supports three installation methods:
305
+ ```bash
306
+ nb api resource list --resource users -e app1
307
+ nb api resource get --resource users --filter-by-tk 1 -e app1
308
+ nb api resource create --resource users --values '{"nickname":"Ada"}' -e app1
309
+ ```
82
310
 
83
- - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
311
+ Use `-j, --json-output` to print raw JSON when available:
84
312
 
85
- Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
313
+ ```bash
314
+ nb api resource list --resource users -e app1 -j
315
+ ```
86
316
 
87
- - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
317
+ Available API command topics:
88
318
 
89
- The business code of the project is completely independent and supports low-code development.
319
+ | Command | Description |
320
+ | --- | --- |
321
+ | `nb api acl` | Manage access control based on roles, resources, and actions. |
322
+ | `nb api api-keys` | Manage API keys for HTTP API access. |
323
+ | `nb api app` | Manage application resources. |
324
+ | `nb api authenticators` | Manage user authentication, including password auth, SMS auth, SSO protocols, and extensible providers. |
325
+ | `nb api data-modeling` | Manage data sources, collections, and database modeling resources. |
326
+ | `nb api file-manager` | Manage file storage services, file collections, and attachment fields. |
327
+ | `nb api flow-surfaces` | Compose and mutate page, tab, block, field, and action surfaces. |
328
+ | `nb api pm` | Manage plugins through API commands. |
329
+ | `nb api resource` | Work with generic collection resources. |
330
+ | `nb api system-settings` | Adjust system title, logo, language, and other global settings. |
331
+ | `nb api theme-editor` | Customize UI colors and dimensions, save themes, and switch between them. |
332
+ | `nb api workflow` | Manage workflow resources for business automation. |
90
333
 
91
- - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
334
+ ## Local Data
92
335
 
93
- If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
336
+ The CLI stores workspace-level config in `.nocobase`:
94
337
 
95
- ## How NocoBase works
338
+ - `config.json`: env definitions, current env, and workspace-level settings.
339
+ - `versions/<version>/commands.json`: cached runtime commands generated from the target app.
96
340
 
97
- <video width="100%" controls>
98
- <source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
99
- </video>
341
+ Runtime data such as source files, storage files, Docker containers, and
342
+ database data are managed separately according to the env source and install
343
+ options.