This SDK targets Appwrite server version 2.5.x as shipped on Appwrite Cloud. Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from previous releases when APIs differ.
The Appwrite CLI manages your Appwrite projects from the terminal. Create and link projects, deploy functions and sites, sync tables, buckets, teams and other resources through appwrite.config.json, and call any Appwrite API. For full API documentation and tutorials go to https://appwrite.io/docs
The Appwrite CLI is a command line tool to help you interact with the Appwrite API. You can install it with Homebrew, npm, Scoop or our install scripts, or download a native binary for your operating system and architecture.
brew install appwrite/appwrite/appwriteHomebrew pulls the formula from the appwrite/homebrew-appwrite tap and downloads the native binary for your platform.
npm install -g appwrite-cliwget -q https://appwrite.io/cli/install.sh -O - | /bin/bashiwr -useb https://appwrite.io/cli/install.ps1 | iexscoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.config.jsonThe npm package also works on Windows:
npm install -g appwrite-cliappwrite -vThis prints the installed version, for example 28.7.0.
Install completion for your current shell:
appwrite completion installYou can also install completion for a specific shell:
appwrite completion install zsh
appwrite completion install bash
appwrite completion install fishFor zsh, ensure ~/.zfunc is in your fpath and compinit is loaded from your shell config.
Sign in to Appwrite Cloud:
appwrite loginThe CLI opens your browser and prints a one-time code to confirm there:
To sign in, confirm the code below in your browser:
Code: <CODE>
URL: <VERIFICATION_URL>
Signed in as you@example.com on https://cloud.appwrite.io/v1
If the browser does not open, visit the URL yourself. Then create a project, or link the current directory to an existing one:
appwrite init projectThis writes appwrite.config.json, which records the project and every resource the CLI manages for it. Commit it to version control. To skip the prompts, pass --organization-id, --project-id and --project-name. Use appwrite list-organizations and appwrite list-projects to look up IDs.
Add resources, then push them:
appwrite init function
appwrite push functionPoint login at your instance's API endpoint. Self-hosted instances sign in with email and password:
appwrite login --endpoint https://appwrite.example.com/v1The CLI prompts for Enter your email and Enter your password, or takes them from --email and --password. If the account has multi-factor authentication, it then asks for a factor and a code. Pass them up front with --mfa (email, phone, totp or recoveryCode) and --code:
appwrite login --endpoint https://appwrite.example.com/v1 --email you@example.com --password "$PASSWORD" --mfa totp --code 123456Requests to an instance with a self-signed certificate are rejected by default. If you trust the instance, allow its certificate for the active account:
appwrite client --self-signed trueThe CLI can keep several signed-in accounts, on Cloud and on self-hosted instances, and uses one at a time.
# Show the active account
appwrite whoami
# List every stored session and which one is active
appwrite sessions
# Sign in to another account without signing out of the current one
appwrite login --new
# Switch the active account, picking from a list
appwrite login --switch
# Switch without a prompt
appwrite login --switch --endpoint https://appwrite.example.com/v1 --email you@example.com
# Sign out of the active account
appwrite logoutlogout revokes the session on the server before removing it locally.
init creates a resource in appwrite.config.json, pull copies resources from your project into it, and push applies it to your project.
| Resource | init |
pull |
push |
|---|---|---|---|
function |
✓ | ✓ | ✓ |
site |
✓ | ✓ | ✓ |
table |
✓ | ✓ | ✓ |
bucket |
✓ | ✓ | ✓ |
team |
✓ | ✓ | ✓ |
topic |
✓ | ✓ | ✓ |
webhook |
✓ | ✓ | |
settings |
✓ | ✓ | |
collection (legacy) |
✓ | ✓ | ✓ |
Resource names also accept the plural, so appwrite push functions and appwrite push function are the same command.
appwrite init functionThe CLI asks for a name, ID and runtime, copies the starter code for that runtime from appwrite/templates into functions/<name>, and adds the function to appwrite.config.json. Fetching the template needs git. Pass --name, --function-id and --runtime to skip the prompts, --source github to connect a GitHub repository instead of deploying local code, and --deploy to create and deploy the function straight away.
appwrite push functionpush function asks which functions to deploy, creates or updates them, uploads the code and streams the build logs. Pass --function-id <ID> for one function or --all for every function, --with-variables to replace the function's variables with those in its .env file, --no-logs to skip the build logs, and --async to return without waiting for the deployment.
appwrite init site
appwrite push siteinit site asks for a framework and can download its starter template. push site builds and deploys like push function; in a terminal it also prints a preview of the deployed page.
appwrite pull all
appwrite push allpush all pushes settings, buckets, teams, webhooks, topics, analytics, functions, sites and tables, in that order. It skips legacy collections.
Run a function locally in the same runtime container Appwrite uses. This needs Docker.
appwrite run functionThe function is served at http://localhost:<port>/ and restarts when you edit its code. Useful flags:
| Flag | Description |
|---|---|
--function-id |
Function to run, instead of choosing from a list |
--port |
Local port |
--user-id |
ID of a user to impersonate |
--with-variables |
Load the function's variables from your project |
--no-reload |
Don't restart when files change |
Generate a type-safe TypeScript SDK for the databases and tables in appwrite.config.json:
appwrite generateFiles are written to generated/ by default. Change it with --output.
Generate model types for your tables and collections:
appwrite types ./typesThe language is detected from your project. Set it with --language: ts, js, php, kotlin, swift, java, dart, cs or python. Pass --strict to convert field names to the language's naming conventions.
Install Appwrite skills for AI coding agents into .agents or .claude:
appwrite init skillWithout a terminal, pass the selection as flags:
appwrite init skill --all --agent .claude --method copy--skill installs a single skill and can be repeated. init project also installs skills that match your project.
Every Appwrite API is available as appwrite <service> <command> [flags]:
appwrite users list
appwrite users create --user-id "unique()" --email hello@appwrite.io --password very_strong_password
appwrite functions create-execution --function-id <FUNCTION_ID> --body '{"hello":"world"}'Pass JSON arguments as a single-quoted string with double-quoted keys and values. Repeat a flag to pass an array:
appwrite tablesdb create-row \
--database-id <DATABASE_ID> \
--table-id <TABLE_ID> \
--row-id "unique()" \
--data '{"name": "Walter White"}' \
--permissions 'read("any")' \
--permissions 'read("team:abc")'List commands accept --filter (for example --filter 'email=hello@appwrite.io'), --sort-asc, --sort-desc, --limit and --offset.
Results are printed as a table. Use --json for filtered JSON or --raw for the full response. Secrets in the output are redacted unless you pass --show-secrets.
appwrite users list --jsonTo discover services, commands and their flags:
appwrite --help
appwrite users --help
appwrite users list --helpTo inspect or reset the CLI's configuration:
# Show the endpoint, project and masked credentials in use
appwrite client --debug
# Sign out of every session and clear the configuration
appwrite client --resetIn CI, authenticate with an API key instead of signing in. Give the key the scopes for the resources you push.
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
env:
APPWRITE_NO_UPDATE_CHECK: 1
steps:
- uses: actions/checkout@v4
- name: Install the Appwrite CLI
run: npm install -g appwrite-cli
- name: Configure the Appwrite CLI
run: appwrite client --endpoint https://cloud.appwrite.io/v1 --key ${{ secrets.APPWRITE_API_KEY }}
- name: Deploy
run: |
appwrite push tables --all --force
appwrite push functions --all --force
appwrite push sites --all --forceWithout an interactive terminal, the CLI never waits for input: a prompt fails with the flag that answers it. --all selects every resource of that type and --force accepts confirmations, including activating new deployments.
An API key works for project resources, not for console-only commands. push all and push settings need a signed-in account, so push resources one type at a time.
These environment variables override appwrite.config.json, so one job can deploy to several projects:
| Variable | Overrides |
|---|---|
APPWRITE_ENDPOINT |
Project endpoint. Must match the endpoint configured with appwrite client |
APPWRITE_PROJECT_ID |
Project ID |
APPWRITE_ORGANIZATION_ID |
Organization ID |
APPWRITE_CONFIG_FILE |
Config file, like --config-file |
APPWRITE_NO_UPDATE_CHECK |
Set to any value to skip the daily update check |
appwrite updateThe CLI updates itself the way it was installed: through npm, Homebrew or by replacing the standalone binary. appwrite update --manual prints the commands instead of running them.
The CLI reads project resources from appwrite.config.json. Large resource arrays can be split into smaller JSON files with includes:
{
"projectId": "my-project",
"includes": {
"functions": "./appwrite/functions.json",
"sites": "./appwrite/sites.json",
"databases": "./appwrite/databases.json",
"collections": "./appwrite/collections.json",
"tablesDB": "./appwrite/tables-db.json",
"tables": "./appwrite/tables.json",
"buckets": "./appwrite/buckets.json",
"teams": "./appwrite/teams.json",
"webhooks": "./appwrite/webhooks.json",
"topics": "./appwrite/topics.json",
"messages": "./appwrite/messages.json",
"analytics": "./appwrite/analytics.json"
}
}Each included file contains only the array for that resource. Include paths are resolved relative to appwrite.config.json, and resource-local paths inside an included file are resolved relative to that included file:
[
{
"$id": "api",
"name": "API",
"runtime": "node-22",
"path": "functions/api",
"entrypoint": "src/main.ts"
}
]JSON pointer fragments such as ./resources.json#/functions are not supported.
Pass --config-file (or set APPWRITE_CONFIG_FILE) to use a config other than the nearest appwrite.config.json, so one repository can target several projects:
appwrite init project --config-file appwrite.config.prod.json
appwrite push --config-file appwrite.config.prod.jsonIncludes and resource paths are resolved relative to the chosen file.
This library is auto-generated by Appwrite custom SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull request.
To build and test the CLI for development:
-
Clone the SDK Generator repository and change into it.
git clone https://github.com/appwrite/sdk-generator cd sdk-generator -
Make sure Docker is running, then install the Composer dependencies and generate the CLI.
docker run --rm --interactive --tty --volume "$(pwd)":/app composer install --ignore-platform-reqs --optimize-autoloader --no-plugins --no-scripts --prefer-dist docker run --rm --volume "$(pwd)":/app --workdir /app php:8.5-cli php example.php cli
-
Build the generated CLI.
cd examples/cli go mod tidy go build -ldflags="-s -w" -o appwrite .
-
Run the CLI.
./appwrite -v
Please see the BSD-3-Clause license file for more information.
