The Appwrite Command Line Interface (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 (documents, files, users), creating and deploying Appwrite Functions, and other operations available through Appwrite's API.
Getting started
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
Using Homebrew
brew install appwrite
or terminal
curl -sL https://appwrite.io/cli/install.sh | bash
Using Powershell
iwr -useb https://appwrite.io/cli/install.ps1 | iex
or Scoop
scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.json
curl -sL https://appwrite.io/cli/install.sh | bash
Update your CLI
npm install -g appwrite-cli
Using Homebrew
brew install appwrite
or terminal
curl -sL https://appwrite.io/cli/install.sh | bash
iwr -useb https://appwrite.io/cli/install.ps1 | iex
curl -sL https://appwrite.io/cli/install.sh | bash
scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.json
Verify installation
After the installation or the update is complete, you can verify the Appwrite CLI is available by checking its version number.
appwrite -v
Login
Before you can use the CLI, you need to login to your Appwrite account using
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.
appwrite login --endpoint "<URL_HERE>"
You can log in to multiple accounts or change the current account by re-running the command.
Initialization
After you're logged in, the CLI needs to be initialized with your Appwrite project. You can initialize the CLI using:
appwrite init project
This will create your appwrite.json file, where you will configure your various services like collections, functions, teams, topics, and buckets.
{
"projectId": "<PROJECT_ID>"
}
You can run your first CLI command after logging in. Try fetching information about your Appwrite project.
appwrite projects get --project-id "<PROJECT_ID>"
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 --self-signed true
Next steps
You can use the CLI to create and deploy collections, functions, teams, topics, and buckets. Deployment 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.
appwrite help
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 --self-signed 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.
Using Powershell
$APPWRITE_INSTALL_DIR = Join-Path -Path $env:LOCALAPPDATA -ChildPath "Appwrite"; Remove-Item -Force -Path $APPWRITE_INSTALL_DIR
or Scoop
scoop uninstall appwrite
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.
rm -rf ~/.appwrite | bash
Using Powershell
$APPWRITE_CONFIG_DIR = Join-Path -Path $env:UserProfile -ChildPath ".appwrite"; Remove-Item -Recurse -Force -Path $APPWRITE_CONFIG_DIR
or Scoop
appwrite client --reset
rm -rf ~/.appwrite | bash