npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

plat-cli

v0.0.3

Published

Platform Engineering DevEx CLI - Simplify complex cloud operations with developer experience in mind

Readme

plat-cli

build status code coverage code style styled with prettier made with lass license

Platform Engineering DevEx CLI - Simplify complex cloud operations with modern TUI and classic CLI interfaces

🚀 Quick Start

# Install globally
yarn global add plat-cli

# Launch interactive TUI (recommended)
plat-cli

# Or use classic CLI for automation
plat-cli gcp cloudsql migrate \
  --source-project my-project-prd-01 \
  --source-instance db-instance-v2 \
  --target-project my-project-prd-01 \
  --target-instance db-instance \
  --databases myapp_db \
  --source-ip 34.95.123.45 \
  --source-user postgres \
  --source-password MySecurePass123 \
  --target-ip 34.95.67.89 \
  --target-user postgres \
  --target-password MySecurePass123

✨ Features

  • 🎯 CloudSQL PostgreSQL Migration - Seamless database migrations between instances
  • 🖥️ Dual Interface - Interactive TUI with Ink or Classic CLI for scripts
  • 📦 Batch Operations - Migrate multiple databases in parallel (N:1, N:N)
  • 🔄 Smart Strategies - Auto-detect optimal migration patterns
  • 📊 Real-time Progress - Live progress tracking with ETA
  • 🔐 Users & Roles Migration - Optional migration of database users and permissions
  • 💾 Local Cache - SQLite-powered persistent cache for better performance of configurations and inputs
  • 🔁 Auto Retry - Intelligent retry with exponential backoff
  • 🎨 Modern UX - Beautiful TUI with React and @inkjs/ui components

📦 Installation

Prerequisites

  • Node.js >= 18
  • PostgreSQL client tools (pg_dump, pg_restore)
  • Google Cloud credentials (for CloudSQL operations)

Install

# Global installation (recommended) inside the plat-cli folder
yarn global add .

# Or with npm inside the plat-cli folder
npm install -g .

# Local project installation inside the plat-cli folder
yarn add .

🎮 Usage Modes

Interactive TUI Mode (Default)

Simply run plat-cli without arguments to launch the modern TUI:

plat-cli

Navigate with arrow keys, select options, and follow the guided workflow.

Features:

  • Visual navigation menu
  • Form-based configuration
  • Real-time validation
  • Progress visualization
  • Batch migration support

Classic CLI Mode

Perfect for automation, CI/CD, and scripts:

# Single database migration
plat-cli gcp cloudsql migrate \
  --source-project my-project \
  --source-instance source-db \
  --target-project my-project \
  --target-instance target-db \
  --databases app_db,analytics_db

# Batch migration from file
plat-cli gcp cloudsql migrate \
  --sources-file instances.txt \
  --target-project production \
  --target-instance consolidated-db \
  --strategy consolidate

📚 Core Commands

CloudSQL Migration

# Complete migration example with all connection details
plat-cli gcp cloudsql migrate \
  --source-project my-project-prd-01 \
  --source-instance db-instance-v2 \
  --target-project my-project-prd-01 \
  --target-instance db-instance \
  --databases myapp_db,analytics_db \
  --source-ip 34.95.123.45 \
  --source-user postgres \
  --source-password MySecurePass123 \
  --target-ip 34.95.67.89 \
  --target-user postgres \
  --target-password MySecurePass123

# Test connection
plat-cli gcp cloudsql test-connection \
  --project my-project \
  --instance my-instance

# List databases
plat-cli gcp cloudsql list-databases \
  --project my-project \
  --instance my-instance

# Migrate with dry-run
plat-cli gcp cloudsql migrate \
  --source-project prod \
  --source-instance db-v1 \
  --target-project prod \
  --target-instance db-v2 \
  --include-all \
  --dry-run

# Migrate with users and roles (optional)
plat-cli gcp cloudsql migrate \
  --source-project prod \
  --source-instance db-v1 \
  --target-project prod \
  --target-instance db-v2 \
  --include-all \
  --include-users-roles \
  --password-strategy default \
  --default-password 'SecurePass123!'

Migration Strategies

| Strategy | Description | Use Case | | --------------- | --------------------------- | --------------------------- | | simple | Direct 1:1 migration | Single instance migrations | | consolidate | N:1 consolidation | Merge multiple DBs into one | | version-based | Group by PostgreSQL version | Version-specific migrations | | custom | Custom mapping file | Complex migration patterns |

⚙️ Configuration

Environment Variables

Create a .env file:

# Google Cloud
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

# Connection method (choose one)
USE_CLOUD_SQL_PROXY=true

Batch Migration Example

Create instances.txt:

instance-1
instance-2
project:instance-3

Run batch migration:

plat-cli gcp cloudsql migrate \
  --sources-file instances.txt \
  --target-project production \
  --target-instance main-db \
  --strategy consolidate \
  --conflict-resolution prefix

Configuration File

Use JSON for complex configurations:

{
  "source": {
    "project": "my-project",
    "instance": "source-db",
    "databases": ["app", "analytics"]
  },
  "target": {
    "project": "my-project",
    "instance": "target-db"
  },
  "options": {
    "strategy": "simple",
    "retryAttempts": 3,
    "jobs": 2,
    "includeUsersRoles": false,
    "passwordStrategy": {
      "type": "default",
      "defaultPassword": "ChangeMeNow123!"
    }
  }
}

Security Note: When migrating users, passwords cannot be extracted from the source. You must set new passwords using one of the strategies: same (use migration user password), default (set a default password), or individual (set per-user passwords).

plat-cli gcp cloudsql migrate --config migration.json

🛠️ Advanced Features

Batch Migration Strategies

N:1 Consolidation

# Merge multiple instances into one
plat-cli gcp cloudsql migrate \
  --sources-file instances.txt \
  --target-instance consolidated-db \
  --strategy consolidate \
  --conflict-resolution prefix

Version-based Migration

# Group by PostgreSQL version
plat-cli gcp cloudsql migrate \
  --mapping-file version-mapping.json \
  --strategy version-based

Progress Tracking

The CLI provides real-time progress with:

  • Overall progress percentage
  • Current operation status
  • ETA calculation
  • Transfer speed metrics
  • Per-database progress

Dry Run Mode

Test your configuration without making changes:

plat-cli gcp cloudsql migrate \
  --source-instance db1 \
  --target-instance db2 \
  --dry-run

🔧 Development

# Clone repository
git clone https://github.com/devxplat/plat-cli.git
cd plat-cli

# Install dependencies
yarn install

# Run in development
yarn dev

# Run tests
yarn test

# Lint code
yarn lint

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

AGPLv3 © devxplat

🔗 Links


Built with ❤️ for Platform Engineers and SREs by DevX Platform