Important
v4 of the Fauna CLI is in beta. For the latest GA version, see the Fauna CLI v3 docs.
The Fauna CLI lets you access Fauna from your terminal. You can use the CLI to:
- Create and manage Fauna databases.
- Manage database schema
as
.fsl
files. - Run FQL queries from files or in an interactive REPL.
- Run a local Fauna container.
- Node.js v20.x or later.
- A Fauna account. You can sign up for a free account at https://dashboard.fauna.com/register.
To get started:
-
Install the CLI:
npm install -g fauna-shell@">=4.0.0-beta"
-
If you're using bash or zsh, enable auto-complete by appending the output of
fauna completion
to your.bashrc
,.bash_profile
,.zshrc,
or.zprofile
. For example:fauna completion >> ~/.zshrc
-
Authenticate with Fauna:
fauna login
-
Run CLI commands. Specify a
--database
, including the Region Group and hierarchy, to run the command in. For example:# Runs a query in the top-level 'my_db' database # in the 'us' Region Group. Use the default admin role. fauna query "Collection.all()" \ --database us/my_db
During the beta, you can install v4 of the Fauna CLI globally using npm:
npm install -g fauna-shell@">=4.0.0-beta"
For usage instructions and a full list of commands, see the Fauna docs.
You can also access help directly in the CLI:
# For general help:
fauna --help
# For a specific command:
fauna <command> --help
# For example:
fauna query --help
See the contribution guidelines.