A modular command-line interface for Port that enables data import/export, organization migration, and API operations using a pluggable module architecture.
- 📤 Export: Backup Port data (blueprints, entities, scorecards, actions, teams, automations, pages, integrations)
- 📥 Import: Restore data from backups
- 🔄 Migrate: Transfer data between Port organizations
- 🔍 Compare: Diff two Port organizations and generate reports (text, JSON, HTML)
- 🔌 API Operations: Direct CRUD operations on Port resources
Global installation:
npm install -g @port-experimental/port-cliUse with npx (no installation needed):
npx @port-experimental/port-cli --versionLocal installation in your project:
npm install @port-experimental/port-cliLinux/macOS:
curl -fsSL https://raw.githubusercontent.com/port-experimental/port-cli/main/scripts/install.sh | bashThis will download and install the latest release binary to /usr/local/bin (or ~/.local/bin if you don't have write permissions).
Verify installation:
port --versionDownload pre-built binaries for your platform from GitHub Releases.
Build the image:
docker build -t port-cli .Run a command:
docker run --rm \
-e PORT_CLIENT_ID="your-client-id" \
-e PORT_CLIENT_SECRET="your-client-secret" \
port-cli --helpExport with output written to the host:
docker run --rm \
-e PORT_CLIENT_ID="your-client-id" \
-e PORT_CLIENT_SECRET="your-client-secret" \
-v $(pwd)/output:/data \
port-cli export --output /data/backup.tar.gzFor development or if you need the latest unreleased code:
git clone https://github.com/port-experimental/port-cli.git
cd port-cli
make build
./bin/port --helpNote: When building from source, use ./bin/port instead of port in commands. For installed binaries, use port directly.
See INSTALL.md for detailed installation instructions.
Run port config --init to create a configuration file at ~/.port/config.yaml:
default_org: production
organizations:
production:
client_id: your-client-id
client_secret: your-client-secret
api_url: https://api.getport.io/v1Or use environment variables:
export PORT_CLIENT_ID="your-client-id"
export PORT_CLIENT_SECRET="your-client-secret"
export PORT_API_URL="https://api.getport.io/v1"# Export data
port export --output backup.tar.gz
# Import data
port import --input backup.tar.gz
# Compare organizations
port compare --source staging --target production
# Migrate between organizations
port migrate --source-org prod --target-org staging
# API operations
port api blueprints listNote: If you built from source instead of installing, use ./bin/port instead of port in the commands above.
port export- Export data from Portport import- Import data to Portport compare- Compare two Port organizationsport migrate- Migrate data between organizationsport api- Direct API operations (blueprints, entities)port config- Manage configurationport version- Show version
# Build
make build
# Run tests
make test
# Format code
make format
# Lint
make lintport-cli/
├── cmd/port/ # Go CLI entry point
├── internal/ # Go implementation
│ ├── api/ # API client
│ ├── config/ # Configuration management
│ ├── commands/ # CLI commands
│ ├── modules/ # Business logic modules
│ └── output/ # Output formatters
├── go.mod # Go dependencies
└── Makefile # Go build
Create ~/.port/config.yaml:
default_org: production
organizations:
production:
client_id: your-client-id
client_secret: your-client-secret
api_url: https://api.getport.io/v1
staging:
client_id: staging-client-id
client_secret: staging-client-secret
api_url: https://api.getport.io/v1PORT_CLIENT_ID # Port API client ID
PORT_CLIENT_SECRET # Port API client secret
PORT_API_URL # Port API URL (optional)
PORT_CONFIG_FILE # Path to config file
PORT_DEFAULT_ORG # Default organization name
PORT_DEBUG # Enable debug modePrecedence: CLI args > env vars > config file > defaults
#!/bin/bash
DATE=$(date +%Y%m%d)
./bin/port export --output "backups/port-backup-$DATE.tar.gz"
# Keep only last 30 days
find backups/ -name "port-backup-*.tar.gz" -mtime +30 -deleteBy default, port compare compares all resource types (blueprints, actions, scorecards, pages, integrations, teams, users). Use --include to narrow the comparison to specific types.
# Compare two configured organizations (all resource types)
port compare --source staging --target production
# Compare with verbose output (show identifiers)
port compare --source staging --target production --verbose
# Compare with full field-level diff
port compare --source staging --target production --full
# Compare only pages
port compare --source staging --target production --include pages
# Compare pages and blueprints together
port compare --source staging --target production --include pages,blueprints
# Compare export files
port compare --source ./staging-backup.tar.gz --target ./prod-backup.tar.gz
# Compare only pages between export files
port compare --source ./staging-backup.tar.gz --target ./prod-backup.tar.gz --include pages
# Output as JSON (for scripting)
port compare --source staging --target production --output json
# Generate interactive HTML report
port compare --source staging --target production --output html --html-file report.html
# CI/CD mode: exit code 1 if differences found
port compare --source staging --target production --fail-on-diff
# CI/CD mode scoped to pages only
port compare --source staging --target production --include pages --fail-on-diffValid --include values: blueprints, actions, scorecards, pages, integrations, teams, users.
# Export from production
./bin/port export --output prod.tar.gz --org production
# Import to staging
./bin/port import --input prod.tar.gz --org staging
# Compare to verify changes
./bin/port compare --source prod.tar.gz --target staging --verbose
# Test changes in staging...
# When ready, migrate back
./bin/port migrate --source-org staging --target-org production# Export to a local directory
docker run --rm \
-e PORT_CLIENT_ID="your-client-id" \
-e PORT_CLIENT_SECRET="your-client-secret" \
-v $(pwd)/output:/data \
port-cli export --output /data/backup.tar.gz
# Import from a local file
docker run --rm \
-e PORT_CLIENT_ID="your-client-id" \
-e PORT_CLIENT_SECRET="your-client-secret" \
-v $(pwd)/output:/data \
port-cli import --input /data/backup.tar.gz
# Compare two organizations
docker run --rm \
-e PORT_CLIENT_ID="source-client-id" \
-e PORT_CLIENT_SECRET="source-client-secret" \
-e PORT_TARGET_CLIENT_ID="target-client-id" \
-e PORT_TARGET_CLIENT_SECRET="target-client-secret" \
port-cli compare --fail-on-diffSee CONTRIBUTING.md for development guidelines.
See RELEASE.md for release procedures.
MIT License - see LICENSE