Appwrite CLI
The Appwrite CLI is a command-line application that allows you to interact with the Appwrite server and perform server-side tasks using your terminal. This includes creating and managing projects, managing resources (documents, files, users), creating and deploying Appwrite Functions, and other operations available through Appwrite's API.
Installation
The CLI is packaged both as an npm module as well as a standalone binary 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 on your machine.
Install with NPM
If you have npm set up, run the command below to install the CLI
npm install -g appwrite-cli
Install with Script
For a completely dependency-free installation, the CLI also ships with a convenient installation script for your operating system
-
MacOS
Using Homebrew
brew tap appwrite/sdk-for-cli https://github.com/appwrite/sdk-for-cli brew update brew install --HEAD appwrite
or terminal
curl -sL https://appwrite.io/cli/install.sh | bash
-
Windows
iwr -useb https://appwrite.io/cli/install.ps1 | iex
-
Linux
curl -sL https://appwrite.io/cli/install.sh | bash
After the installation is complete, verify the install using
appwrite -v
Getting Started
Before you can use the CLI, you need to login to your Appwrite account using
appwrite login
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
appwrite client --selfSigned true
You can run your first CLI command after logging in. Try fetching information about your Appwrite project.
appwrite projects get --projectId [PROJECT_ID]
Next Steps
You can use the CLI to create and deploy functions and collections. Deploy commands allow you to configure your Appwrite project programmatically and replicate functions and collection schemas across Appwrite projects.
Besides utility commands, the CLI can be used to execute commands like a Server SDK.
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.
Help
If you get stuck anywhere, you can always use the help
command to get the usage examples.
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.
appwrite client --endpoint https://cloud.appwrite.io/v1
appwrite client --key 23f24gwrhSDgefaY
appwrite client --selfSigned true
appwrite client --reset // Resets your CLI configuration
appwrite client --debug // Prints your current configuration
Uninstall
If you installed Appwrite CLI using NPM, you can use the following command to uninstall it.
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.
-
MacOS
Using Homebrew
brew uninstall appwrite
or terminal
rm -f /usr/local/bin/appwrite | bash
-
Windows
$APPWRITE_INSTALL_DIR = Join-Path -Path $env:LOCALAPPDATA -ChildPath "Appwrite"; Remove-Item -Force -Path $APPWRITE_INSTALL_DIR
-
Linux
rm -f /usr/local/bin/appwrite | bash
You can also remove the configuration, cookies, and API Keys the Appwrite CLI stored. To remove those, run the following command.
-
MacOS
rm -rf ~/.appwrite | bash
-
Windows
$APPWRITE_CONFIG_DIR = Join-Path -Path $env:UserProfile -ChildPath ".appwrite"; Remove-Item -Recurse -Force -Path $APPWRITE_CONFIG_DIR
-
Linux
rm -rf ~/.appwrite | bash