Installation_
Get started with the Appwrite CLI by following the installation guide. Learn how to set up and configure the CLI on your development environment.
6 min read
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 (rows, 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-cliInstall 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 appwriteor terminal
curl -sL https://appwrite.io/cli/install.sh | bashUsing Powershell
iwr -useb https://appwrite.io/cli/install.ps1 | iexor Scoop
scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.config.jsoncurl -sL https://appwrite.io/cli/install.sh | bashUpdate your CLI
npm install -g appwrite-cliUsing Homebrew
brew install appwriteor terminal
curl -sL https://appwrite.io/cli/install.sh | bashiwr -useb https://appwrite.io/cli/install.ps1 | iexcurl -sL https://appwrite.io/cli/install.sh | bashscoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.config.jsonVerify installation
After the installation or the update is complete, you can verify the Appwrite CLI is available by checking its version number.
appwrite -vLogin
Before you can use the CLI, you need to login to your Appwrite account using
appwrite loginAdd 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 projectThis will create your appwrite.config.json file, where you will configure your various services like tables, functions, teams, topics, and buckets. For table column definitions, see Column types and formats, including email, enum, and floating-point configuration examples.
{ "projectId": "<PROJECT_ID>", "endpoint": "https://<REGION>.cloud.appwrite.io/v1"}The CLI will also auto-detect your project configuration and automatically install relevant Appwrite agent skills.
You can run your first CLI command after logging in. Try fetching information about your Appwrite project.
appwrite projects get --project-id "<PROJECT_ID>"Multi-file configuration
By default, the Appwrite CLI stores your project settings and resource definitions in one appwrite.config.json file. In CLI version 20.0.0 and later, you can split top-level resource arrays into separate JSON files with the includes field.
Use this when your project has many functions, sites, buckets, teams, topics, tables, or other deployable resources and you want to keep each resource type in its own file.
{ "projectId": "<PROJECT_ID>", "endpoint": "https://<REGION>.cloud.appwrite.io/v1", "includes": { "functions": "./appwrite/functions.json", "sites": "./appwrite/sites.json", "buckets": "./appwrite/buckets.json", "teams": "./appwrite/teams.json", "topics": "./appwrite/topics.json" }}Each included file contains the JSON array that would normally live under that key in appwrite.config.json.
[ { "$id": "<FUNCTION_ID>", "name": "api", "runtime": "node-22", "path": "functions/api", "entrypoint": "src/main.js", "commands": "npm install", "execute": [], "events": [], "schedule": "", "interval": 0, "timeout": 15, "enabled": true, "logging": true, "ignore": [ "node_modules", ".git" ], "scopes": [], "vars": [] }]The CLI resolves resource paths relative to the file that defines the resource. For example, if functions is included from ./appwrite/functions.json, the function path above resolves from ./appwrite/, not from the folder that contains the root appwrite.config.json.
The single-file format continues to work. You can split any supported resource arrays over time and keep other arrays in the root config.
Supported include keys are functions, sites, databases, tablesDB, tables, topics, teams, buckets, webhooks, and messages.
Include paths must be local JSON files inside your project. They must be relative paths, end in .json, and cannot use parent-directory segments, absolute paths, URLs, URL-like schemes, null bytes, or JSON pointer fragments.
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 trueMultiple environments
By default, the CLI looks for appwrite.config.json in the current directory, then in each parent directory. In CLI version 28.1.0 and later, you can choose a different project config file with the --config-file flag or the APPWRITE_CONFIG_FILE environment variable. One repository can then keep a separate config for each environment, such as staging and production, each linked to its own Appwrite project.
Create or link a project config for each environment:
appwrite init project --config-file appwrite.config.staging.jsonappwrite init project --config-file appwrite.config.prod.jsonPass the same flag to deploy to one environment:
appwrite push --config-file appwrite.config.staging.jsonappwrite push --config-file appwrite.config.prod.jsonTo use one config for a whole shell session or CI job, set APPWRITE_CONFIG_FILE instead:
export APPWRITE_CONFIG_FILE=appwrite.config.prod.jsonappwrite pushappwrite types ./src/typesEvery command that reads the project config uses the chosen file. This includes pull, push, run, generate, and types, and commands such as appwrite users list that read the project ID and endpoint from it. If you set both, --config-file takes precedence over APPWRITE_CONFIG_FILE.
If APPWRITE_PROJECT_ID or APPWRITE_ENDPOINT is set, the CLI uses it instead of the projectId or endpoint in the chosen config file. Unset these variables when you switch environments with a config file.
Project environments
On Appwrite Cloud, a project can have environments of its own, such as staging. An environment has no project ID of its own: the CLI acts in one with the project's ID in projectId and the environment's ID in environmentId.
When you link an existing project that has environments, appwrite init project asks which one to use, with the project itself as the default. Pass --environment-id to choose without the prompt:
appwrite init project --project-id "<PROJECT_ID>" --environment-id stagingThe CLI saves the choice in appwrite.config.json:
{ "projectId": "<PROJECT_ID>", "environmentId": "staging"}To switch environments later, run appwrite client --environment-id <ENVIRONMENT_ID>, or pass an empty value to act in the project itself. The APPWRITE_ENVIRONMENT_ID environment variable takes precedence over the config file. The config file's environmentId only applies to the project in the same file, so setting APPWRITE_PROJECT_ID to another project leaves it out.
Combine environments with config files to keep one config for each environment in the same repository, each with the same projectId and a different environmentId.
appwrite push settings and appwrite pull settings change and read the project itself, so they stop with an error while an environment is set. appwrite push all and appwrite pull all skip settings in an environment and push or pull everything else.
Next steps
You can use the CLI to create and deploy tables, functions, teams, topics, and buckets. Deployment commands allow you to configure your Appwrite project programmatically and replicate functions and table 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 helpConfiguration
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://<REGION>.cloud.appwrite.io/v1appwrite client --key 23f24gwrhSDgefaYappwrite client --self-signed trueappwrite client --reset # Resets your CLI configurationappwrite client --debug # Prints your current configurationUninstall
If you installed Appwrite CLI using NPM, you can use the following command to uninstall it.
npm uninstall -g appwrite-cliIf 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_DIRor Scoop
scoop uninstall appwrite.configrm -f /usr/local/bin/appwrite | bashYou can also remove the configuration, cookies, and API Keys the Appwrite CLI stored. To remove those, run the following command.
rm -rf ~/.appwrite | bashUsing Powershell
$APPWRITE_CONFIG_DIR = Join-Path -Path $env:UserProfile -ChildPath ".appwrite"; Remove-Item -Recurse -Force -Path $APPWRITE_CONFIG_DIRor Scoop
appwrite client --resetrm -rf ~/.appwrite | bashWas this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.