# CloudCode Overview

### Introduction

CloudCode is a JourneyApps feature to run JavaScript or TypeScript "tasks" in the cloud, instead of on a mobile device.

Typical use cases include:

* Basic integration with external services
* Bulk operations such as archiving data
* Generating reports, such as CSV files, PDF reports or Excel spreadsheets
* Sending emails
* Scheduled tasks

#### NodeJS environment

CloudCode tasks are NodeJS-based. The specific NodeJS version depends on the CloudCode task version:

| CloudCode Version      | Node Version |
| ---------------------- | ------------ |
| `1.15.x`               | `v22`        |
| `1.13.x` to `1.14.x`   | `v20`        |
| `1.12.x`               | `v16`        |
| `1.11.x`               | `v14`        |
| `1.10.x` \[Deprecated] | `v12`        |

{% hint style="info" %}
**CloudCode task versions**

A CloudCode task version can be configured by right-clicking on the task name in OXIDE and selecting **CloudCode task settings**.
{% endhint %}

CloudCode makes extensive use of async & await. For an introduction, see this [Async & Await](https://docs.journeyapps.com/reference/build/syntax/async-and-await) section.

All CloudCode tasks run on servers managed by Amazon Web Services (AWS).&#x20;

**Basic CloudCode task structure**

A basic task has the following structure:

```javascript
export async function run() {
    // Your code here
}
```

#### CloudCode task triggers

CloudCode tasks can be triggered in one of following ways:

* Via the **Test CloudCode Task** action in OXIDE
* Via a webhook
* Via HTTP
* Enqueued from another task
* Directly from an App
* On a schedule

You can read more about [Triggering a CloudCode Task.](https://docs.journeyapps.com/reference/cloudcode/triggering-a-cloudcode-task)

### Available packages

The following packages are available in each CloudCode task by default:

* `node-fetch` (exposed as a `fetch` global function).
* `aws-sdk`

To add other packages, see [CloudCode: Dependencies](https://docs.journeyapps.com/reference/cloudcode/advanced-cloudcode-topics/cloudcode-dependencies).

### Limits

* Each task invocation can run for a maximum of 5 minutes.
* Each task invocation has a limit of 1024MB memory.
* Each task can run multiple times in parallel.
* When invoking a task, parameters are converted using `JSON.stringify` and the resulting string should not exceed 5MB.
* Web Tasks accept a maximum `body` size of 5MB for incoming requests, and will return HTTP 413 if this is exceeded.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.journeyapps.com/reference/cloudcode/cloudcode-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
