FlexSite CLI Setup

Applies to: FlexLab

FlexSite CLI Setup
FlexSite CLI Setup

Overview

The FlexSite CLI (flexsite) is a command-line tool developers install on their laptop. It authenticates against FlexSite, downloads database backups, syncs files, and runs Drush commands on remote environments without memorizing server hostnames.

Key concepts

  • CLI — *command-line interface*: typing commands in Terminal (Mac/Linux) or PowerShell instead of clicking in a browser.
  • Node.js — runtime required to install the FlexSite CLI via npm.
  • Personal access token — generated on ProfileTokens; acts like a scoped API password. Store it securely — it is shown only once.
  • Drush — Drupal’s standard administration tool for cache clears, database updates, and config imports.

Steps — install the CLI

  1. Install Node.js LTS from nodejs.org if you do not already have it.
  2. Run npm install -g @flexsite/cli (check platform docs for the latest package name).
  3. Run flexsite --help to confirm the install.

Steps — sign in

  1. On ProfileTokens, create a token with scopes your workflow needs (drush:execute, database/files pull, etc.).
  2. In your project folder, run flexsite auth login and paste the token.
  3. Run flexsite auth status to confirm organization and user.
  4. Run flexsite link (or follow Code instructions) to associate the folder with the FlexSite project.

Everyday commands

| Command | What it does |

|---------|----------------|

| flexsite db pull | Download latest database backup to your machine |

| flexsite files pull | Download uploaded files (images, documents) |

| flexsite sync | Sync database and files together |

| flexsite drush -- status | Run Drush remotely to check Drupal health |

Add an SSH public key on the same Tokens page if your team uses flexsite ssh for shell access.