-
Notifications
You must be signed in to change notification settings - Fork 318
Expand file tree
/
Copy path+page.markdoc
More file actions
280 lines (191 loc) · 7.3 KB
/
+page.markdoc
File metadata and controls
280 lines (191 loc) · 7.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
---
layout: article
title: Installation
description: Get started with the Appwrite CLI by following the installation guide. Learn how to set up and configure the CLI on your development environment.
---
The [Appwrite Command Line Interface (CLI)](https://github.com/appwrite/sdk-for-cli) is an application that allows you to interact with Appwrite to perform server-side tasks using your terminal. This includes creating and managing projects, managing resources (rows, files, users), creating and deploying Appwrite Functions, and other operations available through Appwrite's API.
# Getting started {% #getting-started %}
The CLI is packaged both as an [npm module](https://www.npmjs.com/package/appwrite-cli) as well as a [standalone binary](https://github.com/appwrite/sdk-for-cli/releases/latest) for your operating system, making it completely dependency free, platform independent, and language agnostic.
If you plan to use the CLI to initialize new Appwrite Functions, ensure that [Git is installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) on your machine.
## Install with npm {% #install-with-npm %}
If you have npm set up, run the command below to install the CLI.
```sh
npm install -g appwrite-cli
```
## Install with script {% #install-with-script %}
For a completely dependency-free installation, the CLI also ships with a convenient installation script for your operating system
{% tabs %}
{% tabsitem #macos title="macOS" %}
Using [Homebrew](https://brew.sh/)
```sh
brew install appwrite
```
or terminal
```sh
curl -sL https://appwrite.io/cli/install.sh | bash
```
{% /tabsitem %}
{% tabsitem #windows title="Windows" %}
Using [Powershell](https://learn.microsoft.com/en-us/powershell/)
```sh
iwr -useb https://appwrite.io/cli/install.ps1 | iex
```
or [Scoop](https://scoop.sh/)
```sh
scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.config.json
```
{% /tabsitem %}
{% tabsitem #linux title="Linux" %}
```sh
curl -sL https://appwrite.io/cli/install.sh | bash
```
{% /tabsitem %}
{% /tabs %}
# Update your CLI {% #update-your-cli %}
{% tabs %}
{% tabsitem #npm title="npm" %}
```sh
npm install -g appwrite-cli
```
{% /tabsitem %}
{% tabsitem #macos title="macOS" %}
Using [Homebrew](https://brew.sh/)
```sh
brew install appwrite
```
or terminal
```sh
curl -sL https://appwrite.io/cli/install.sh | bash
```
{% /tabsitem %}
{% tabsitem #windows title="Windows" %}
```sh
iwr -useb https://appwrite.io/cli/install.ps1 | iex
```
{% /tabsitem %}
{% tabsitem #linux title="Linux" %}
```sh
curl -sL https://appwrite.io/cli/install.sh | bash
```
{% /tabsitem %}
{% tabsitem #scoop title="Scoop" %}
```sh
scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.config.json
```
{% /tabsitem %}
{% /tabs %}
## Verify installation {% #verify-installation %}
After the installation or the update is complete, you can verify the Appwrite CLI is available by checking its version number.
```sh
appwrite -v
```
# Login {% #login %}
Before you can use the CLI, you need to login to your Appwrite account using
```sh
appwrite login
```
Add the `--endpoint` flag if you're using a self-hosted instance of Appwrite. This flag requires you to add the URL string you're using for your self-hosted instance after the `--endpoint` flag.
```sh
appwrite login --endpoint "<URL_HERE>"
```
You can log in to multiple accounts or change the **current** account by re-running the command.
# Initialization {% #initialization %}
After you're logged in, the CLI needs to be initialized with your Appwrite project. You can initialize the CLI using:
```sh
appwrite init project
```
This will create your `appwrite.config.json` file, where you will configure your various services like tables, functions, teams, topics, and buckets.
```json
{
"projectId": "<PROJECT_ID>",
"endpoint": "https://<REGION>.cloud.appwrite.io/v1"
}
```
The CLI will also auto-detect your project configuration and automatically install relevant [Appwrite agent skills](/docs/tooling/ai/skills).
You can run your first CLI command after logging in. Try fetching information about your Appwrite project.
```sh
appwrite projects get --project-id "<PROJECT_ID>"
```
{% info title="Self-signed certificates" %}
By default, requests to domains with self-signed SSL certificates (or no certificates) are disabled. If you trust the domain, you can bypass the certificate validation using
```sh
appwrite client --self-signed true
```
{% /info %}
## Next steps {% #next-steps %}
You can use the CLI to create and deploy tables, functions, teams, topics, and buckets. Deployment commands allow you to configure your Appwrite project programmatically and replicate functions and table schemas across Appwrite projects.
[Learn more about deployment](/docs/tooling/command-line/tables)
Besides utility commands, the CLI can be used to execute commands like a Server SDK.
[Find a full list of commands](/docs/tooling/command-line/commands)
You can choose to use the CLI in a headless and non-interactive mode without the need for config files or sessions. This is useful for CI or scripting use cases.
[Learn more about CI mode](/docs/tooling/command-line/non-interactive)
# Help {% #help %}
If you get stuck anywhere, you can always use the `help` command to get the usage examples.
```sh
appwrite help
```
# Configuration {% #configuration %}
At any point, if you would like to change your server's endpoint, project ID, or self-signed certificate acceptance, use the `client` command.
```sh
appwrite client --endpoint https://<REGION>.cloud.appwrite.io/v1
appwrite client --key 23f24gwrhSDgefaY
appwrite client --self-signed true
appwrite client --reset // Resets your CLI configuration
appwrite client --debug // Prints your current configuration
```
# Uninstall {% #uninstall %}
If you installed Appwrite CLI using NPM, you can use the following command to uninstall it.
```sh
npm uninstall -g appwrite-cli
```
If you installed the Appwrite CLI with brew or the installation script for your operating system, use the following command to uninstall it.
{% tabs %}
{% tabsitem #macos title="macOS" %}
Using [Homebrew](https://brew.sh/)
```sh
brew uninstall appwrite
```
or terminal
```sh
rm -f /usr/local/bin/appwrite | bash
```
{% /tabsitem %}
{% tabsitem #windows title="Windows" %}
Using [Powershell](https://learn.microsoft.com/en-us/powershell/)
```sh
$APPWRITE_INSTALL_DIR = Join-Path -Path $env:LOCALAPPDATA -ChildPath "Appwrite"; Remove-Item -Force -Path $APPWRITE_INSTALL_DIR
```
or [Scoop](https://scoop.sh/)
```sh
scoop uninstall appwrite
```
{% /tabsitem %}
{% tabsitem #linux title="Linux" %}
```sh
rm -f /usr/local/bin/appwrite | bash
```
{% /tabsitem %}
{% /tabs %}
You can also remove the configuration, cookies, and API Keys the Appwrite CLI stored. To remove those, run the following command.
{% tabs %}
{% tabsitem #macos title="macOS" %}
```sh
rm -rf ~/.appwrite | bash
```
{% /tabsitem %}
{% tabsitem #windows title="Windows" %}
Using [Powershell](https://learn.microsoft.com/en-us/powershell/)
```sh
$APPWRITE_CONFIG_DIR = Join-Path -Path $env:UserProfile -ChildPath ".appwrite"; Remove-Item -Recurse -Force -Path $APPWRITE_CONFIG_DIR
```
or [Scoop](https://scoop.sh/)
```sh
appwrite client --reset
```
{% /tabsitem %}
{% tabsitem #linux title="Linux" %}
```sh
rm -rf ~/.appwrite | bash
```
{% /tabsitem %}
{% /tabs %}