Command Line Interface

CLI Reference

The Litebase CLI provides commands for managing clusters, databases, branches, and related resources. This page documents all available CLI commands and their usage.

The following commands are available in the CLI. Please note that some commands are executed locally.

Contexts
  • Cluster

  • Local

Root Commands

CommandSubcommandsDescriptionContext
access-keycreate, delete, list, show, updateManage access keys
configinit, showManage CLI configuration
databasebackup, create, delete, list, query, query-logs, restore, show, updateManage databases
helpCLI usage
profilecreate, current, delete, list, switchManage your profiles
startStart the Litebase server locally
statusShow the status of the Litebase cluster
tokencreate, delete, list, show, updateManage cluster tokens
usercreate, delete, list, show, updateManage cluster users

Global Flags

FlagDescriptionDefault
access-key-idThe ID of the access key to use for authentication-
access-key-secretThe secret of the access key to use for authentication-
configThe path to the CLI configuration file-
helpShow help for the command-
interactiveRun the command in interactive modetrue
passwordThe password to use for authentication-
profileThe profile to use from the CLI configuration-
tokenThe token to use for authentication-
urlThe URL of the Litebase server to connect to-
usernameThe username to use for authentication-

access-key

Manage access keys

shell
litebase access-key

Commands

CommandDescription
access-key createCreate a new access key
access-key delete <id>Delete an access key
access-key listList all access keys
access-key show <id>Show details of an access key
access-key update <id>Update the capabilities of an access key

access-key create

Create a new access key

shell
litebase access-key create

Flags

FlagDescriptionDefault
--descriptionA description for the access key-
--statementsDefine privileges for this access key using JSON-

access-key delete

Delete an access key

shell
litebase access-key delete <id>

Parameters

ParameterDescription
<id>The id of the access key to delete

access-key list

List all access keys

shell
litebase access-key list

access-key show

Show details of an access key

shell
litebase access-key show <id>

Parameters

ParameterDescription
<id>The id of the access key to show

access-key update

Update the capabilities of an access key

shell
litebase access-key update <id>

Parameters

ParameterDescription
<id>The id of the access key to update

Flags

FlagDescriptionDefault
--descriptionA description for the access key-
--statementsDefine privileges for this access key using JSON-

config

Manage CLI configuration

shell
litebase config

config init

Initialize the CLI configuration

shell
litebase config init

Flags

FlagDescriptionDefault
--cluster-idCluster ID for the server-
--config-pathPath to the configuration file-
--debugEnable debug mode-
-h, --helpHelp for init-
-i, --interactiveRun with user interaction (true)true
--keyEncryption key (if not provided, one will be generated)-
--pathPath to the configuration file-
--portPort to run the server on9876
--storage-network-pathPath to the network storage directory-
--storage-pathPath to the storage directory-
--storage-tmp-pathPath to the temporary storage directory-
--tls-cert-pathPath to the TLS certificate-
--tls-key-pathPath to the TLS key-

config show

Show the current CLI configuration

shell
litebase config show

database

Manage databases

shell
litebase database [command]

Commands

CommandDescription
database backup [command]Manage database backups
database branch [command]Manage database branches
database create <database>Create a new database
database delete <database>Delete a database
database listList databases
database query <database/branch> <statement>Execute a query on a database
database query-logs [command]View database query logs
database restore <...parameters> [--flag]Restore a database
database show <database>Get a database
database snapshot [command]View database snapshots
database update <database>Update an existing database

database backup

Manage database backups

shell
litebase database backup [command] [--flags]

Commands

CommandDescription
database backup create <database/branch>Create a new database backup
database backup delete <database/branch> <timestamp>Delete a database backup
database backup list <database/branch>List database backups
database backup show <database/branch> <timestamp>Show details of a specific database backup

database backup create

Create a new backup of a database.

shell
litebase database backup create <database/branch>

Parameters

ParameterDescription
<name>The name of the database, including the branch

database backup delete

Delete a backup of a database, this action is irreversible.

shell
litebase database backup delete <database/branch> <timestamp>

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch
<timestamp>The timestamp of the backup to delete

database backup list

List all backups of a database.

shell
litebase database backup list <database/branch>

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch

database branch

Manage database branches

shell
litebase database branch [command]

Commands

CommandDescription
database branch create <database>Create a new database branch
database branch delete <database/branch>Delete a database branch
database branch list <database>List all database branches
database branch show <database/branch>Show details of a specific database branch

database branch create

Create a new database branch

shell
litebase database branch create <database/branch> <new-branch>

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch
<new-branch>The name of the new branch to create

database branch delete

Delete a database branch

shell
litebase database branch delete <database/branch>

Parameters

ParameterDescription
<database>The name of the database, including the branch

database branch list

List all database branches

shell
litebase database branch list <database/branch>

Parameters

ParameterDescription
<database/branch>The name of the database

database branch show

Show details of a specific database branch

shell
litebase database branch show <database/branch>

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch

database create

Create a new database

shell
litebase database create <database>

Parameters

ParameterDescription
<database>The name of the database

Flags

FlagDescriptionDefault
--primary-branchThe name of the primary branch for the databasemain

database delete

Delete a database

shell
litebase database delete <database>

Parameters

ParameterDescription
<database>The name of the database

database list

List all databases

shell
litebase database list

database query

Execute a query on a database

shell
litebase database query <database/branch> <statement>

Positional Parameters

shell
litebase database query <database/branch> "SELECT * FROM users WHERE role = ? AND age > ?" \
  --parameters '[
    {"value": "admin", "type": "TEXT"},
    {"value": 25, "type": "INTEGER"}
  ]'

Named Parameters

shell
litebase database query <database/branch> "SELECT * FROM users WHERE role = :role AND age > :min_age" \
  --parameters '[
    {"name": "role", "value": "admin", "type": "TEXT"},
    {"name": "min_age", "value": 25, "type": "INTEGER"}
  ]'

Multiple Parameter Sets

shell
litebase database query <database/branch> "INSERT INTO users (name, age) VALUES (?, ?)" \
  --parameter-sets '[
    [
      {"value": "bob", "type": "TEXT"},
      {"value": 30, "type": "INTEGER"}
    ],
    [
      {"value": "alice", "type": "TEXT"},
      {"value": 25, "type": "INTEGER"}
    ],
    [
      {"value": "charlie", "type": "TEXT"},
      {"value": 35, "type": "INTEGER"}
    ]
  ]'

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch
<statement>The SQL statement to execute

Flags

FlagDescriptionDefault
--outputThe format of the output (json or table)json
--parametersQuery parameters in JSON format-
--parameter-setsMultiple sets of query parameters in JSON format-

database query-logs

View database query logs

shell
litebase database query-logs [command]

Commands

CommandDescription
database query-logs list <database/branch>List all query logs

database query-logs list

List all query logs for a database

shell
litebase database query-logs list <database/branch>

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch

database update

Update a database

shell
litebase database update <database>

Parameters

ParameterDescription
<database>The name of the database

database restore

Restore a database from a backup or snapshot

shell
litebase database restore <source-database/branch> <target-database/branch>

Parameters

ParameterDescription
<source-database/branch>The name of the source database, including the branch
<target-database/branch>The name of the target database, including the branch

database snapshot

View database snapshots

shell
litebase database snapshot [command]

database snapshot list

List all database snapshots

shell
litebase database snapshot list <database/branch>

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch

database snapshot show

Show a specific database snapshot

shell
litebase database snapshot show <database/branch> <timestamp>

Parameters

ParameterDescription
<database/branch>The name of the database, including the branch
<timestamp>The timestamp of the snapshot to show

help

Show help for the CLI

shell
litebase help

profile

Manage your profiles

shell
litebase profile

Commands

CommandDescription
profile create <name>Create a profile
profile currentShow current
profile delete <name>Delete a profile
profile listList all profiles
profile switch <name>Switch profile

profile create

Store a new profile in your local configuration

shell
litebase profile create <name>

Parameters

ParameterDescription
<name>The name of the profile to create

Flags

FlagDescriptionDefault
--profile-access-key-idAccess Key ID (required if type is Access Key)-
--profile-access-key-secretAccess Key Secret (required if type is Access Key)-
--profile-clusterCluster URL (required)-
--profile-nameName of the profile (required)-
--profile-passwordPassword for Basic Auth (required if type is Basic Auth)-
--profile-tokenToken value (required if type is Token)-
--profile-typeType of profile (Access Key or Basic Auth) (required)-
--profile-usernameUsername for Basic Auth (required if type is Basic Auth)-

profile delete

Delete a profile from your local configuration

shell
litebase profile delete <name>
ParameterDescription
<name>The name of the profile to delete

profile list

List all profiles in your local configuration

shell
litebase profile list

profile switch

Switch to a different profile

shell
litebase profile switch <name>

Parameters

ParameterDescription
<name>The name of the profile to switch

serve

Start an instance of the Litebase server. The server can be configured with the following options as command flags or environment variables.

shell
litebase serve

Flags

FlagDescriptionDefault
--data-pathThe path to the data directory./.litebase
--debugRun the server in debug modefalse
--helpDisplay usage help
--portThe port to run the server on8080
--signatureThe signature to use for server encryption-
--tmp-pathThe directory to use for temporary files./.litebase-tmp
--tls-certThe path to the TLS certificate-
--tls-keyThe path to the TLS key-

Environment Variables:

VariableDescriptionDefault
LITEBASE_DATA_PATHThe path to the data directory./.litebase
LITEBASE_DEBUGThe port to run the server onfalse
LITEBASE_PORTThe port to run the server on8080
LITEBASE_SIGNATUREThe signature to use for server encryption-
LITEBASE_TMP_PATHThe path to the temporary directory./.litebase-tmp
LITEBASE_TLS_CERT_PATHThe path to the TLS certificate-
LITEBASE_TLS_KEY_PATHThe path to the TLS key-
LITEBASE_USERNAMEThe username to use when initializing a clusterroot

status

Show the status of the cluster

shell
litebase status

token

Manage tokens

shell
litebase token

Commands

CommandDescription
token createCreate a new token
token delete <id>Delete a token
token listList tokens
token show <id>Show token details
token update <id>Update an existing token

token create

Create a new token

shell
litebase token create [--flags]

Flags

FlagDescriptionDefault
--descriptionA description for the token-
--statementsDefine privileges for this token using JSON-

token delete

Delete a token

shell
litebase token delete <id>

token list

List tokens

shell
litebase token list

token show

Show token details

shell
litebase token show <id>

token update

Update an existing token

shell
litebase token update <id> [--flags]

Flags

FlagDescriptionDefault
--descriptionA description for the token-
--statementsDefine privileges for this token using JSON-

user

Manage users

shell
litebase user

Commands

CommandDescription
user createCreate a new user
user delete <username>Delete a user
user listList all users
user show <username>Show user details
user update <username>Update a user

user create

Create a new user

shell
litebase user create [--flags]

Flags

FlagDescriptionDefault
--new-passwordPassword for the new user-
--new-usernameUsername for the new user-
--statementsDefine privileges for this user using JSON-

user delete

Delete a cluster user

shell
litebase user delete <username>

Parameters

ParameterDescription
<username>The username of the user to delete

user list

List all cluster users

shell
litebase user list

user show

Show details of a cluster user

shell
litebase user show <username>

Parameters

ParameterDescription
<username>The username of the user to show

user update

Update a cluster user

shell
litebase user update <username> [--flags]

Parameters

ParameterDescription
<username>The username of the user to update

Flags

FlagDescriptionDefault
--statementsDefine privileges for this user using JSON-