• Start

Formatter

SurrealQL Formatter

The surreal fmt command automatically formats SurrealQL files for consistent style and readability.

The surreal fmt command reformats .surql files to follow a consistent style. It adjusts whitespace, indentation, and keyword casing so that SurrealQL code is easy to read and review.

surreal fmt [OPTIONS] [FILE]...

Pass one or more .surql files and the formatter will rewrite them in place. Without arguments it reads from standard input and writes to standard output, which makes it easy to integrate with editor "format on save" features or CI pipelines.

  • Before committing — run surreal fmt on any .surql migration or seed files to keep diffs clean.

  • In CI — add a formatting check to catch inconsistencies early.

  • During development — pipe ad-hoc queries through the formatter for readability.

For the full list of command-line options, see the CLI reference.

Was this page helpful?