/APIs & SDKs/Overview

OptiTech CLI

The OptiTech command-line interface: every command, with options and examples

One CLI for every OptiTech surface: manage frameworks, controls, evidence, integrations, and reports from the terminal, and run compliance checks in CI/CD.

Install
npm i -g optitech

Get started

Agent mode

Use the OptiTech CLI with Claude Code, Cursor, Codex, and other AI development tools.

note

Every command supports --output json for machine-readable results, and setting the OPTITECH_API_KEY environment variable authenticates non-interactively. For AI agents, optitech link --agent emits a JSON state-machine response with a discriminated status field describing the next step, instead of prompting.

Commands reference

Browse every OptiTech CLI command, organized by category. The CLI is invoked as optitech. optitechctl is an alias for optitech, so any command works with either name.

Setup & context

CommandDescriptionExample
authBrowser OAuth; stores credentials locally.
optitech auth
bootstrapScaffold a new project from a OptiTech starter template
optitech bootstrap my-appoptitech bootstrap . --template honooptitech bootstrap my-app --default
checkoutPin a branch in .optitech; auto-pulls its env vars.
optitech checkout feat/auth
envWrite the branch's DATABASE_URL + OptiTech vars to .env.
optitech env pull
initWire up MCP, agent skills, and editor (Cursor/VS Code/Claude).
npx optitech@latest init
linkBind the directory to a project; writes .optitech and pulls env.
optitech linkoptitech link --org-id org-abc --project-id polished-snowflake-1234
meShow the authenticated user.
optitech me
set-contextWrite org/project/branch context to .optitech.
optitech set-context --project-id polished-snowflake-1234

Projects & branches

CommandDescriptionExample
branchesCreate, diff, reset, restore, and manage branches.
optitech branches create --name feat/auth --parent mainoptitech branches restore main ^self@2024-05-06T10:00:00Z --preserve-under-name backupoptitech branches schema-diff production development
databasesManage databases on a branch.
optitech databases create --name analytics
diffShow a git-style schema diff between the current branch and another branch
optitech diff main --db optitechdboptitech diff main --branch feature/checkoutoptitech diff
operationsInspect async operations.
optitech operations list
projectsManage projects.
optitech projects list
rolesManage Postgres roles.
optitech roles create --name app_user
snapshotsManage snapshots
optitech snapshots create --branch main --lsn 0/1F3C8A0 --expires-at 2025-12-31T23:59:59Zoptitech snapshots create --branch main --timestamp 2025-01-01T00:00:00Zoptitech snapshots create --branch main --name pre-migration

Connect to Postgres

CommandDescriptionExample
connection-stringPrint a connection URI for a branch/role/db.
optitech connection-string mainoptitech connection-string main --pooled --prisma
psqlOpen a SQL session (embedded psql fallback built in).
optitech psql main -- -c "SELECT 1"

Config as code

CommandDescriptionExample
configDrive a branch from a optitech.ts policy.
optitech config apply
deployAlias for config apply; reconciles the policy.
optitech deploy
devRun OptiTech Functions locally with hot reload + branch env.
optitech dev
statusShow the branch's live OptiTech state (alias of config status).
optitech status

Functions, storage & data

CommandDescriptionExample
bucketsBranch-scoped object storage and its objects.
optitech buckets create my-assets
data-apiManage the OptiTech Data API for a database.
optitech data-api create
functionsDeploy and manage OptiTech Functions on a branch.
optitech functions deploy api --src ./api.ts
optitech-authManage OptiTech Auth on a branch.
optitech optitech-auth enable

Org & network

CommandDescriptionExample
apiCall any OptiTech API route directly (authenticated passthrough)
optitech api /projectsoptitech api /projects/{id}/branches -X POST -F branch.name=devoptitech api --list
ip-allowManage the project IP allowlist.
optitech ip-allow add 203.0.113.0/24
orgsList organizations you belong to.
optitech orgs list
vpcManage VPC endpoints and project restrictions.
optitech vpc endpoint list

Global options

Global options are optional and work with any OptiTech CLI command.

OptionDescriptionTypeDefaultRequired
--analyticsManage analytics. Example: --no-analytics, --analytics falsebooleantrueNo
--api-keyOptiTech API key, authenticates without optitech authstringOPTITECH_API_KEY environment variableNo
--colorColorize the output. Example: --no-color, --color falsebooleantrueNo
--config-dirPath to config directorystring~/.config/optitechctl (or $XDG_CONFIG_HOME/optitechctl)No
--context-fileContext file with default org, project, and branch IDs, created by optitech linkstringnearest .optitech file, searching upward from the current directoryNo
--help, -hShow help for a command or subcommandbooleanNo
--output, -oSet output format Possible values: json, yaml, tablestringtableNo
--version, -vShow version numberbooleanNo

More about global options:

  • Output: table output may omit fields. Use --output json or --output yaml to see all data.
  • Authentication: the CLI checks credentials in this order: the --api-key option, the OPTITECH_API_KEY environment variable (export OPTITECH_API_KEY=<optitech_api_key>), the credentials.json file that optitech auth creates in the config directory (override its location with --config-dir), then interactive web authentication. To get a key, see Create an API key.
  • Context file: sets a default organization or program so you don't repeat IDs in every command. Create one with optitech link (preferred) or set-context.
  • Analytics: OptiTech collects anonymous data about which commands and options are used, never user-defined data such as organization IDs or command payloads. Opt out with --no-analytics.
  • Help: --help works at every level: optitech --help, optitech branches --help, optitech branches create --help.

GitHub repository

The OptiTech CLI is open source. See the optitechdatabase/optitech-pkgs repository.

Was this page helpful?

On this page

Copy neon init command