snapshot
Reference
Snaplet CLI

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

>_ terminal

snaplet auth [action]

login

The snaplet auth login command is used to login with an access token.

Usage

>_ terminal

snaplet auth login [access-token]

config

The snaplet config command is used to manage configuration.

Usage

>_ terminal

snaplet config [action]

generate

The snaplet config generate command is used to generate configuration files.

Usage

>_ terminal

snaplet config generate

Command Flags

NameAliasDescriptionTypeChoicesDefault
--type-tstringtypedefs,transform,generate,keystypedefs
--dry-runbooleanfalse
--connection-stringThe connection string to use for introspecting the databasestring

list

The snaplet config list command is used to list config variables.

Usage

>_ terminal

snaplet config list

pull

The snaplet config pull command is used to pull cloud project config to local.

Usage

>_ terminal

snaplet config pull

Command Flags

NameAliasTypeChoicesDefault
--type-tstringconfig,typedefs,publicKeyconfig,typedefs,publicKey

push

The snaplet config push command is used to push local project config to cloud.

Usage

>_ terminal

snaplet config push

Command Flags

NameAliasTypeChoicesDefault
--type-tstringconfig,publicKeyconfig,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

>_ terminal

snaplet dev

Command Flags

NameDescriptionTypeDefault
--portthe port to expose the proxy onnumber2345

discord

The snaplet discord command is used to open the Snaplet Discord chat window in your browser.

Usage

>_ terminal

snaplet discord

documentation

The snaplet documentation command is used to open the Snaplet Documentation in your browser.

Usage

>_ terminal

snaplet documentation

preview-database

The snaplet preview-database command is used to manage preview databases.

Usage

>_ terminal

snaplet preview-database [action]

create

The snaplet preview-database create command is used to create a preview database from a snapshot.

Usage

>_ terminal

snaplet preview-database create [snapshot]

Command Args

NameDescriptionType
snapshotthe identifier of the snapshot you want to base the preview database onstring

Command Flags

NameDescriptionTypeDefault
--nameassign a custom name to the preview databasestring
--gitderive the preview database name from the current git branchbooleanfalse
--tagsapply tag-based filters to the snapshotsarray
--latestuse the most recent snapshotbooleanfalse

url

The snaplet preview-database url command is used to get a connection URL for a specified preview database.

Usage

>_ terminal

snaplet preview-database url [name]

Command Args

NameDescriptionType
namethe identifier of the preview database whose connection URL you want to retrievestring

Command Flags

NameDescriptionTypeDefault
--gitderive the preview database name from the current git branchbooleanfalse

list

The snaplet preview-database list command is used to show all preview databases created from a specific snapshot.

Usage

>_ terminal

snaplet preview-database list [snapshot]

Command Args

NameDescriptionType
snapshotthe identifier of the snapshot whose preview databases you want to liststring

Command Flags

NameDescriptionType
--tagsapply tag-based filters to the snapshotsarray
--latestuse the most recent snapshotboolean

reset

The snaplet preview-database reset command is used to reset a specified preview database state.

Usage

>_ terminal

snaplet preview-database reset [name]

Command Args

NameDescriptionType
namethe identifier of the preview database you want to resetstring

Command Flags

NameDescriptionTypeDefault
--gitderive the preview database name from the current git branchbooleanfalse

drop

The snaplet preview-database drop command is used to drop a specified preview database.

Usage

>_ terminal

snaplet preview-database drop [name]

Command Args

NameDescriptionType
namethe identifier of the preview database you want to deletestring

Command Flags

NameDescriptionTypeDefault
--gitderive the preview database name from the current git branchbooleanfalse

project

The snaplet project command is used to manage project configuration.

Usage

>_ terminal

snaplet project [action]

create

The snaplet project create command is used to create a new project.

Usage

>_ terminal

snaplet project create <name>

Command Flags

NameAliasType
--team-tstring

invite

The snaplet project invite command is used to create an invite URL for this project.

Usage

>_ terminal

snaplet project invite

setup

The snaplet project setup command is used to set up a project.

Usage

>_ terminal

snaplet project setup [project-id]

Command Args

NameDescriptionType
projectIdThe project idstring

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

>_ terminal

snaplet generate

Command Flags

NameDescriptionTypeDefault
--outputA custom directory path to output the generated assets tostring
--connection-stringThe connection string to use for introspecting the databasebooleanfalse

setup

The snaplet setup command is used to Initialize or connect an existing Snaplet project.

Usage

>_ terminal

snaplet setup

snapshot

The snaplet snapshot command is used to manage snapshots.

Usage

>_ terminal

snaplet snapshot [action]

capture

The snaplet snapshot capture command is used to capture a new snapshot.

Usage

>_ terminal

snaplet snapshot capture [destination-path]

Command Flags

NameAliasDescriptionTypeChoices
--message-mAttach a message to the snapshotstring
--subset--subset-pathPath to a subset config filestring
--tagsAttach tags to the snapshotarray
--transform-mode-tTransformation mode to apply to the snapshotstringstrict,unsafe,auto

create

The snaplet snapshot create command is used to create a snapshot in cloud.

Usage

>_ terminal

snaplet snapshot create

Command Flags

NameTypeDefault
--jsonbooleanfalse

list

The snaplet snapshot list command is used to list all snapshots.

Usage

>_ terminal

snaplet snapshot list

Command Flags

NameType
--tagsarray

restore

The snaplet snapshot restore command is used to restore a snapshot.

Usage

>_ terminal

snaplet snapshot restore [snapshot-name|snapshot-path]

Command Args

NameDescriptionType
snapshot-namesnapshot-paththe unique name or path of the snapshot

Command Flags

NameAliasDescriptionTypeDeprecatedDefault
--dataRestore data on the database (skip with --no-data)booleantrue
--schemaRestore schema on the database (skip with --no-schema)booleantrue
--resetDrop destination database before restoring schemas (skip with --no-reset)booleantrue
--tagsFilter snapshots by tagsarray
--latestRestore the latest snapshotbooleanfalse
--yes-yPerforms a restore without a confirmation messagebooleanfalse
--tablesRestore only the specified tables to the target databasearray
--exclude-tablesExclude the specified tables from being restored to the target databasearray
--progressReport the restore progress into the terminal (silence with --no-progress)booleantrue

share

The snaplet snapshot share command is used to Share a snapshot.

Usage

>_ terminal

snaplet snapshot share [snapshot-name|snapshot-path]

Command Args

NameDescriptionType
snapshot-namesnapshot-paththe unique name or path of the snapshot

Command Flags

NameDescriptionTypeDefault
--no-encryptDisable encryptionbooleanfalse
--tagsFilter snapshots by tagsarray
--latestShare the latest snapshotbooleanfalse

team

The snaplet team command is used to manage team configuration.

Usage

>_ terminal

snaplet team [action]

create

The snaplet team create command is used to create a new team.

Usage

>_ terminal

snaplet team create <name>

upgrade

The snaplet upgrade command is used to upgrade this binary.

Usage

>_ terminal

snaplet upgrade

completion

The snaplet completion command is used to generate completion script.

Usage

>_ terminal

snaplet completion