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.
- Cluster
- Local
Root Commands
| Command | Subcommands | Description | Context |
|---|---|---|---|
| access-key | create, delete, list, show, update | Manage access keys | |
| config | init, show | Manage CLI configuration | |
| database | backup, create, delete, list, query, query-logs, restore, show, update | Manage databases | |
| help | CLI usage | ||
| profile | create, current, delete, list, switch | Manage your profiles | |
| start | Start the Litebase server locally | ||
| status | Show the status of the Litebase cluster | ||
| token | create, delete, list, show, update | Manage cluster tokens | |
| user | create, delete, list, show, update | Manage cluster users |
Global Flags
| Flag | Description | Default |
|---|---|---|
access-key-id | The ID of the access key to use for authentication | - |
access-key-secret | The secret of the access key to use for authentication | - |
config | The path to the CLI configuration file | - |
help | Show help for the command | - |
interactive | Run the command in interactive mode | true |
password | The password to use for authentication | - |
profile | The profile to use from the CLI configuration | - |
token | The token to use for authentication | - |
url | The URL of the Litebase server to connect to | - |
username | The username to use for authentication | - |
access-key
Manage access keys
litebase access-key Commands
| Command | Description |
|---|---|
access-key create | Create a new access key |
access-key delete <id> | Delete an access key |
access-key list | List 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
litebase access-key create Flags
| Flag | Description | Default |
|---|---|---|
--description | A description for the access key | - |
--statements | Define privileges for this access key using JSON | - |
access-key delete
Delete an access key
litebase access-key delete <id> Parameters
| Parameter | Description |
|---|---|
<id> | The id of the access key to delete |
access-key list
List all access keys
litebase access-key list access-key show
Show details of an access key
litebase access-key show <id> Parameters
| Parameter | Description |
|---|---|
<id> | The id of the access key to show |
access-key update
Update the capabilities of an access key
litebase access-key update <id> Parameters
| Parameter | Description |
|---|---|
<id> | The id of the access key to update |
Flags
| Flag | Description | Default |
|---|---|---|
--description | A description for the access key | - |
--statements | Define privileges for this access key using JSON | - |
config
Manage CLI configuration
litebase config config init
Initialize the CLI configuration
litebase config init Flags
| Flag | Description | Default |
|---|---|---|
--cluster-id | Cluster ID for the server | - |
--config-path | Path to the configuration file | - |
--debug | Enable debug mode | - |
-h, --help | Help for init | - |
-i, --interactive | Run with user interaction (true) | true |
--key | Encryption key (if not provided, one will be generated) | - |
--path | Path to the configuration file | - |
--port | Port to run the server on | 9876 |
--storage-network-path | Path to the network storage directory | - |
--storage-path | Path to the storage directory | - |
--storage-tmp-path | Path to the temporary storage directory | - |
--tls-cert-path | Path to the TLS certificate | - |
--tls-key-path | Path to the TLS key | - |
config show
Show the current CLI configuration
litebase config show database
Manage databases
litebase database [command] Commands
| Command | Description |
|---|---|
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 list | List 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
litebase database backup [command] [--flags] Commands
| Command | Description |
|---|---|
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.
litebase database backup create <database/branch> Parameters
| Parameter | Description |
|---|---|
<name> | The name of the database, including the branch |
database backup delete
Delete a backup of a database, this action is irreversible.
litebase database backup delete <database/branch> <timestamp> Parameters
| Parameter | Description |
|---|---|
<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.
litebase database backup list <database/branch> Parameters
| Parameter | Description |
|---|---|
<database/branch> | The name of the database, including the branch |
database branch
Manage database branches
litebase database branch [command] Commands
| Command | Description |
|---|---|
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
litebase database branch create <database/branch> <new-branch> Parameters
| Parameter | Description |
|---|---|
<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
litebase database branch delete <database/branch> Parameters
| Parameter | Description |
|---|---|
<database> | The name of the database, including the branch |
database branch list
List all database branches
litebase database branch list <database/branch> Parameters
| Parameter | Description |
|---|---|
<database/branch> | The name of the database |
database branch show
Show details of a specific database branch
litebase database branch show <database/branch> Parameters
| Parameter | Description |
|---|---|
<database/branch> | The name of the database, including the branch |
database create
Create a new database
litebase database create <database> Parameters
| Parameter | Description |
|---|---|
<database> | The name of the database |
Flags
| Flag | Description | Default |
|---|---|---|
--primary-branch | The name of the primary branch for the database | main |
database delete
Delete a database
litebase database delete <database> Parameters
| Parameter | Description |
|---|---|
<database> | The name of the database |
database list
List all databases
litebase database list database query
Execute a query on a database
litebase database query <database/branch> <statement> Positional Parameters
litebase database query <database/branch> "SELECT * FROM users WHERE role = ? AND age > ?" \
--parameters '[
{"value": "admin", "type": "TEXT"},
{"value": 25, "type": "INTEGER"}
]' Named Parameters
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
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
| Parameter | Description |
|---|---|
<database/branch> | The name of the database, including the branch |
<statement> | The SQL statement to execute |
Flags
| Flag | Description | Default |
|---|---|---|
--output | The format of the output (json or table) | json |
--parameters | Query parameters in JSON format | - |
--parameter-sets | Multiple sets of query parameters in JSON format | - |
database query-logs
View database query logs
litebase database query-logs [command] Commands
| Command | Description |
|---|---|
database query-logs list <database/branch> | List all query logs |
database query-logs list
List all query logs for a database
litebase database query-logs list <database/branch> Parameters
| Parameter | Description |
|---|---|
<database/branch> | The name of the database, including the branch |
database update
Update a database
litebase database update <database> Parameters
| Parameter | Description |
|---|---|
<database> | The name of the database |
database restore
Restore a database from a backup or snapshot
litebase database restore <source-database/branch> <target-database/branch> Parameters
| Parameter | Description |
|---|---|
<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
litebase database snapshot [command] database snapshot list
List all database snapshots
litebase database snapshot list <database/branch> Parameters
| Parameter | Description |
|---|---|
<database/branch> | The name of the database, including the branch |
database snapshot show
Show a specific database snapshot
litebase database snapshot show <database/branch> <timestamp> Parameters
| Parameter | Description |
|---|---|
<database/branch> | The name of the database, including the branch |
<timestamp> | The timestamp of the snapshot to show |
help
Show help for the CLI
litebase help profile
Manage your profiles
litebase profile Commands
| Command | Description |
|---|---|
profile create <name> | Create a profile |
profile current | Show current |
profile delete <name> | Delete a profile |
profile list | List all profiles |
profile switch <name> | Switch profile |
profile create
Store a new profile in your local configuration
litebase profile create <name> Parameters
| Parameter | Description |
|---|---|
<name> | The name of the profile to create |
Flags
| Flag | Description | Default |
|---|---|---|
--profile-access-key-id | Access Key ID (required if type is Access Key) | - |
--profile-access-key-secret | Access Key Secret (required if type is Access Key) | - |
--profile-cluster | Cluster URL (required) | - |
--profile-name | Name of the profile (required) | - |
--profile-password | Password for Basic Auth (required if type is Basic Auth) | - |
--profile-token | Token value (required if type is Token) | - |
--profile-type | Type of profile (Access Key or Basic Auth) (required) | - |
--profile-username | Username for Basic Auth (required if type is Basic Auth) | - |
profile delete
Delete a profile from your local configuration
litebase profile delete <name> | Parameter | Description |
|---|---|
<name> | The name of the profile to delete |
profile list
List all profiles in your local configuration
litebase profile list profile switch
Switch to a different profile
litebase profile switch <name> Parameters
| Parameter | Description |
|---|---|
<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.
litebase serve Flags
| Flag | Description | Default |
|---|---|---|
--data-path | The path to the data directory | ./.litebase |
--debug | Run the server in debug mode | false |
--help | Display usage help | |
--port | The port to run the server on | 8080 |
--signature | The signature to use for server encryption | - |
--tmp-path | The directory to use for temporary files | ./.litebase-tmp |
--tls-cert | The path to the TLS certificate | - |
--tls-key | The path to the TLS key | - |
Environment Variables:
| Variable | Description | Default |
|---|---|---|
LITEBASE_DATA_PATH | The path to the data directory | ./.litebase |
LITEBASE_DEBUG | The port to run the server on | false |
LITEBASE_PORT | The port to run the server on | 8080 |
LITEBASE_SIGNATURE | The signature to use for server encryption | - |
LITEBASE_TMP_PATH | The path to the temporary directory | ./.litebase-tmp |
LITEBASE_TLS_CERT_PATH | The path to the TLS certificate | - |
LITEBASE_TLS_KEY_PATH | The path to the TLS key | - |
LITEBASE_USERNAME | The username to use when initializing a cluster | root |
status
Show the status of the cluster
litebase status token
Manage tokens
litebase token Commands
| Command | Description |
|---|---|
token create | Create a new token |
token delete <id> | Delete a token |
token list | List tokens |
token show <id> | Show token details |
token update <id> | Update an existing token |
token create
Create a new token
litebase token create [--flags] Flags
| Flag | Description | Default |
|---|---|---|
--description | A description for the token | - |
--statements | Define privileges for this token using JSON | - |
token delete
Delete a token
litebase token delete <id> token list
List tokens
litebase token list token show
Show token details
litebase token show <id> token update
Update an existing token
litebase token update <id> [--flags] Flags
| Flag | Description | Default |
|---|---|---|
--description | A description for the token | - |
--statements | Define privileges for this token using JSON | - |
user
Manage users
litebase user Commands
| Command | Description |
|---|---|
user create | Create a new user |
user delete <username> | Delete a user |
user list | List all users |
user show <username> | Show user details |
user update <username> | Update a user |
user create
Create a new user
litebase user create [--flags] Flags
| Flag | Description | Default |
|---|---|---|
--new-password | Password for the new user | - |
--new-username | Username for the new user | - |
--statements | Define privileges for this user using JSON | - |
user delete
Delete a cluster user
litebase user delete <username> Parameters
| Parameter | Description |
|---|---|
<username> | The username of the user to delete |
user list
List all cluster users
litebase user list user show
Show details of a cluster user
litebase user show <username> Parameters
| Parameter | Description |
|---|---|
<username> | The username of the user to show |
user update
Update a cluster user
litebase user update <username> [--flags] Parameters
| Parameter | Description |
|---|---|
<username> | The username of the user to update |
Flags
| Flag | Description | Default |
|---|---|---|
--statements | Define privileges for this user using JSON | - |