Claude
Skills
Sign in
Back

appwrite-cli

Included with Lifetime
$97 forever

Appwrite CLI skill. Use when managing Appwrite projects from the command line. Covers installation, login, project initialization, multi-file project configuration, deploying functions/sites/tables/buckets/teams/webhooks/topics, flag-based list queries, non-interactive CI/CD mode, and generating type-safe SDKs.

Cloud & DevOps

What this skill does



# Appwrite CLI

## Installation

```bash
# npm
npm install -g appwrite-cli

# macOS (Homebrew native binary)
brew tap appwrite/appwrite
brew install appwrite/appwrite/appwrite

# macOS / Linux (script)
curl -sL https://appwrite.io/cli/install.sh | bash

# Windows (Scoop)
scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.config.json
```

Verify installation:

```bash
appwrite -v
```

## Login & Initialization

```bash
# Login to your account
appwrite login

# Login to a self-hosted instance
appwrite login --endpoint "https://your-instance.com/v1"

# Switch to a different saved account
appwrite login --switch

# Initialize a project (creates appwrite.config.json)
appwrite init project

# Verify by fetching project info
appwrite projects get --project-id "<PROJECT_ID>"
```

`appwrite whoami` can show `https://cloud.appwrite.io/v1` as the account login endpoint. That is expected for Appwrite Cloud login. Do not rewrite it to a regional endpoint. Only project configuration and project-scoped API calls use the region endpoint, such as `https://<REGION>.cloud.appwrite.io/v1`.

## Configuration

```bash
# Switch endpoint/project for scripted use
appwrite client --endpoint "https://<REGION>.cloud.appwrite.io/v1"
appwrite client --project-id "<PROJECT_ID>"
```

> For the full list of CLI commands, see [CLI Commands](https://appwrite.io/docs/tooling/command-line/commands).
> For headless / CI/CD usage, see [Non-Interactive Mode](https://appwrite.io/docs/tooling/command-line/non-interactive).

## appwrite.config.json

Resources can be configured inline in `appwrite.config.json` or split into separate JSON array files using `includes`.

```json
{
    "projectId": "<PROJECT_ID>",
    "projectName": "Production",
    "endpoint": "https://<REGION>.cloud.appwrite.io/v1",
    "includes": {
        "functions": "appwrite/functions.json",
        "sites": "appwrite/sites.json",
        "webhooks": "appwrite/webhooks.json"
    },
    "settings": {
        "services": {
            "account": true,
            "databases": true,
            "functions": true,
            "sites": true,
            "messaging": true
        },
        "protocols": {
            "rest": true,
            "graphql": true,
            "websocket": true
        },
        "auth": {
            "methods": {
                "email-password": true,
                "magic-url": true
            },
            "security": {
                "sessionsLimit": 10,
                "passwordDictionary": true
            }
        }
    },
    "tablesDB": [],
    "tables": [],
    "buckets": [],
    "teams": [],
    "topics": []
}
```

Each `includes` value must be a relative `.json` path inside the project directory and must point to a JSON array. A resource cannot be defined both inline and in `includes`. When functions or sites are included, their `path` values are resolved relative to the include file directory.

Example `appwrite/functions.json`:

```json
[
    {
        "$id": "<FUNCTION_ID>",
        "name": "userAuth",
        "enabled": true,
        "logging": true,
        "runtime": "node-22",
        "buildSpecification": "s-1vcpu-512mb",
        "runtimeSpecification": "s-1vcpu-512mb",
        "deploymentRetention": 7,
        "events": [],
        "schedule": "",
        "timeout": 15,
        "entrypoint": "src/main.js",
        "commands": "npm install",
        "ignore": "node_modules\n.tmp",
        "path": "../functions/userAuth"
    }
]
```

### Pull and push project configuration

```bash
# Pull or push everything
appwrite pull all --all
appwrite push all --all

# Pull or push individual resource groups
appwrite pull settings
appwrite push settings
appwrite pull webhooks
appwrite push webhooks
appwrite pull functions
appwrite push functions
```

## Deploying Functions

```bash
# Create a new function
appwrite init functions

# Pull existing functions from Console
appwrite pull functions

# Deploy functions
appwrite push functions
```

### Function configuration in appwrite.config.json

```json
{
    "functions": [
        {
            "$id": "<FUNCTION_ID>",
            "name": "userAuth",
            "enabled": true,
            "logging": true,
            "runtime": "node-22",
            "buildSpecification": "s-1vcpu-512mb",
            "runtimeSpecification": "s-1vcpu-512mb",
            "deploymentRetention": 7,
            "scopes": [],
            "events": [],
            "schedule": "",
            "timeout": 15,
            "entrypoint": "src/main.js",
            "commands": "npm install",
            "ignore": "node_modules\n.tmp",
            "path": "functions/userAuth"
        }
    ]
}
```

Key function config fields:

| Field | Description |
|-------|-------------|
| `enabled` | Enables or disables the function. Disabled functions cannot be executed. |
| `logging` | Stores execution logs for debugging and observability. |
| `runtime` | Runtime used to execute the function, such as `node-22`. |
| `buildSpecification` | Compute specification used while building the deployment. |
| `runtimeSpecification` | Compute specification used while running executions. |
| `deploymentRetention` | Number of days to retain old deployments before they are automatically deleted. |
| `scopes` | API scopes granted to the function's generated execution key. |
| `events` | Event patterns that trigger the function. |
| `schedule` | Cron expression for scheduled execution. Empty string disables scheduling. |
| `timeout` | Maximum execution duration in seconds. |
| `entrypoint` | File inside `path` that starts the function. |
| `commands` | Build/install command run before deployment. |
| `ignore` | Extra newline-separated ignore rules used when packaging code. `.gitignore` is read automatically. |
| `path` | Local function source directory. If configured through `includes`, this is resolved relative to the include file. |

### Function commands

| Command | Description |
|---------|-------------|
| `appwrite functions list` | List all functions |
| `appwrite functions create` | Create a new function |
| `appwrite functions get --function-id <ID>` | Get a function by ID |
| `appwrite functions update --function-id <ID>` | Update a function |
| `appwrite functions delete --function-id <ID>` | Delete a function |
| `appwrite functions list-runtimes` | List all active runtimes |
| `appwrite functions list-deployments --function-id <ID>` | List deployments |
| `appwrite functions create-deployment --function-id <ID>` | Upload a new deployment |
| `appwrite functions update-deployment --function-id <ID> --deployment-id <ID>` | Set active deployment |
| `appwrite functions delete-deployment --function-id <ID> --deployment-id <ID>` | Delete a deployment |
| `appwrite functions download-deployment --function-id <ID> --deployment-id <ID>` | Download deployment |
| `appwrite functions create-execution --function-id <ID>` | Trigger execution |
| `appwrite functions list-executions --function-id <ID>` | List execution logs |
| `appwrite functions get-execution --function-id <ID> --execution-id <ID>` | Get execution log |
| `appwrite functions list-variables --function-id <ID>` | List variables |
| `appwrite functions create-variable --function-id <ID> --key <KEY> --value <VALUE>` | Create variable |
| `appwrite functions update-variable --function-id <ID> --variable-id <ID> --key <KEY> --value <VALUE>` | Update variable |
| `appwrite functions delete-variable --function-id <ID> --variable-id <ID>` | Delete variable |

### List functions with flag-based queries

Prefer the query flags for common filtering, sorting, and pagination. Use `--queries` only for raw Appwrite JSON query strings or advanced automation.

```bash
appwrite functions list \
    --where 'name=api' \
    --sort-desc '$createdAt' \
    --limit 10 \
    --offset 0 \
    --json

appwrite functions list-deployments \
    --function-id <FUNCTION_ID> \
    --limit 5 \
    --cursor-after <DEPLOY
Files: 1
Size: 26.0 KB
Complexity: 31/100
Category: Cloud & DevOps

Related in Cloud & DevOps