We're having lots of fun on Discord! Come and join us! 💬


Appwrite Functions allow you to extend and customize your Appwrite server functionality by executing your custom code. Appwrite can execute your custom code in response to any Appwrite system event like account creation, user login, or document update. You can also schedule your functions to run according to a CRON schedule or start them manually by triggering your function from an HTTP endpoint using the Appwrite client or server APIs.

Appwrite Functions run in a secure, isolated Docker container. By default, Appwrite supports multiple runtimes for different languages that you can use to run your code.

Add Your Function

You can add a new function from your Appwrite project's dashboard. Access your Functions settings from your project's left navigation panel. Click the 'Add Function' button and choose your function name and code runtime. In your Functions settings page, you can set your function event triggers, CRON schedule, and set secure environment variables for your function runtime.

Deploy Your Code

You can deploy your code using the Appwrite CLI tool, the Appwrite Server API or manually from the Appwrite console.

Create Tag

  • Unix

    appwrite functions createTag \
        --functionId=6012cc93d5a7b \
        --command="node index.js" \
  • CMD

    appwrite functions createTag ^
        --functionId=6012cc93d5a7b ^
        --command="node index.js" ^
  • PowerShell

    appwrite functions createTag ,
        --functionId=6012cc93d5a7b ,
        --command="node index.js" ,

The command above accepts two parameters:

Name Description
functionId The ID of the Function you created in the previous step. You can find your function ID on your function page in your project dashboard.
command The default command to execute when your function is triggered.
code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code.

For increased security, The Appwrite CLI only has access to file paths within the current working directory. In other words, it doesn't support file paths that try to access the parent directories (../../mycode).

You can also deploy new code tags using the Appwrite server API

Handling Dependencies

If your code uses a package manager like NPM, Yarn, or Composer to install packages, you have to make sure your code directory includes your packages directory (node_modules for node or vendor for PHP) before you try to package and deploy your code.

If you're using a programming language that saves your packages under a global directory like Dart, Python, or Ruby, you should set your package manager to keep your code under the '.appwrite' code directory under your code working directory to be deployed and available in your cloud functions runtime.

For most languages, this can be achieved easily by adding an environment variable before installing your dependencies. Below you can find some simple examples:


PIP_TARGET=./.appwrite pip install -r ./requirements.txt --upgrade --ignore-installed


PUB_CACHE=./.appwrite pub get


DENO_DIR=./.appwrite deno cache main.ts


docker run --rm -v $(pwd):/app -w /app --env GEM_HOME=./.appwrite appwrite/env-ruby-2.7:1.0.2 bundle install


Besides setting a schedule or allowing your function to listen to Appwrite’s system events, you can also manually execute your cloud functions from your Appwrite console or API.

Function settings page. Function settings page.
Function settings page.

To execute a function from the Appwrite console, click the 'Execute Now' button on your function's overview page. To execute a function from the API, send a POST request to the function execution endpoint.

The function execution endpoint is available from both Appwrite client and server APIs. To execute your function from the server API, you need an API key with 'execution.write' scope.

Executing the function from the client API requires the current user to have execution permission for the function. You can change the execution permission from the function's settings page in the Appwrite console, by default no user, team, or role has this permission.

  • Web

    const sdk = new Appwrite();
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    let promise = sdk.functions.createExecution('[FUNCTION_ID]');
    promise.then(function (response) {
        console.log(response); // Success
    }, function (error) {
        console.log(error); // Failure
  • Flutter

    import 'package:appwrite/appwrite.dart';
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      Future result = functions.createExecution(
        functionId: '[FUNCTION_ID]',
        .then((response) {
        }).catchError((error) {

Abuse and Limits

Appwrite allows your project's end-users to execute Cloud Functions using client API or your client SDK. Execution is permitted to any user who has been granted the "execute" permission in your Cloud Functions settings page. The execution permission can accept any of the typical Appwrite permission types.

When triggering a Cloud Function execution from the client, your users will be limited to a specific amount of execution per minute to make sure your Appwrite server is not being abused. The default limit is 60 calls per 1 minute. You can edit this limit using the server environment variables.

Supported Runtimes

Appwrite provides multiple code runtimes to execute your custom functions. Each runtime uses a Docker image tied to a specific language version to provide a safe, isolated playground to run your team's code.

Below is a list of supported Cloud Functions runtimes. The Appwrite team continually adds support for new runtimes. You can easily change which runtimes your Appwrite setup supports by editing your server environment variables.

Name Image Architectures
Function Env. node-14.5 appwrite/runtime-for-node:14.5 x86 / ppc / arm
Function Env. node-15.5 appwrite/runtime-for-node:15.5 x86 / ppc / arm
Function Env. node-16.0 appwrite/runtime-for-node:16.0 x86 / ppc / arm
Function Env. node-17.0 appwrite/runtime-for-node:17.0 x86 / ppc / arm
Function Env. php-7.4 appwrite/runtime-for-php:7.4 x86 / ppc / arm
Function Env. php-8.0 appwrite/runtime-for-php:8.0 x86 / ppc / arm
Function Env. php-8.1 appwrite/runtime-for-php:8.1 x86 / ppc / arm
Function Env. ruby-2.7 appwrite/runtime-for-ruby:2.7 x86 / ppc / arm
Function Env. ruby-3.0 appwrite/runtime-for-ruby:3.0 x86 / ppc / arm
Function Env. python-3.8 appwrite/runtime-for-python:3.8 x86 / ppc / arm
Function Env. python-3.9 appwrite/runtime-for-python:3.9 x86 / ppc / arm
Function Env. python-3.10 appwrite/runtime-for-python:3.10 x86 / arm
Function Env. deno-1.8 appwrite/runtime-for-deno:1.8 x86
Function Env. deno-1.10 appwrite/runtime-for-deno:1.10 x86
Function Env. deno-1.11 appwrite/runtime-for-deno:1.11 x86
Function Env. deno-1.12 appwrite/runtime-for-deno:1.12 x86
Function Env. deno-1.13 appwrite/runtime-for-deno:1.13 x86
Function Env. deno-1.14 appwrite/runtime-for-deno:1.14 x86
Function Env. dart-2.10 appwrite/runtime-for-dart:2.10 x86
Function Env. dart-2.12 appwrite/runtime-for-dart:2.12 x86
Function Env. dart-2.13 appwrite/runtime-for-dart:2.13 x86
Function Env. dart-2.14 appwrite/runtime-for-dart:2.14 x86 / arm
Function Env. dotnet-3.1 appwrite/runtime-for-dotnet:3.1 x86
Function Env. dotnet-5.0 appwrite/runtime-for-dotnet:5.0 x86 / arm
Function Env. java-11.0 appwrite/runtime-for-java:11.0 x86
Function Env. java-16.0 appwrite/runtime-for-java:16.0 x86
Function Env. java-17.0 appwrite/runtime-for-java:17.0 x86
Function Env. swift-5.5 appwrite/runtime-for-swift:5.5 x86

Environment Variables

Environment variables supplied by Appwrite in addition to your own defined environment variables that you can access from your function code. These variables give you information about your execution runtime environment.

Name Description
APPWRITE_FUNCTION_ID Your function's unique ID.
APPWRITE_FUNCTION_NAME Your function's name.
APPWRITE_FUNCTION_TAG Your function's code tag unique ID.
APPWRITE_FUNCTION_TRIGGER Either 'event' when triggered by one of the selected scopes, 'http' when triggered by an HTTP request or the Appwrite Console, or 'schedule' when triggered by the cron schedule.
APPWRITE_FUNCTION_RUNTIME_NAME Your function runtime name. Can be any of Appwrite supported execution runtimes.
APPWRITE_FUNCTION_RUNTIME_VERSION Your function runtime version.
APPWRITE_FUNCTION_EVENT Your function event name. This value is available only when your function trigger is 'event.' This variable value can be any of Appwrite system events.
APPWRITE_FUNCTION_EVENT_DATA Your function event payload. This value is available only when your function trigger is 'event'. This variable value contains a string in JSON format with your specific event data.

version >= 0.8.0

Your function's custom execution data. This variable's value contains a string in any format. If the custom data is in JSON FORMAT, it must be parsed inside the function code. Note that this variable can be set only when triggering a function using the SDK or HTTP API and the Appwrite Dashboard.

version >= 0.8.0

Your function's project ID.

version >= 0.8.0

The userId of the user that triggered your function's execution. Executions triggered in the Appwrite console will be prepended with "admin-".

version >= 0.8.0

A JSON Web Token generated for the user that executes your function.

version < 0.8.0 (deprecated)

Your function event payload. Deprecated in favor of APPWRITE_FUNCTION_EVENT_DATA in version 0.8.0.

version < 0.8.0 (deprecated)

Your function environment name. Can be any of Appwrite supported execution environments.

version < 0.8.0 (deprecated)

Your function environment version.

Monitor & Debug

You can monitor your function execution usage stats and logs from your Appwrite console. To access your functions usage stats and logs, click the 'Usage' tab in your function dashboard.

The usage screen in your console will allow you to track the number of execution and your function CPU usage time. You can also review a detailed log of your function execution history, including the function exit code, output log, and error log.

Function usage and logs tracking. Function usage and logs tracking.
Function usage and logs tracking.

Run Offline

You can quickly run your Cloud Function locally by executing the Appwrite runtime locally using its corresponding Docker image. You can pass your offline container any environment variables your script needs and your entry command like in the example below.

  • Unix

    docker run --rm --volume $(pwd):/usr/local/src:rw \
        --env MY_VALUE1="Hello World 1" \
        --env MY_VALUE2="Hello World 2" \
        appwrite/env-node-15.5:1.0.0 \
        node index.js
  • CMD

    docker run --rm --volume "%cd%":/usr/local/src:rw ^
        --env MY_VALUE1="Hello World 1" ^
        --env MY_VALUE2="Hello World 2" ^
        appwrite/env-node-15.5:1.0.0 ^
        node index.js"
  • PowerShell

    docker run --rm --volume ${pwd}:/usr/local/src:rw ,
        --env MY_VALUE1="Hello World 1" ,
        --env MY_VALUE2="Hello World 2" ,
        appwrite/env-node-15.5:1.0.0 ,
        node index.js"

The example above shows how you can mount your current working dir into the "appwrite/env-node-15.5:1.0.0" Cloud Functions runtime and execute a custom command to simulate exactly how the Appwrite server will execute the function on the Appwrite server. You can also pass multiple environment variables that your code might require.

When running a Cloud Functions runtime for a coding language that uses a central directory for managing all dependencies, you will need to package all your dependencies in your working directory under the ".appwrite" folder as mentioned in the "Handling Dependencies" step above. This will ensure your function container can access all required packages and execute your function successfully.

Demos & Examples

There are many Cloud Function demos and examples created by the Appwrite team and community in multiple coding languages. These examples are available at our demos repository on GitHub. You can also submit your examples by submitting a pull-request.