Visibility

By default all declarations in FTL are visible only to the module they're declared in. The implicit visibility of types is that of the first verb or other declaration that references it.

Exporting declarations

Exporting a declaration makes it accessible to other modules. Some declarations that are entirely local to a module, such as secrets/config, cannot be exported.

Types that are transitively referenced by an exported declaration will be automatically exported unless they were already defined but unexported. In this case, an error will be raised and the type must be explicitly exported.

The following table describes the directives used to export the corresponding declaration:

SymbolExport syntax
Verb//ftl:verb export
Data//ftl:data export
Enum/Sum type//ftl:enum export
Typealias//ftl:typealias export
Topic//ftl:export 1

eg.

//ftl:verb export
func Verb(ctx context.Context, in In) (Out, error)

//ftl:typealias export
type UserID string
1

By default, topics do not require any annotations as the declaration itself is sufficient.