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
| Step | Expression | Purpose |
|---|---|---|
| 1 | in name: String | Declares a required string input |
| 2 | concat("Hello, ", name) | Calls the concat stdlib function to build a greeting |
| 3 | trim(greeting) | Removes any leading/trailing whitespace |
| 4 | out trimmed_greeting | Declares 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
- Always declare types —
in name: Stringgives the compiler type information for downstream validation - Use
@exampleannotations — they serve as documentation and enable one-click testing in the dashboard - Name outputs meaningfully — output names become JSON keys in the API response
Related Examples
- Simple Transform — single module call pattern
- Text Analysis — multi-step text processing
- String Interpolation —
${expression}syntax