Install

To use ElectricSQL, you need to install the CLI tool and the Typescript client library.

1. CLI tool

The ElectricSQL command line interface (CLI) tool is used to configure your application and to build and upload your DDL migrations. It’s also useful for interacting with the ElectricSQL service, for example to create and manage applications.

Homebrew

If you’re on OSX, you can install using our Homebrew tap:

brew install electric-sql/tap/electric

Binaries

Alternatively, you can install pre-built binaries directly from the releases page.

Filenames follow the electricsql_cli_<VERSION>_<TARGET_ARCHITECTURE> pattern, such as electricsql_cli_v0.2.1_intel_mac). Download the file corresponding to your target architecture, make it executable and put it on your path, e.g.:

curl <DOWNLOAD_URL> -o electric
chmod +x electric
mv electric /usr/local/bin

Source

The CLI is developed in Elixir at github.com/electric-sql/cli. You can install from source and build a binary locally by following the instructions there.

Usage

Once installed, see usage information using electric --help:

electric --help

You should see output like this:

ElectricSQL CLI <VERSION>
Command line interface to the https://electric-sql.com service.

USAGE:
    electric [--verbose]
    electric --version
    electric --help
    electric help subcommand

FLAGS:

    -v, --verbose        Output more information about the CLI actions.

SUBCOMMANDS:

    accounts          Manage accounts.
    apps              Manage backend applications.
    auth              Log-in and manage authentication status.
    build             Build your config and migrations.
    config            Manage local configuration.
    init              Initialise a new application.
    migrations        Manage DDL schema migrations.
    reset             Reset your backend.
    sync              Sync migrations upto the backend.

2. Typescript client library

The ElectricSQL Typescript client library electrifies your SQLite driver and manages active-active replication. It’s developed at github.com/electric-sql/typescript-client and published to the npm package repository.

npm

Install using yarn:

yarn add electric-sql

Or install using npm:

npm install electric-sql

Next step