Dexie Cloud CLI
The Dexie Cloud command-line interface
dexie-cloud is an executable npm package. It is the CLI for creating and managing sync databases. You do not have to install the package to use it. The only prerequisit is having node.js installed on your system. The
npx tool that comes with Node.js will download it temporarily from npm when you run any dexie-cloud command, such as
npx dexie-cloud --help.
Creates a database in the cloud.
cd to the root directory of your web app and write:
npx dexie-cloud create
This command creates a new database in the cloud. You will be prompted for your email address and receive an email with the one-time password (OTP) to enter into the next prompt. Once the database has been created, your will also get two files stored in the same directory as you stand in.
|dexie-cloud.json||Contains the URL to your new database|
|dexie-cloud.key||Contains the client ID and secret for further CLI commands|
Neither of these files should be added to git as they represent environment rather than source. It is especially important to not add the .key file as it contains the secret. The files are not needed for the web app to work - they are only useful if you want to run other CLI commands, like white-listing new apps etc. They can also be used to access the Dexie Cloud REST API from a server.
Your email will be stored in the databae as the database owner.
$ npx dexie-cloud create Enter your email address: firstname.lastname@example.org Enter OTP: YourOTP Creating database... Successfully created new database! We created two new local files for you: ======================================= dexie-cloud.json - URL to database dexie-cloud.key - contains client ID and secret
Files to be listed in .gitignore
Deletes a database from the cloud.
npx dexie-cloud delete <Database-URL>
The user will have to authorize the request using email OTP. The system will prompt for email address, which needs to be an email address of a database owner. It is not nescessary to have the dexie-cloud.json or dexie-cloud.key files to do this command.
Allow a web app to use the database.
npx dexie-cloud whitelist npx dexie-cloud whitelist <app origin> [--delete]
The files dexie-cloud.json and dexie-cloud.key has to be in the current or a parent directory.
- Without arguments: list all white-listed origins.
- With arguments: add origins so white list.
- With flag [–delete] deletes the origins instead of adding them.
# Lists all whitelisted origins npx dexie-cloud whitelist # White-list new origins npx dexie-cloud whitelist http://localhost:8080 npx dexie-cloud whitelist https://myapp.company.com # Remove http://localhost:8080 from being white-listed npx dexie-cloud whitelist http://localhost:8080 --delete
npx dexie-cloud add-replica <URL to the other Dexie Cloud server>