Appwrite recently released v0.7, its biggest release yet, and with it comes the much-awaited Appwrite CLI. With the Appwrite CLI you can quickly interact with your Appwrite backend right from your terminal or CI server. The CLI is also cross-platform and offers the same experience on macOS, Windows, and Linux.
Enough talking, let's get our hands dirty. Installing the CLI is a piece of cake with our handy installation script.
$ wget -q https://appwrite.io/cli/install.sh -O - | /bin/bash
$ iwr -useb https://appwrite.io/cli/install.ps1 | iex
Let's validate the installation using
$ appwrite version
In order to start using the CLI, you will first need to initialize it using your project ID, API key, Appwrite server endpoint, and your locale.
$ appwrite init
If you wish to use the CLI in a CI environment, you can even initialize it in a non-interactive way by passing the required parameters like so
$ appwrite init --project="PROJECT_ID" \ --endpoint="http://localhost/v1" \ --key="PROJECT_KEY" \ --locale="en-US"
Great! Now you're all set to use the Appwrite CLI.
All commands in the CLI follow this general syntax
$ appwrite [SERVICE] [COMMAND] --[OPTIONS]
Let's consider an example usage of the CLI.
Let's say you want to create a new user in your project. Prior to the CLI, you would have to get the Server/ Client SDK, setup you environment for the language you have chosen etc. With the CLI, you just do
$ appwrite users create --email="firstname.lastname@example.org" --password="very_strong_password"
And you can view your created users using
$ appwrite users list
At any point, if you would like to change your project endpoint, project ID, key or locale, you can make use of the
$ appwrite client setEndpoint --endpoint="http://192.168.1.6/v1" $ appwrite client setProject --project="5ff450422d42f" $ appwrite client setKey --key="23f24gwrhSDgefaY" $ appwrite client setLocale --locale="en-US"
If you get stuck anywhere, you can always use the
help command to get the usage examples.
To get information about the different services available, you can use
$ appwrite help
To get information about a particular service and the commands available in a service you can use
$ appwrite users help $ appwrite accounts help
To get information about a particular command and the parameters it accepts, you can use
$ appwrite users list --help $ appwrite account get --help
If you have unanswered questions feel free to hop onto our Discord server. We have a super active community always waiting for your questions and feedback!