Lux Documentation
Welcome to the Lux documentation! The Lux CLI is a command-line interface for managing your Lux workflows, interfaces, and resources directly from your terminal.
Installation
npm install -g lux-cliAuthentication
First, authenticate with your Lux account:
lux loginThis command will:
- Open your default browser
- Redirect you to the Lux authentication page
- After successful login, save credentials locally to
~/.lux/config.json - Display your organization ID
Example Output:
Opening browser for authentication...
✓ Successfully authenticated!
Org ID: org_2mgfH7Xk4...
You can now use Lux CLI commands.Configuration File
Your credentials are stored in ~/.lux/config.json:
{
"apiKey": "lux_org_2mgfH7Xk4...",
"orgId": "org_2mgfH7Xk4...",
"apiUrl": "https://yourdomain.com"
}Environment Variables
You can override configuration values with environment variables:
LUX_API_URL- API endpoint URLLUX_API_KEY- Your API key/tokenLUX_ORG_ID- Your organization ID
Workflow Management
The Lux CLI provides powerful commands for managing your automation workflows.
Workflow Storage
Workflows are stored in two places:
- Metadata (name, status, timestamps) → Turso database
- Configuration (JSON with steps, actions) → R2 storage
Each workflow has two versions:
- Draft - Work-in-progress changes
- Published - Live production version
List All Workflows
lux workflows listShows all workflows with their ID, name, status, and last updated time.
Example Output:
Found 15 workflow(s):
┌─────┬──────────────────────────┬─────────────┬───────────┐
│ id │ name │ status │ updated │
├─────┼──────────────────────────┼─────────────┼───────────┤
│ ... │ 'kevinTest' │ 'published' │ 10/22/... │
│ ... │ 'Lux movers' │ 'published' │ 10/22/... │
└─────┴──────────────────────────┴─────────────┴───────────┘Get Workflow Details
lux workflows get <workflow-id>Fetches the complete workflow configuration including:
- Metadata (name, description, status)
- Draft configuration JSON
- Published configuration JSON
Example:
lux workflows get 1f8365eb-38ac-4723-8664-15086d6fda91Create New Workflow
lux workflows create <name> [description]Creates a new workflow with the given name and optional description.
Example:
lux workflows create "My New Workflow" "Handles customer inquiries"Save Configuration
lux workflows save <workflow-id> <config-file>Saves a workflow configuration as a draft. This:
- Uploads the JSON config to R2 storage
- Updates the database with the new draft URL and hash
- Does NOT affect the published version
Example:
lux workflows save 1f8365eb-38ac-4723-8664-15086d6fda91 ./config.jsonPublish Workflow
lux workflows publish <workflow-id>Promotes the draft configuration to production. This:
- Copies the draft config to published config in R2
- Updates the database with the new published URL and hash
- Makes the workflow live
Example:
lux workflows publish 1f8365eb-38ac-4723-8664-15086d6fda91View Differences
lux workflows diff <workflow-id>Shows the difference between draft and published configurations.
Workflow Configuration Format
Workflow configs are JSON files with the following structure:
{
"name": "My Workflow",
"description": "Workflow description",
"steps": [
{
"id": "step1",
"type": "action",
"action": "send_email",
"config": {
"to": "user@example.com",
"subject": "Hello",
"body": "Message content"
}
}
],
"triggers": {
"type": "api",
"endpoint": "/webhook"
}
}Editing a Workflow
- Get the current configuration:
lux workflows get <workflow-id> > workflow.json- Edit the JSON file:
code workflow.json # or nano workflow.json- Save as draft:
lux workflows save <workflow-id> ./workflow.json- Review changes:
lux workflows diff <workflow-id>- Publish when ready:
lux workflows publish <workflow-id>Database
Manage and query your Turso database directly from the CLI.
List Tables
lux db tablesView all tables in your organization's database.
Execute SQL
lux sql "<query>"Run SQL queries against your database.
Example:
lux sql "SELECT * FROM flows LIMIT 10"Interfaces
Deploy and manage React-based interfaces.
Deploy Interface
lux interfaces deploy <path>Deploy an interface from a local directory.
Storage
Manage files in R2 storage.
Upload File
lux storage upload <file> <key>Upload a file to R2 storage.
Secrets
Manage organization secrets securely.
List Secrets
lux secrets listView all secrets in your organization.
Get Secret
lux secrets get <key>Retrieve a specific secret value.
Set Secret
lux secrets set <key> <value>Set or update a secret.
Delete Secret
lux secrets delete <key>Remove a secret from your organization.
Security:
- Secrets are stored encrypted
- Never logged or displayed in plain text
- Scoped to your organization
Tips & Best Practices
- Always use
lux workflows diffbefore publishing to production - Keep config files in version control (git)
- Test draft configs before publishing
- Use descriptive names for workflows
- Never commit your
~/.lux/config.jsonto version control