Membrane CLI

CLI For working with Membrane

A command-line interface for working with Membrane in local development environment.

Installation

npm install -g @membranehq/cli

Quick Start

# Initialize with your workspace credentials (interactive)
membrane init

# Or non-interactive
membrane init --key <key> --secret <secret>

# Pull workspace elements
membrane pull

# Make changes, then push back
membrane push

See the Configuration section below for alternative ways to configure credentials.

Commands

# Initialize workspace configuration
membrane init --key <key> --secret <secret>

# Pull workspace elements from remote
membrane pull [--force]

# Push workspace elements to remote
membrane push [--force]

# Get help
membrane --help
membrane <command> --help

# Check version
membrane --version

Configuration

The CLI can be configured using either environment variables or a configuration file (membrane.config.yml). Environment variables take precedence over the configuration file.

Environment Variables

export MEMBRANE_WORKSPACE_KEY=<your-workspace-key>
export MEMBRANE_WORKSPACE_SECRET=<your-workspace-secret>
export MEMBRANE_API_URI=https://api.your-membrane-instance.com  # Optional: for self-hosted instances (default: https://api.integration.app)
export MEMBRANE_CONSOLE_URI=https://console.your-membrane-instance.com  # Optional: for self-hosted instances (default: https://console.integration.app)
export MEMBRANE_TEST_CUSTOMER_ID=<test-customer-id>  # Optional: for testing integrations

Configuration File

The CLI uses a configuration file at membrane.config.yml:

workspaceKey: <your-workspace-key>
workspaceSecret: <your-workspace-secret>

# Optional
apiUri: https://api.your-membrane-instance.com # For self-hosted instances (default: https://api.integration.app)
consoleUri: https://console.your-membrane-instance.com # For self-hosted instances (default: https://console.integration.app)

testCustomerId: test-customer # Internal ID of customer for testing integrations

Note: When both environment variables and configuration file are present, environment variables take precedence.

Version Control

membrane.config.yml contains secrets. You should exclude it from version control. The membrane folder can and should be stored in version control to keep your integration configurations versioned.

Transferring elements between workspaces with pull and push

The CLI provides a pull and push command to transfer workspace elements between environments. You'd typically use this to move integrations, actions, flows, and other configurations from development to production.

How it works:

Workspace elements (integrations, actions, data sources, flows, field mappings, etc.) are stored as YAML files in the ./membrane directory. Each element has a unique UUID that identifies it across workspaces.

When you pull, the CLI:

  • Exports all elements from the remote workspace as YAML
  • Compares them with your local ./membrane directory by UUID
  • Identifies what's new, changed, or deleted in the remote workspace
  • Downloads connector source code for custom connectors
  • Updates your local files to match the remote state

When you push, the CLI:

  • Packages your local ./membrane directory as an export
  • Compares it with the current state of the remote workspace
  • Identifies what's new, changed, or deleted locally
  • Uploads connector source code for custom connectors
  • Applies the changes to the remote workspace

Changes are applied in dependency order (integrations before integration-level elements, parents before children) to maintain referential integrity. Conflicts occur when an element exists in only one location; use --force to resolve by preferring the source.

Example:

# Pull from development workspace
export MEMBRANE_WORKSPACE_KEY="dev-workspace-key"
export MEMBRANE_WORKSPACE_SECRET="dev-workspace-secret"
membrane pull

# Push to production workspace
export MEMBRANE_WORKSPACE_KEY="prod-workspace-key"
export MEMBRANE_WORKSPACE_SECRET="prod-workspace-secret"
membrane push