CLI Getting Started
This guide walks you through authenticating and using the Fluxbase CLI. Make sure you’ve installed the CLI first.
Authentication
Section titled “Authentication”Before using the CLI, you need to authenticate with your Fluxbase server.
Interactive Login
Section titled “Interactive Login”The simplest way to login:
fluxbase auth loginYou’ll be prompted for:
- Server URL: Your Fluxbase server (e.g.,
https://api.example.com) - Email: Your account email
- Password: Your account password
Two-Factor Authentication (2FA)
Section titled “Two-Factor Authentication (2FA)”If your account has 2FA enabled, you’ll be prompted for a verification code after entering your password:
Enter 2FA code: 123456The CLI supports both TOTP (authenticator app) and email-based verification codes.
Non-interactive Login
Section titled “Non-interactive Login”For scripts and CI/CD:
# With email/passwordfluxbase auth login \ --server https://api.example.com \ --email user@example.com \ --password "your-password"
# With API tokenfluxbase auth login \ --server https://api.example.com \ --token "your-api-token"Using Environment Variables
Section titled “Using Environment Variables”You can also use environment variables:
export FLUXBASE_SERVER="https://api.example.com"export FLUXBASE_TOKEN="your-api-token"
# Now commands will use these credentialsfluxbase functions listCheck Authentication Status
Section titled “Check Authentication Status”fluxbase auth statusThis shows all configured profiles and their authentication status.
Profile Management
Section titled “Profile Management”The CLI supports multiple profiles for different environments:
# Login to different environments with named profilesfluxbase auth login --profile dev --server http://localhost:8080fluxbase auth login --profile staging --server https://staging.example.comfluxbase auth login --profile prod --server https://api.example.com
# Switch between profilesfluxbase auth switch prod
# Use a specific profile for a commandfluxbase --profile staging functions listQuick Examples
Section titled “Quick Examples”List Functions
Section titled “List Functions”fluxbase functions listDeploy a Function
Section titled “Deploy a Function”fluxbase functions create my-function --code ./function.tsSubmit a Job
Section titled “Submit a Job”fluxbase jobs submit process-data --payload '{"file": "data.csv"}'Upload a File
Section titled “Upload a File”fluxbase storage objects upload my-bucket images/photo.jpg ./photo.jpgQuery a Table
Section titled “Query a Table”fluxbase tables query users --where "role=eq.admin" --limit 10Output Formats
Section titled “Output Formats”The CLI supports multiple output formats:
# Table format (default)fluxbase functions list
# JSON formatfluxbase functions list -o json
# YAML formatfluxbase functions list -o yaml
# Quiet mode (minimal output)fluxbase functions list -qGlobal Flags
Section titled “Global Flags”These flags work with all commands:
| Flag | Short | Description |
|---|---|---|
--config | Config file path (default: ~/.fluxbase/config.yaml) | |
--profile | -p | Profile to use |
--output | -o | Output format: table, json, yaml |
--no-headers | Hide table headers | |
--quiet | -q | Minimal output |
--debug | Enable debug output |
What’s Next?
Section titled “What’s Next?”Choose your path based on what you want to do:
Deploy Functions and Jobs
Section titled “Deploy Functions and Jobs”# Create a functionecho 'export default (req) => new Response("Hello!")' > hello.tsfluxbase functions create hello --code ./hello.ts
# Test itfluxbase functions invoke helloSee Command Reference - Functions for more.
Work with Data
Section titled “Work with Data”# List your tablesfluxbase tables list
# Query datafluxbase tables query users --select "id,email" --limit 10
# Insert a recordfluxbase tables insert users --data '{"email": "new@example.com"}'See Command Reference - Tables for more.
Set Up CI/CD
Section titled “Set Up CI/CD”Configure automated deployments using environment variables and the sync command.
See Workflows for GitHub Actions and GitLab CI examples.
Manage Multiple Environments
Section titled “Manage Multiple Environments”Set up profiles for dev, staging, and production servers.
See Configuration for profile management.
Further Reading
Section titled “Further Reading”- Command Reference - Full command documentation
- Configuration - Configuration file details
- Workflows - CI/CD and development workflows