This guide provides an overview of creating components for the Edgee Component Registry.

Before diving into development, we highly recommend reviewing these foundational concepts.

Edgee supports two types of components: data collection and edge function components.

The following steps will help you set up the Edgee CLI and authenticate with your Edgee account, which is essential for developing and managing components (both types).

Install and configure the Edgee CLI

Step 1: Install the CLI

First, install the Edgee CLI:

$ curl https://install.edgee.cloud | sh
$ ./edgee --version

Step 2: Authentication

Second, log in using the token from your Edgee account (you can create one here):

$ edgee login
? Your default browser will be opening to Edgee's API token creation page. Do you want to continue? (Y/n)
? Enter Edgee API token (press Ctrl+R to toggle input display): **********
[You can create one at https://www.edgee.cloud/~/me/settings/tokens]
Logged as Your name (email@example.com)

Verify that the API is working correctly using this token:

$ edgee whoami
Logged in as:
  ID:    XYZ-XYZ-DYZ
  Name:  Your name
  Email: your@email.com
  Url:   https://api.edgee.app

Note: the credentials location depends on your operating system.

On Linux, it’s under $HOME/.config/edgee.

On macOS, it’s under $HOME/Library/Application\ Support/edgee.

On Windows, it’s under {FOLDERID_RoamingAppData}\edgee.

Optional commands and configurations

How to upgrade CLI version

Depending on your installation method, you can upgrade to the latest version/release as follows:

$ edgee self-update

How to get CLI help

If you need guidance on a given command or sub-command, check out the help command:

$ edgee help
Usage: edgee <COMMAND>
Commands:
  login                      Log in to the Edgee Console
  whoami                     Print currently login informations
  components                 Components management commands [aliases: component]
  serve                      Run the Edgee server [aliases: server]
  self-update                Update the Edgee executable
  generate-shell-completion  Print auto-completion script for your shell init file
  help                       Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

You can also use it to explore available sub-commands:

$ edgee help components
Usage: edgee components <COMMAND>
Commands:
  build  Compile the component in the current directory into Wasm
  check  Check if the local Wasm file file is valid
  init   Initialize a new manifest file in the current directory
  list   List components you previously pulled (coming soon)
  new    Create component in a new directory with sample code
  pull   Pull a component from the Edgee Component Registry (coming soon)
  push   Push a component to the Edgee Component Registry
  test   Run the component in the current folder with sample events

Or command-specific options:

$ edgee help components test
Usage: edgee components test [OPTIONS]
Options:
  --settings <SETTINGS>            Comma-separated key=value pairs for settings
  --settings-file <SETTINGS_FILE>  File containing the settings
  --event-type <EVENT_TYPE>        The event type you want to test [possible values: page, track, user]
  --display-input                  Whether to log the full input event or not (false by default)
  --curl                           Will print to stdout the cURL command for your EdgeeRequest
  --make-http-request              Will automatically make an HTTP request for your EdgeeRequest

Alternatively, use --help or -h.

How to enable auto-completion

The Edgee CLI can generate completions for all commands and sub-commands.

$ edgee generate-shell-completion [SHELL]
# supported value: bash, elvish, fish, powershell, zsh

If no argument it passed, the CLI will try to guess the shell type based on the environment.

To install the completions, source them in your shell init file:

# ~/.bashrc
$ eval $(edgee generate-shell-completion bash)

Next steps

You can now start developing components for the Edgee Component Registry.