Introduction
The TikTok Miner CLI is a command-line tool for querying and managing the TikTok Miner database. Built with Commander.js and TypeScript, it provides developers with direct database access.Installation
The CLI is bundled with the TikTok Miner application. To use it:Available Commands
Currently, the CLI implements the following command:Database Operations
- query-db - Query and explore database contents with SQL
- Execute custom SQL queries against PostgreSQL
- Query creator profiles, metrics, and analytics
- Access budget and cost tracking data
Additional command groups (creators, discovery) are planned but not yet fully implemented in the codebase. The CLI entry point references these modules but the implementation files are pending.
Planned Commands
The following commands are referenced in the CLI architecture but pending implementation:- creators - Creator profile management (planned)
- discovery - Discovery pipeline operations (planned)
- db - Extended database utilities (planned)
- analysis - Analytics and reporting (planned)
Global Options
All commands support these global options:Environment Configuration
The CLI requires environment variables to be configured. Create a.env file in the project root:
Quick Start
Query Database
Execute a raw SQL query:Check CLI Version
Get Help
Output Formats
The CLI supports multiple output formats:- Table (default): Human-readable table format
- JSON: Machine-readable JSON output
- CSV: Spreadsheet-compatible format
Command Structure
The CLI follows this general structure:Development Status
The TikTok Miner CLI is under active development. Current status: ✅ Implemented:- Basic CLI framework with Commander.js
query-dbcommand structure- Version and help commands
- Query result formatting
- Creator management commands
- Discovery pipeline integration
- Export functionality
- Batch operations
- Analytics commands
- Reporting tools
Related Documentation
Database Commands
Detailed query-db command reference
Database Setup
Database schema and configuration
Environment Variables
Complete configuration reference
API Monitoring
Monitor CLI operations and costs
Troubleshooting
Command not found
Command not found
Ensure you’re running the CLI from the
app/ directory where cli/index.ts is located.Database connection errors
Database connection errors
Verify your
DATABASE_URL is correct and the PostgreSQL server is running:Module not found errors
Module not found errors
Some commands reference modules that are not yet implemented. This is expected during the development phase. Stick to the
query-db command for current functionality.Permission errors
Permission errors
Ensure the database user has appropriate permissions:
Contributing
The CLI is open for contributions. Priority areas:- Implement creator management commands
- Add discovery pipeline CLI integration
- Build export and reporting tools
- Improve output formatting
- Add test coverage