Installation

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.

Shell
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

Update your CLI

Verify installation

After the installation or the update is complete, you can verify the Appwrite CLI is available by checking its version number.

Shell
appwrite -v

Login

Before you can use the CLI, you need to login to your Appwrite account using

Shell
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.

Shell
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:

Shell
appwrite init project

This will create your appwrite.json file, where you will configure your various services like collections, functions, teams, topics, and buckets.

JSON
{
    "projectId": "<PROJECT_ID>"
}

You can run your first CLI command after logging in. Try fetching information about your Appwrite project.

Shell
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

Shell
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.

Learn more about deployment

Besides utility commands, the CLI can be used to execute commands like a Server SDK.

Find a full list of 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

Help

If you get stuck anywhere, you can always use the help command to get the usage examples.

Shell
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.

Shell
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.

Shell
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.

You can also remove the configuration, cookies, and API Keys the Appwrite CLI stored. To remove those, run the following command.