Skip to main content
Tasks are user-defined functions in tasks/. Run them locally with veryfront task <name> or in the cloud as task runs.

Prerequisites

  • A Veryfront project with the tasks/ directory available (see Create project).
  • For cloud execution: a VERYFRONT_API_TOKEN and a project reference (see Configuration).

Quick start

Create a task file:
Run it locally:

Task definition

A task file exports a TaskDefinition object as its default export:

Task context

The run function receives a TaskContext:
  • env: filtered environment variables (use envAllowlist to restrict)
  • config: run configuration (passed when run in the cloud)
  • projectId: project identifier (available in cloud context)

Discovery

Tasks are discovered automatically from the tasks/ directory:
File extensions .ts, .tsx, .js, .jsx are supported. Test files and node_modules are ignored.

Running tasks

CLI

Task IDs come from files under tasks/.

As a cloud run

Tasks with schedulable: true can be targeted by runs and schedules:
See Runs for run creation and event monitoring.

Verify it worked

Run the task locally first:
A passing task prints any console.log output, exits with status 0, and returns the value you returned from run as the final JSON line. For cloud execution, create a run that targets the task and check Studio for a completed status. See the verification block in Runs for the SDK-driven check.