CLI Commands
You can use the Command-Line Interface (CLI) provided by Snaplet to manage your data from a terminal window.
auth
The snaplet auth
command is used to manage auth state.
Usage
login
The snaplet auth login
command is used to login with an access token.
Usage
config
The snaplet config
command is used to manage configuration.
Usage
generate
The snaplet config generate
command is used to generate configuration files.
Usage
Command Flags
Name | Alias | Description | Type | Choices | Default |
---|---|---|---|---|---|
--type | -t | string | typedefs,transform,generate,keys | typedefs | |
--dry-run | boolean | false | |||
--connection-string | The connection string to use for introspecting the database | string |
list
The snaplet config list
command is used to list config variables.
Usage
pull
The snaplet config pull
command is used to pull cloud project config to local.
Usage
Command Flags
Name | Alias | Type | Choices | Default |
---|---|---|---|---|
--type | -t | string | config,typedefs,publicKey | config,typedefs,publicKey |
push
The snaplet config push
command is used to push local project config to cloud.
Usage
Command Flags
Name | Alias | Type | Choices | Default |
---|---|---|---|---|
--type | -t | string | config,publicKey | config,publicKey |
dev
The snaplet dev
command is used to keep your dev database and its data in sync with your git branch so you don't have to, powered by Neon.
Usage
Command Flags
Name | Description | Type | Default |
---|---|---|---|
--port | the port to expose the proxy on | number | 2345 |
discord
The snaplet discord
command is used to open the Snaplet Discord chat window in your browser.
Usage
documentation
The snaplet documentation
command is used to open the Snaplet Documentation in your browser.
Usage
preview-database
The snaplet preview-database
command is used to manage preview databases.
Usage
create
The snaplet preview-database create
command is used to create a preview database from a snapshot.
Usage
Command Args
Name | Description | Type |
---|---|---|
snapshot | the identifier of the snapshot you want to base the preview database on | string |
Command Flags
Name | Description | Type | Default |
---|---|---|---|
--name | assign a custom name to the preview database | string | |
--git | derive the preview database name from the current git branch | boolean | false |
--tags | apply tag-based filters to the snapshots | array | |
--latest | use the most recent snapshot | boolean | false |
url
The snaplet preview-database url
command is used to get a connection URL for a specified preview database.
Usage
Command Args
Name | Description | Type |
---|---|---|
name | the identifier of the preview database whose connection URL you want to retrieve | string |
Command Flags
Name | Description | Type | Default |
---|---|---|---|
--git | derive the preview database name from the current git branch | boolean | false |
list
The snaplet preview-database list
command is used to show all preview databases created from a specific snapshot.
Usage
Command Args
Name | Description | Type |
---|---|---|
snapshot | the identifier of the snapshot whose preview databases you want to list | string |
Command Flags
Name | Description | Type |
---|---|---|
--tags | apply tag-based filters to the snapshots | array |
--latest | use the most recent snapshot | boolean |
reset
The snaplet preview-database reset
command is used to reset a specified preview database state.
Usage
Command Args
Name | Description | Type |
---|---|---|
name | the identifier of the preview database you want to reset | string |
Command Flags
Name | Description | Type | Default |
---|---|---|---|
--git | derive the preview database name from the current git branch | boolean | false |
drop
The snaplet preview-database drop
command is used to drop a specified preview database.
Usage
Command Args
Name | Description | Type |
---|---|---|
name | the identifier of the preview database you want to delete | string |
Command Flags
Name | Description | Type | Default |
---|---|---|---|
--git | derive the preview database name from the current git branch | boolean | false |
project
The snaplet project
command is used to manage project configuration.
Usage
create
The snaplet project create
command is used to create a new project.
Usage
Command Flags
Name | Alias | Type |
---|---|---|
--team | -t | string |
invite
The snaplet project invite
command is used to create an invite URL for this project.
Usage
setup
The snaplet project setup
command is used to set up a project.
Usage
Command Args
Name | Description | Type |
---|---|---|
projectId | The project id | string |
generate
The snaplet generate
command is used to:
- regenerate the assets needed by
@snaplet/seed
- regenerate the typedefs needed for
snaplet.config.ts
.
Snaplet will look at your database and generates a library that corresponds to your database structure. You would typically run this whenever you have changed your database structure, so that the assets used by @snaplet/seed
correspond to your new database structure.
If you are familiar with @prisma/client
(opens in a new tab), you can think of snaplet generate
doing the same thing, just in this case for @snaplet/seed
rather than @prisma/client
.
Usage
Command Flags
Name | Description | Type | Default |
---|---|---|---|
--output | A custom directory path to output the generated assets to | string | |
--connection-string | The connection string to use for introspecting the database | boolean | false |
setup
The snaplet setup
command is used to Initialize or connect an existing Snaplet project.
Usage
snapshot
The snaplet snapshot
command is used to manage snapshots.
Usage
capture
The snaplet snapshot capture
command is used to capture a new snapshot.
Usage
Command Flags
Name | Alias | Description | Type | Choices |
---|---|---|---|---|
--message | -m | Attach a message to the snapshot | string | |
--subset | --subset-path | Path to a subset config file | string | |
--tags | Attach tags to the snapshot | array | ||
--transform-mode | -t | Transformation mode to apply to the snapshot | string | strict,unsafe,auto |
create
The snaplet snapshot create
command is used to create a snapshot in cloud.
Usage
Command Flags
Name | Type | Default |
---|---|---|
--json | boolean | false |
list
The snaplet snapshot list
command is used to list all snapshots.
Usage
Command Flags
Name | Type |
---|---|
--tags | array |
restore
The snaplet snapshot restore
command is used to restore a snapshot.
Usage
Command Args
Name | Description | Type |
---|---|---|
snapshot-name | snapshot-path | the unique name or path of the snapshot |
Command Flags
Name | Alias | Description | Type | Deprecated | Default |
---|---|---|---|---|---|
--data | Restore data on the database (skip with --no-data) | boolean | true | ||
--schema | Restore schema on the database (skip with --no-schema) | boolean | true | ||
--reset | Drop destination database before restoring schemas (skip with --no-reset) | boolean | true | ||
--tags | Filter snapshots by tags | array | |||
--latest | Restore the latest snapshot | boolean | false | ||
--yes | -y | Performs a restore without a confirmation message | boolean | false | |
--tables | Restore only the specified tables to the target database | array | |||
--exclude-tables | Exclude the specified tables from being restored to the target database | array | |||
--progress | Report the restore progress into the terminal (silence with --no-progress) | boolean | true |
share
The snaplet snapshot share
command is used to Share a snapshot.
Usage
Command Args
Name | Description | Type |
---|---|---|
snapshot-name | snapshot-path | the unique name or path of the snapshot |
Command Flags
Name | Description | Type | Default |
---|---|---|---|
--no-encrypt | Disable encryption | boolean | false |
--tags | Filter snapshots by tags | array | |
--latest | Share the latest snapshot | boolean | false |
team
The snaplet team
command is used to manage team configuration.
Usage
create
The snaplet team create
command is used to create a new team.
Usage
upgrade
The snaplet upgrade
command is used to upgrade this binary.
Usage
completion
The snaplet completion
command is used to generate completion script.
Usage