Docs

Appwrite CLI

The Appwrite CLI is a command-line application that allows you to interact with the Appwrite server-side APIs and perform server-side tasks quickly using your terminal. A few examples of these tasks including managing resources (documents, files, users), executing and packaging Cloud Functions, and any other operation available through the Appwrite API.

Getting started

The Appwrite CLI installation is extremely easy and fast. The CLI is packaged as a Docker container, which makes it secure by default, requires no dependencies but Docker, and truly platform and language agnostic.

The next step is to have your Appwrite server running. You can grab our simple installation command and execute it.

Next, head over to http://localhost and create a project in the Appwrite Console, create an API key, and we're good to play around with the CLI.

Installation

To install the CLI, we recommend running the installation script for your operating system.

  • MacOS

    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

Once the setup is complete, you can validate your installation using:

appwrite version

To start using the CLI with your project, you will first need to initialize the CLI with:

appwrite init

Great! Now you're all set to use the Appwrite CLI. You can access your CLI using the following general syntax:

appwrite [SERVICE] [COMMAND] --[OPTIONS]

Examples

Create User

To create a new user in your project, you can use the `create` command. To successfully create a user, make sure your API key is granted with the scope "users.write".

appwrite users create --email="hello@appwrite.io" --password="my-secret"

List Users

To get a list of all your project users, you can use the `list` command. To successfully view the list, make sure your API key is granted with the scope "users.read".

appwrite users list

List Collections

To get a list of all your collections, you can use the `listCollections` command. To successfully view the list, make sure your API key is granted with the scope "collections.read".

appwrite database listCollections

Read Collection

To get more information on a particular collection, you can make use of the `getCollection` command and pass in the `collectionId`. To successfully fetch the collection, make sure your API key is granted with the scope "collections.read".

appwrite database getCollection --collectionId=5ff468cfa32a0

Configuration

At any point, if you would like to change your project endpoint, project ID, project Key, selfSigned certificate acceptance or locale configuration you set during the CLI init, you can make use of the `client` service.

appwrite client setEndpoint --endpoint="http://192.168.1.6/v1"
appwrite client setProject --project="5ff450422d42f"
appwrite client setKey --key="23f24gwrhSDgefaY"
appwrite client setSelfSigned --value=true
appwrite client setLocale --locale="en-US"

Help

If you get stuck anywhere, you can always use the `help` command to get the usage examples. All the examples are also available on the Appwrite API specs docs, and you can view them by switching the examples to the "Appwrite CLI" from the top dropdown.