Skip to content

CLI tools

CLI tools

SurrealDB has one command line, surreal. The surreal launcher installs once, then installs, versions and runs components, each with its own commands: the database (surreal db), SurrealDB Cloud (surreal cloud) and WebAssembly modules (surreal mod). This section is the reference for all of them. For how they fit together, start with the SurrealDB CLI guide.

surreal install cloud
surreal db start --user root --pass secret
surreal cloud instance list
ReferenceCovers
Launcher commandsInstalling, upgrading, pinning and removing components, version names, +VERSION, and the launcher's environment variables
surreal dbThe database: run a server, query it, and move data in and out
surreal cloudSurrealDB Cloud: organisations, instances, backups, members and tokens
surreal modWebAssembly modules
surqlfmtFormatting .surql files, distributed separately as an npm package

These commands belong to the launcher, and nothing else installs or changes component versions. See Launcher commands for options and examples.

CommandPurpose
surreal install <COMPONENT[@VERSION]>...Install components, or another version of one beside those installed
surreal upgrade [<COMPONENT[@VERSION]> \| cli]...Upgrade the launcher and every installed component, or those named
surreal use <COMPONENT@VERSION>Make an installed version the default
surreal uninstall <COMPONENT[@VERSION]>...Remove a version, or a component entirely
surreal versionShow each component, the version that runs, and where it runs from
surreal --versionPrint the launcher's version and each component's
surreal +VERSION <COMPONENT> ...Run another version for one command
surreal helpPrint the launcher's help

The database component. Everything after db goes to the database, so the same flags and SURREAL_* variables apply. Each command has its own page under database commands.

CommandPurpose
surreal db startRun a SurrealDB server
surreal db sqlOpen an interactive SurrealQL shell
surreal db importLoad a SurrealQL file into a database
surreal db exportDump a database to SurrealQL
surreal db is-readyCheck that a server accepts connections
surreal db validateValidate SurrealQL files
surreal db fixRepair storage issues
surreal db mlImport and export machine-learning models
surreal db mcpRun the Model Context Protocol server over stdio
surreal db moduleBuild and run WebAssembly modules
surreal db versionPrint the database or server version

The old top-level forms, such as surreal start, still run and print a deprecation warning. Upgrading the database is surreal upgrade db, a launcher command.

The SurrealDB Cloud component. Every command takes --json, and sends its data to stdout and everything else to stderr. See global flags and output and exit codes.

CommandPurpose
surreal cloud authSign in, sign out, and inspect credentials
surreal cloud orgManage organisations, usage, spend and plans
surreal cloud instanceCreate, scale, pause, back up, connect to and delete instances
surreal cloud teamManage organisation members
surreal cloud inviteManage organisation invitations
surreal cloud tokenManage personal access tokens
surreal cloud catalogBrowse regions, instance types and versions
surreal cloud configRead and write configuration
surreal cloud contextInspect and switch profiles
surreal cloud whoami, api, open, status, version, completionIdentity, raw API calls, dashboard links, diagnostics and shell completions

The WebAssembly module component. Its first release is not published yet, and the same workflow is available today as surreal db module. See surreal mod.

surqlfmt reformats .surql files to a consistent style. It is distributed as an npm package rather than as a component of surreal, which makes it easy to pin in a project and run in CI.

npm install -g @surrealdb/surql-fmt
surqlfmt --check ./src/**/*.surql

See the SurrealQL formatter reference for its options and usage patterns.

Was this page helpful?