Skip to content

Self-hosting

Use the CLI with your server

Install the usertasks CLI (from npm or the offline tarball), log in to your own server with --url, use API keys on servers and in CI, and keep a profile per server.

Last updated 2 min read Edit this page on GitHub
On this page

The usertasks CLI talks to your server's REST API, so it works the same against your install as against usertasks.com. You only need to tell it where your server is.

Install it#

The CLI needs Node.js 20 or later (22 LTS recommended).

Bash
npm install -g @user-tasks/cli
usertasks --version

With no internet access, install it from the air-gapped bundle. The tarball in npm/ carries its own dependencies:

Bash
npm install -g --offline ./npm/user-tasks-cli-<version>.tgz

Log in to your server#

Pass the address people open in the browser with --url: a workspace on usertasks.com, or your own server's APP_URL:

Bash
usertasks login --url https://yourtenant.usertasks.com
usertasks login --url https://tasks.example.com
usertasks login
usertasks whoami

The first line logs in to a cloud workspace (replace yourtenant with yours); the second to your own domain, or another port. If the server runs on this machine at the default address, just run usertasks login: with no --url, no USERTASKS_URL and no saved profile, it logs in to http://localhost:3000 (the laptop trial, or npm run dev) and says so.

The localhost default arrived in CLI 0.1.2. Older versions always need --url; usertasks --version shows which one you have.

login opens your browser and asks you to approve access. If you aren't signed in, you sign in first with your organisation slug, email and password. Add --no-browser to print the link instead of opening it; open it in a browser on the same machine, because the result comes back to the CLI on 127.0.0.1. The login waits up to 5 minutes. On a server with no browser at all, use an API key (below).

The server and your credentials are saved as a profile in ~/.config/usertasks/config.json (%APPDATA%\usertasks\config.json on Windows), so later commands don't need --url.

Servers and CI without a browser#

Create an API key in Settings → API keys, then either store it in a profile:

Bash
usertasks login --url https://yourtenant.usertasks.com --api-key -  < key.txt
usertasks login --url https://yourtenant.usertasks.com --api-key

With -, the key is read from stdin; without a value, login prompts for it.

or skip the profile and use environment variables (handy in CI):

Bash
export USERTASKS_URL=https://yourtenant.usertasks.com
export USERTASKS_API_KEY=<the key>
usertasks workflows list

USERTASKS_API_KEY always overrides a stored credential. usertasks-admin bootstrap --api-key <name> can mint a first key while it creates the workspace.

More than one server#

Give each login a profile name, then switch between them:

Bash
usertasks login --url https://yourtenant.usertasks.com --profile cloud
usertasks login --url https://tasks.example.com --profile prod
usertasks profiles use prod
usertasks profiles list

The full guide is CLI. Every command is in the command reference.

Next#

Was this page helpful?