PowerSync CLI
npm install powersyncProgrammatically manage your PowerSync environment.
For an overview, see the docs here.
sh-session
$ npx powersync
$ npx powersync COMMAND
running command...
$ npx powersync --help [COMMAND]
USAGE
$ npx powersync COMMAND
...
`
Inject ENV variables
The following environment variables can be injected:
*
AUTH_TOKEN - The access token used to authenticate with the PowerSync service. Learn more.
* ORG_ID - The PowerSync organization ID. This is the first UUID in your project's dashboard URL. 123 in this example: https://powersync.journeyapps.com/org/123/app/456.
* PROJECT_ID - The PowerSync project ID. This is the second UUID in your project's dashboard URL. 456 in this example: https://powersync.journeyapps.com/org/123/app/456.
* INSTANCE_ID - The PowerSync instance ID. Get this by running npx powersync instances.Example:
ORG_ID=123 PROJECT_ID=456 INSTANCE_ID=789 npx powersync instance statusCommands
* [
powersync help [COMMAND]](#powersync-help-command)
* powersync init
* powersync instance config
* powersync instance create
* powersync instance deploy
* powersync instance destroy
* powersync instance generate-dev-token
* powersync instance schema
* powersync instance set
* powersync instance status
* powersync instance stop
* powersync instance sync-rules deploy
* powersync instance sync-rules generate-schema
* powersync instance sync-rules validate
* powersync instancespowersync help [COMMAND]Display help for powersync.
`
USAGE
$ npx powersync help [COMMAND...] [-n]ARGUMENTS
COMMAND... Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for powersync.
`_See code: @oclif/plugin-help_
powersync initInitialize the CLI.
Requires an access token. Learn how to generate these here.
`
USAGE
$ npx powersync initDESCRIPTION
Initialize the CLI.
EXAMPLES
$ npx powersync init
`_See code: src/commands/init.ts_
powersync instance configDisplay the instance config.
`
USAGE
$ npx powersync instance configDESCRIPTION
Display the instance config.
EXAMPLES
$ npx powersync instance config
`_See code: src/commands/instance/config.ts_
powersync instance createCreate a new instance.
`
USAGE
$ npx powersync instance create [-i ] [--protocol ] [-r ] [-t postgresql|mongodb] [-n ] [-h
] [-w ] [-a ] [-o ] [-s] [-j ] [-b]FLAGS
-a, --jwtAudiences= JWT audiences (comma separated).
-b, --[no-]useSupabaseAuth Use Supabase auth.
-h, --hostname= Hostname to connect to database.
-i, --name= Name of the instance.
-j, --supabaseJWTSecret= Supabase JWT secret
-n, --databaseName= Name of the database.
-o, --port= Port number to connect to database.
-r, --region= Region to deploy instance to.
-s, --skipInteraction Skip interactivity.
-t, --connectionType=
DESCRIPTION
Create a new instance.
EXAMPLES
$ npx powersync instance create
`_See code: src/commands/instance/create.ts_
powersync instance deployDeploy changes to an existing instance.
`
USAGE
$ npx powersync instance deploy [--protocol ] [-r ] [-t postgresql|mongodb] [-n ] [-h ] [-w
] [-a ] [-o ] [-s] [-j ] [-b]FLAGS
-a, --jwtAudiences= JWT audiences (comma separated).
-b, --[no-]useSupabaseAuth Use Supabase auth.
-h, --hostname= Hostname to connect to database.
-j, --supabaseJWTSecret= Supabase JWT secret
-n, --databaseName= Name of the database.
-o, --port= Port number to connect to database.
-r, --region= Region to deploy instance to.
-s, --skipInteraction Skip interactivity.
-t, --connectionType=
DESCRIPTION
Deploy changes to an existing instance.
EXAMPLES
$ npx powersync instance deploy
`_See code: src/commands/instance/deploy.ts_
powersync instance destroyDestroy the current instance - THIS CANNOT BE UNDONE.
`
USAGE
$ npx powersync instance destroy [-s]FLAGS
-s, --skipConfirmation Ignore confirmation question.
DESCRIPTION
Destroy the current instance - THIS CANNOT BE UNDONE.
EXAMPLES
$ npx powersync instance destroy
`_See code: src/commands/instance/destroy.ts_
powersync instance generate-dev-tokenGenerate a developer token using the Token subject/ User ID.
`
USAGE
$ npx powersync instance generate-dev-token [-e ] [-u ]FLAGS
-e, --expiresInSeconds= The token expiry in seconds.
-u, --userId= The Token subject/User ID for the developer token
DESCRIPTION
Generate a developer token using the Token subject/ User ID.
EXAMPLES
$ npx powersync instance generate-dev-token
`_See code: src/commands/instance/generate-dev-token.ts_
powersync instance schemaView the schema of the current instance.
`
USAGE
$ npx powersync instance schemaDESCRIPTION
View the schema of the current instance.
EXAMPLES
$ npx powersync instance schema
`_See code: src/commands/instance/schema.ts_
powersync instance setSet the current instance.
`
USAGE
$ npx powersync instance set [-i ]FLAGS
-i, --instanceId= Instance ID to change to.
DESCRIPTION
Set the current instance.
EXAMPLES
$ npx powersync instance set
$ npx powersync instance set --instanceId=1234
`_See code: src/commands/instance/set.ts_
powersync instance statusView the status of the current instance. View the status of a different instance by using flags.
`
USAGE
$ npx powersync instance status [-t ] [-i ] [-o ] [-p ]FLAGS
-i, --instanceId= Override current instance by providing the ID of a different instance.
-o, --orgId= Override current organization by providing the ID of a different organization.
-p, --projectId= Override current project by providing the ID of a different project.
-t, --authToken= Override current auth token.
DESCRIPTION
View the status of the current instance. View the status of a different instance by using flags.
EXAMPLES
$ npx powersync instance status
$ npx powersync instance status --orgId=1234 --projectId=1234 --instanceId=1234 --authToken=1234
`_See code: src/commands/instance/status.ts_
powersync instance stopStop the current instance.
`
USAGE
$ npx powersync instance stop [-s]FLAGS
-s, --skipConfirmation Ignore confirmation question.
DESCRIPTION
Stop the current instance.
EXAMPLES
$ npx powersync instance stop
`_See code: src/commands/instance/stop.ts_
powersync instance sync-rules deployDeploy sync rules from a local sync rules config file to the current instance.
`
USAGE
$ npx powersync instance sync-rules deploy -f [-s]FLAGS
-f, --filePath= (required) Path to the sync rules config file.
-s, --skipConfirmation Ignore confirmation question.
DESCRIPTION
Deploy sync rules from a local sync rules config file to the current instance.
EXAMPLES
$ npx powersync instance sync-rules deploy
$ npx powersync instance sync-rules deploy --filePath path/to/file
$ npx powersync instance sync-rules deploy -f path/to/file
`_See code: src/commands/instance/sync-rules/deploy.ts_
powersync instance sync-rules generate-schemaGenerate schema in your language from your sync rules config file.
`
USAGE
$ npx powersync instance sync-rules generate-schema -f [-l js|dart]FLAGS
-f, --filePath= (required) Path to the sync rules config file.
-l, --language=
DESCRIPTION
Generate schema in your language from your sync rules config file.
EXAMPLES
$ npx powersync instance sync-rules generate-schema
$ npx powersync instance sync-rules generate-schema --filePath path/to/file
$ npx powersync instance sync-rules generate-schema -f path/to/file
`_See code: src/commands/instance/sync-rules/generate-schema.ts_
powersync instance sync-rules validateValidate sync rules from a local sync rules config file.
`
USAGE
$ npx powersync instance sync-rules validate -f FLAGS
-f, --filePath= (required) Path to the sync rules config file.
DESCRIPTION
Validate sync rules from a local sync rules config file.
EXAMPLES
$ npx powersync instance sync-rules validate
$ npx powersync instance sync-rules validate --filePath path/to/file
$ npx powersync instance sync-rules validate -f path/to/file
`_See code: src/commands/instance/sync-rules/validate.ts_
powersync instancesView list of instances.
`
USAGE
$ npx powersync instancesDESCRIPTION
View list of instances.
EXAMPLES
$ npx powersync instances
``_See code: src/commands/instances.ts_