Skip to content

Getting Started

This guide gets one source working from the CLI. OneQuery keeps credentials server-side; callers use source identifiers like postgres://warehouse.

Choose one install method. You only need the requirement for that method.

Install methodRequirement
npm or npxNode.js 22+
Bun or bunxBun; Node.js 22+ if you run a local gateway
HomebrewHomebrew
Install scriptcurl and tar; the script manages Node.js runtime

For source setup, have a OneQuery server URL or local gateway, plus a read-only credential or limited provider token.

Terminal window
npm install -g @onequery/cli

You can also run the CLI without a global install:

Terminal window
npx @onequery/cli --help

Use a shared server URL if your team provides one:

Terminal window
onequery config set api.server_url https://onequery.example.com

Start a gateway only when you run OneQuery yourself:

Terminal window
onequery gateway start
  1. Verify and log in.

    Terminal window
    onequery --version
    onequery auth login
    onequery auth whoami
  2. Connect a source.

    Replace the placeholders with read-only PostgreSQL credentials.

    Terminal window
    onequery source connect --source postgres \
    --input '{"sourceKey":"warehouse","credentials":{"host":"db.example.com","port":5432,"database":"app","username":"onequery_readonly","password":"<read-only-password>","sslMode":"require"}}'
  3. Run a smoke query.

    Terminal window
    onequery query exec --source postgres://warehouse --sql "select 1"
  4. Confirm the source.

    Terminal window
    onequery source list

You are done when:

  • onequery auth whoami shows the expected user and organization.
  • onequery source list shows the source you connected.
  • The smoke query returns one row.