DEV Community

loading...
Cover image for Announcing the Appwrite CLI 🚀
Appwrite

Announcing the Appwrite CLI 🚀

Christy Jacob
・2 min read

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.

Installation and Getting Started

Enough talking, let's get our hands dirty. Installing the CLI is a piece of cake with our handy installation script.

Linux / MacOS

$ wget -q https://appwrite.io/cli/install.sh  -O - | /bin/bash  
Enter fullscreen mode Exit fullscreen mode

Windows

$ iwr -useb https://appwrite.io/cli/install.ps1 | iex  
Enter fullscreen mode Exit fullscreen mode

Appwrite Install Script

Let's validate the installation using

$ appwrite version  
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

Great! Now you're all set to use the Appwrite CLI.

All commands in the CLI follow this general syntax

$ appwrite [SERVICE] [COMMAND] --[OPTIONS]
Enter fullscreen mode Exit fullscreen mode

Usage

Let's consider an example usage of the CLI.

Create and List Users

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="hugh@jackman.com" --password="very_strong_password"
Enter fullscreen mode Exit fullscreen mode

And you can view your created users using

$ appwrite users list 
Enter fullscreen mode Exit fullscreen mode

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 client service

$ 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"
Enter fullscreen mode Exit fullscreen mode

Help

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
Enter fullscreen mode Exit fullscreen mode

To get information about a particular service and the commands available in a service you can use

$ appwrite users help
$ appwrite accounts help
Enter fullscreen mode Exit fullscreen mode

Appwrite Users Help

To get information about a particular command and the parameters it accepts, you can use

$ appwrite users list --help
$ appwrite account get --help 
Enter fullscreen mode Exit fullscreen mode

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!

References

Discussion (2)

Collapse
kohsheen1234 profile image
Kohsheen Tiku

Wow. This is so amazing!

Collapse
eldadfux profile image
Eldad A. Fux

Kohsheen, you should join the Appwrite Discord community: appwrite.io/discord