Skip to main content

Hello World

The simplest Constellation pipeline: take an input, call a module, and produce an output.

Use Case

You want to greet a user by name, using string concatenation and trimming.

The Pipeline

# hello.cst - My first Constellation pipeline

@example("Alice")
in name: String

greeting = concat("Hello, ", name)
trimmed_greeting = trim(greeting)

out trimmed_greeting

Explanation

StepExpressionPurpose
1in name: StringDeclares a required string input
2concat("Hello, ", name)Calls the concat stdlib function to build a greeting
3trim(greeting)Removes any leading/trailing whitespace
4out trimmed_greetingDeclares the pipeline output

The @example("Alice") annotation provides a default value for testing — the dashboard and API use it when no input is supplied.

tip

The @example annotation is not just for documentation. The dashboard pre-fills input forms with these values, enabling one-click testing.

Running the Example

Input

{
"name": "Alice"
}

Expected Output

{
"trimmed_greeting": "Hello, Alice"
}

Variations

Multiple greetings

@example("World")
in name: String

hello = concat("Hello, ", name)
hi = concat("Hi, ", name)
hey = concat("Hey, ", name)

out hello
out hi
out hey

Using string interpolation

@example("Alice")
in name: String

greeting = "Hello, ${name}! Welcome aboard."

out greeting
note

String interpolation with ${...} is preferred over concat() for readability. See String Interpolation for the full syntax.

Best Practices

  1. Always declare typesin name: String gives the compiler type information for downstream validation
  2. Use @example annotations — they serve as documentation and enable one-click testing in the dashboard
  3. Name outputs meaningfully — output names become JSON keys in the API response