Install the CLI & sign in
comwit is the command-line tool for Comwit Cloud. You use it to create
databases, deploy apps, and manage domains from your terminal. Under the hood it
only talks to the public platform API at https://api.cloud.comwit.io — it never
touches your cloud provider, the database server, or the runtime fleet directly.
This page gets you from nothing to a signed-in CLI. You will install the binary,
sign in to get a token, and (optionally) pin a default project so you can stop
typing --project on every command.
Install the CLI
Section titled “Install the CLI”The simplest way to get comwit is the install script:
scripts/install-comwit.shThis installs the binary to ~/.local/bin/comwit. Make sure ~/.local/bin is
on your PATH so you can run comwit from anywhere.
Installer options
Section titled “Installer options”You can tune the installer with environment variables:
# Install a specific released version instead of the latestCOMWIT_VERSION=v0.1.0 scripts/install-comwit.sh
# Install to a different directory (default is ~/.local/bin)COMWIT_INSTALL_DIR=/usr/local/bin scripts/install-comwit.sh
# Pull release assets from a specific GitHub repositoryCOMWIT_INSTALL_REPO=comwit/comwit-cloud scripts/install-comwit.shBuild it yourself
Section titled “Build it yourself”If you are working from a checkout of the repository and want to build the CLI
directly, use the just recipes:
just cli-test # run the CLI test suitejust cli-build # build the binary into ./dist./dist/comwit versionThe CLI source lives in tools/comwit.
Sign in
Section titled “Sign in”Every command authenticates to the platform API with a bearer token. As an end
user you always use a cwt_ personal access token — a scoped token tied to
your user that can only act on projects you are a member of. There are two ways
to get signed in.
Option A — device login (recommended)
Section titled “Option A — device login (recommended)”Run comwit login with no token to start the device authorization flow:
comwit loginWhat happens:
- The CLI requests a short code and opens your browser.
- You approve the code while signed in to the console at https://cloud.comwit.io.
- The CLI receives your
cwt_token and saves it to your config file.
That’s it — no copying and pasting tokens. You can pin a default project at the same time:
comwit login --project <project-id>Option B — dashboard personal access token
Section titled “Option B — dashboard personal access token”If you’d rather create the token yourself (for example for CI, or to control its scopes), generate one from the console:
- Go to API tokens in the console at https://cloud.comwit.io/tokens.
- Create a token. The
cwt_plaintext is shown once at creation — copy it then. - Hand it to the CLI:
comwit login --token cwt_xxx --project <project-id>You can revoke a token any time from the same API tokens page.
Configuration and environment
Section titled “Configuration and environment”The CLI stores your token and default project in a config file:
{ "token": "cwt_...", "default_project": "<project-id>"}You can influence where the CLI reads its token, which project it targets, and which API it calls with environment variables:
| Variable | Purpose |
|---|---|
COMWIT_CONFIG | Path to the config file. If unset, the CLI uses $XDG_CONFIG_HOME/comwit/config.json when XDG_CONFIG_HOME is set, otherwise ~/.config/comwit/config.json. |
COMWIT_PROJECT | Default project for commands that accept --project. |
The CLI resolves the project for a command in this order:
- The
--projectflag. - The
COMWIT_PROJECTenvironment variable. - The
default_projectsaved in your config file.
The API host always defaults to https://api.cloud.comwit.io.
Pin a default project
Section titled “Pin a default project”If most of your work happens in one project, pin it once so you can drop the
--project flag from individual commands. The easiest way is during login:
comwit login --project <project-id>You can also pin it for a single shell session with the environment variable:
export COMWIT_PROJECT=<project-id>comwit databases listVerify it works
Section titled “Verify it works”Once you’re signed in, list the databases in your project to confirm everything is wired up:
comwit databases list --project <project-id>If you pinned a default project, you can drop the flag entirely:
comwit databases listIf you get a 403, the token’s scopes or your project membership don’t cover
the action — see API authentication.