New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

init-consoleiq

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

init-consoleiq

CLI to initialize ConsoleIQ logging in a React app

latest
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

ConsoleIQ Setup CLI

🧠 Intelligent Logging for Developers - Streamline your JavaScript/TypeScript project setup with ConsoleIQ's powerful logging and monitoring capabilities.

🚀 Quick Start

Get up and running with ConsoleIQ in your project with just one command:

npx init-consoleiq

This interactive setup will guide you through configuring ConsoleIQ for your project, handling authentication, and automatically integrating the SDK into your codebase.

📋 Table of Contents

  • Features
  • Installation
  • Usage
  • Command Line Options
  • Examples
  • Authentication
  • Project Integration
  • Configuration
  • Troubleshooting
  • Links

✨ Features

  • 🎯 One-Command Setup - Initialize ConsoleIQ in any JavaScript/TypeScript project
  • 🔐 Integrated Authentication - Built-in account creation and login flows
  • 🔍 Smart Detection - Automatically detects project structure and entry files
  • ⚙️ Flexible Configuration - Customize log levels, environment, and app settings
  • 📦 Auto-Installation - Installs required dependencies automatically
  • 🎨 Interactive & Silent Modes - Choose between guided setup or automated configuration
  • 🌐 Multi-Environment - Supports both browser and Node.js environments
  • 📝 TypeScript Ready - Automatic TypeScript detection and configuration

💻 Installation

No installation required! Run directly with npx:

npx init-consoleiq

Or install globally for repeated use:

npm install -g init-consoleiq
init-consoleiq

🎮 Usage

Run the setup wizard that guides you through the entire process:

npx init-consoleiq

The interactive mode will:

  • Check if you have an existing API key or need to create an account
  • Handle authentication (login/registration with OTP verification)
  • Configure your app settings (name, log levels, environment)
  • Auto-detect your project structure
  • Install dependencies and integrate ConsoleIQ

Silent Mode

For automated setups or CI/CD pipelines:

npx init-consoleiq --apiKey your_api_key --appName "MyApp" --silent

🛠 Command Line Options

OptionShortDescriptionDefault
--apiKey-kYour ConsoleIQ API key-
--appName-nApplication name for logsInteractive prompt
--levels-lComma-separated log levelslog,error,warn,info
--environment-eTarget environment (browser/node)browser
--email-Email for account creation/login-
--password-Password for account creation/login-
--register-Force account registration flow-
--login-Force login flow-
--silent-sRun without prompts, use defaultsfalse
--help-hShow help message-

Log Levels

Customize which console methods are captured:

  • log - Standard console.log output
  • error - Error messages and stack traces
  • warn - Warning messages
  • info - Informational messages
  • debug - Debug-level logging
  • trace - Detailed trace information

📚 Examples

Basic Setup with API Key

npx init-consoleiq --apiKey abc123xyz --appName "My Awesome App"

Full Configuration

npx init-consoleiq \
  --apiKey abc123xyz \
  --appName "ProductionApp" \
  --levels "error,warn,info" \
  --environment node \
  --silent

Account Registration

npx init-consoleiq \
  --email developer@company.com \
  --password mySecurePassword123 \
  --appName "MyApp" \
  --register

Account Login

npx init-consoleiq \
  --email developer@company.com \
  --password mySecurePassword123 \
  --login

Node.js Environment Setup

npx init-consoleiq \
  --apiKey abc123xyz \
  --appName "BackendAPI" \
  --environment node \
  --levels "error,warn,info"

🔐 Authentication

ConsoleIQ Setup CLI supports multiple authentication methods:

1. Existing API Key

If you already have an API key from the ConsoleIQ dashboard:

npx init-consoleiq --apiKey your_existing_key

2. Account Login

Log in with existing ConsoleIQ credentials:

npx init-consoleiq --email user@example.com --password yourpassword --login

3. New Account Registration

Create a new account with OTP verification:

npx init-consoleiq --email user@example.com --password yourpassword --register

Note: Registration requires email verification via OTP (One-Time Password) sent to your email address.

🏗 Project Integration

The CLI automatically handles project integration:

File Detection

Automatically detects and integrates with common entry files:

  • main.tsx/ts/jsx/js
  • index.tsx/ts/jsx/js
  • app.ts/js
  • server.js/ts
  • api.js

Module System Detection

  • ES Modules: Uses import statements
  • CommonJS: Uses require() statements
  • TypeScript: Creates .ts files when tsconfig.json is detected

Generated Files

The CLI creates a consoleiq.js or consoleiq.ts file in your project:

// Example generated file (consoleiq.js)
import { createConsoleIQ } from 'consoleiq';

createConsoleIQ({
  apiKey: 'your_api_key',
  name: 'MyApp',
  allowedLevels: ['log', 'error', 'warn', 'info'],
  environment: 'browser'
});

⚙️ Configuration

Environment Types

Browser Environment (--environment browser)

  • Captures frontend console output
  • Tracks client-side errors and logs
  • Ideal for React, Vue, Angular, vanilla JS apps

Node.js Environment (--environment node)

  • Captures server-side console output
  • Monitors backend application logs
  • Perfect for Express, Fastify, NestJS, and other Node.js frameworks

Directory Structure

The CLI intelligently places files based on your project structure:

your-project/
├── src/                    # If src/ exists, files go here
│   ├── consoleiq.ts       # Generated config file
│   └── main.ts            # Auto-injected import
├── package.json
└── tsconfig.json          # Triggers TypeScript mode

🔧 Manual Integration

If automatic integration fails, you can manually add ConsoleIQ to your project:

ES Modules (TypeScript/Modern JS)

import './consoleiq.js'; // Add to your entry file

CommonJS (Node.js)

require('./consoleiq.js'); // Add to your entry file

🐛 Troubleshooting

Common Issues

🔴 "API Key Invalid"

  • Verify your API key is correct
  • Check if your account is properly verified
  • Try logging in again with --login flag

🔴 "Entry File Not Found"

  • Manually specify entry file when prompted
  • Add the import statement manually to your main file

🔴 "Installation Failed"

  • Run npm install consoleiq axios prompt-sync --save manually
  • Check your npm configuration and permissions

🔴 "OTP Not Received"

  • Check your spam/junk folder
  • Ensure email address is correct
  • Wait a few minutes and try again

Getting Help

If you encounter issues:

📖 What Happens After Setup?

Once setup is complete:

  • 🔄 Restart your development server - This ensures ConsoleIQ is loaded
  • 📊 Check your dashboard - Visit consoleiq.io to see incoming logs
  • 🧪 Test logging - Add some console.log() statements to verify capture
  • ⚡ Start monitoring - ConsoleIQ will now capture and analyze your application logs

📝 Advanced Usage

Custom Entry File Integration

If you have a non-standard project structure:

npx init-consoleiq --apiKey abc123 --appName MyApp
# When prompted for entry file, provide your custom path
# Example: ./app/bootstrap.js

CI/CD Integration

For automated deployments:

npx init-consoleiq \
  --apiKey $CONSOLEIQ_API_KEY \
  --appName $APP_NAME \
  --environment $NODE_ENV \
  --silent

Multiple Environment Setup

Set up different configurations for different environments:

# Development
npx init-consoleiq --apiKey dev_key --appName "MyApp-Dev" --levels "log,error,warn,info,debug"

# Production  
npx init-consoleiq --apiKey prod_key --appName "MyApp-Prod" --levels "error,warn"

🤝 Contributing

This is a setup utility for the ConsoleIQ logging service. For feature requests or bug reports related to the ConsoleIQ platform itself, please visit the main ConsoleIQ website.

Ready to supercharge your logging? Get started with npx init-consoleiq today! 🚀

Keywords

consoleiq

FAQs

Package last updated on 18 Aug 2025

Related posts