> For the complete documentation index, see [llms.txt](https://docs.runvelocity.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.runvelocity.dev/components/cli.md).

# CLI

The Velocity CLI is currently the only way you can create and invoke Velocity functions. I will be adding custom function invocation URLs pretty soon.

### Installing the  CLI

Download the precompiled binary for your operating system on the [release page](https://github.com/runvelocity/cli/releases)

### Creating a function

Let's use the CLI to create a function that just returns hello world.  Create a file called `function.js` and input the following code

```javascript
module.exports = (args) => {
    return {
        hello: "world",
    }
}
```

Next, you have to create a zip file containing this code. If you are on windows with poershell, use the following command

```bash
Compress-Archive -LiteralPath .\function.js -DestinationPath  code.zip
```

If you are on Linux/Mac, use the following command

```bash
zip code.zip function.js
```

Next, create a function by running the following command

```bash
.\cli.exe create --name demo-func --file-path code.zip --handler function
```

<figure><img src="https://2271666689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fniv7YUa4LBNpqc1Fl3Sg%2Fuploads%2FdQrNbobyFWuyW2CgG8uH%2Fimage.png?alt=media&amp;token=5f704e50-06a3-48cb-ace1-8e51fe7df316" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
NOTE: By default, the CLI attempts to connect to my self-hosted Manager API which is definitely not guaranteed to be available. To pass in your custom Manager URL, use the `--manager-url` flag.
{% endhint %}

### Listing functions

To list all the functions you have deployed, run the following command

```bash
.\cli.exe list
```

<figure><img src="https://2271666689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fniv7YUa4LBNpqc1Fl3Sg%2Fuploads%2FpruLBNpr5jxK8drIVIgR%2Fimage.png?alt=media&amp;token=32f76e82-8153-4282-a2f9-8a0b4d213406" alt=""><figcaption></figcaption></figure>

### Invoking a function

To invoke a function, run the following command

```bash
.\cli.exe invoke --name demo-func
```

<figure><img src="https://2271666689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fniv7YUa4LBNpqc1Fl3Sg%2Fuploads%2FSrGZP0qrUfkRxjaNDUgd%2Fimage.png?alt=media&amp;token=5a8f32a6-9722-4e41-a8cd-86b4cb37ac72" alt=""><figcaption></figcaption></figure>

### Deleting a function

To delete a function, run the following command

```sh
.\cli.exe delete --name demo-func
```

<figure><img src="https://2271666689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fniv7YUa4LBNpqc1Fl3Sg%2Fuploads%2Fv398ndJpKfRNK8T9DNeq%2Fimage.png?alt=media&amp;token=b9bcb252-a981-4674-8b7e-0af979499dcf" alt=""><figcaption></figcaption></figure>
