A command-line tool to copy HubDB tables between HubSpot portals.
- Copy multiple HubDB tables between HubSpot portals
- Interactive table selection interface
- Preserves table schema and data
- Progress indicators for long operations
- Error handling and validation
- Support for environment variables
npm install -g hubdb-copierYou can provide HubSpot API tokens either through command-line arguments or environment variables.
hubdb-copier -s SOURCE_TOKEN -t TARGET_TOKEN- Create a
.envfile in your working directory:
HUBSPOT_SOURCE_TOKEN=pat-na1-xxxx
HUBSPOT_TARGET_TOKEN=pat-na1-yyyy- Run the command without arguments:
hubdb-copier-s, --source-token <token>: Source HubSpot API token (optional if set in .env)-t, --target-token <token>: Target HubSpot API token (optional if set in .env)-V, --version: Output the version number-h, --help: Display help information--copy-content: Copy table content along with schema--update-existing: Update existing tables in target portal
Using command line:
hubdb-copier -s pat-na1-xxxx -t pat-na1-yyyyUsing environment variables:
# Set up environment variables
cp .env.example .env
# Edit .env with your tokens
vim .env
# Run the tool
hubdb-copier- Validates both source and target API tokens
- Fetches all tables from the source portal
- Displays an interactive menu to select tables for copying
- For each selected table:
- Creates a new table with identical schema in the target portal
- Exports data from the source table
- Imports data into the target table
- Publishes the table in the target portal
- Node.js 14 or higher
- Valid HubSpot API tokens for both source and target portals
-
Clone the repository
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env # Edit .env with your tokens -
Build the project:
npm run build
-
Run in development mode:
npm run dev
To pass CLI options in development mode, add them after a double dash (--). For example, to include the option of
--update-existing:npm run dev -- --update-existing
MIT