Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bigbasealpha

ByAlphas57Apache-2.01.5.2

Enterprise-Grade NoSQL Database System with Modular Logger & Offline HSM Security - Complete database platform with professional text-based logging, encryption, caching, indexing, JWT authentication, auto-generated REST API, real-time dashboard, and maste

database, nosql, json, custom-database, encryption, caching, indexing, dashboard, cli, javascript, node, file-based, embedded, lightweight, professional, enterprise, modular-logger, bigbase, alpha, redis-compatible, memory-cache, key-value-store, terminal-ui, collection-system, collections, query-engine, performance, lazy-write, performance-analytics, monitoring, profiling, charts, dashboard-cli, security, hsm, hardware-security-module, offline-security, air-gapped, tamper-detection, encrypted-storage, privacy, self-destruct, dead-mans-switch, paranoia-mode, one-time-keys, decoy-database, execution-triggers, secure-wipe

readme

🚀 BigBaseAlpha

Enterprise-Grade NoSQL Database System with Offline HSM Security

BigBaseAlpha is a sophisticated enterprise database system built from scratch in JavaScript. Features include encryption, caching, indexing, blockchain integration, machine learning, stream processing, and comprehensive web dashboards. NOW WITH 100% OFFLINE HSM (Hardware Security Module) INTEGRATION FOR MAXIMUM SECURITY.

Version License Node.js Enterprise JWT REST API Real-time Replication HSM 100% Offline Logger

🔐 100% OFFLINE SECURITY GUARANTEE

BigBaseAlpha operates completely offline with no external dependencies or network requirements for security operations. The integrated HSM (Hardware Security Module) ensures maximum security without any cloud connections or external key services.

Offline Features:

  • No Internet Required: Complete functionality without network access
  • Self-Contained HSM: Hardware-level security simulation with software protection
  • Local Key Management: All keys generated and stored locally with encryption
  • Tamper Detection: Built-in system fingerprinting and integrity checks
  • Air-Gapped Ready: Perfect for isolated environments and high-security setups
  • Zero External Dependencies: No cloud services or external key providers needed

🔐 v1.5.1 Modular Logger System (NEW!)

BigBaseAlpha v1.5.1 introduces a completely modular, enterprise-grade logging system that replaces emoji-based logs with professional text-based formatting for maximum compatibility and enterprise environments.

🎯 Key Features:

  • 📝 Enterprise Text Logging: Professional [INFO], [SUCCESS], [WARN], [ERROR] format
  • 🎨 Fully Customizable Colors: 8 built-in color schemes + custom color support
  • ⚙️ 4 Output Formats: Text (default), Minimal, JSON, Legacy (emoji support)
  • ⏰ 9 Timestamp Formats: Simple, DateTime, ISO, Unix, Custom, and more
  • 🔧 Runtime Configuration: Change settings without restart via API
  • 📊 8 Professional Presets: Enterprise, Clean, Debug, Silent, JSON, etc.
  • 🎯 100% Backwards Compatible: Legacy emoji support available via presets
  • 🌈 256-Color Terminal Support: Full color customization for corporate branding

🏢 Professional Logger Presets:

// Enterprise (Default) - Professional text with colors
const logger = new ModularLogger(LoggerPresets.enterprise);

// Clean - No timestamps, just colored levels
const logger = new ModularLogger(LoggerPresets.clean);

// JSON - Structured logging for ELK/Splunk
const logger = new ModularLogger(LoggerPresets.json);

// Debug - Full details with milliseconds
const logger = new ModularLogger(LoggerPresets.debug);

// Silent - No output (production)
const logger = new ModularLogger(LoggerPresets.silent);

⚙️ Runtime Configuration:

// Change format on the fly
logger.setFormat('json');          // Switch to JSON format
logger.setTimestampFormat('iso');   // ISO 8601 timestamps
logger.setColors(false);            // Disable colors for file logs
logger.setColorScheme({             // Custom corporate colors
  info: 'brightCyan',
  success: 'brightGreen',
  error: 'brightRed'
});

📊 Output Examples:

# Enterprise Format (Default)
[19:45] [SUCCESS] [BigBaseAlpha] Database initialized successfully
[19:45] [INFO] [BigBaseAlpha] Authentication system ready
[19:45] [WARN] [BigBaseAlpha] Replication is disabled in configuration

# JSON Format (for log aggregation)
{"timestamp":"2025-08-06T19:45:23.123Z","level":"SUCCESS","prefix":"BigBaseAlpha","message":"Database initialized"}

# Minimal Format (production)
✓ Database initialized
I Authentication system ready
! Replication disabled

🔐 v1.5.0 HSM & Enterprise Features

  • � 100% Offline HSM Integration: Hardware Security Module with tamper detection and air-gapped operation
  • 🔑 Advanced Key Management: Multi-algorithm support (RSA, ECDSA, AES) with secure key derivation
  • 🛡️ Hardware-Level Security: Encrypted private key storage with automatic backup and audit logging
  • 🔐 JWT Authentication & User Management: Complete authentication system with role-based access control
  • 🌐 Auto-Generated REST API: Full REST API with automatic CRUD endpoints and Swagger documentation
  • 📊 Real-time Dashboard: WebSocket-based live monitoring with real-time metrics and alerts
  • 🔄 Master-Slave Replication: High availability with automatic failover and data synchronization

�📋 Changelog

[1.5.1] - 2025-08-06

  • 🔄 MODULAR LOGGER SYSTEM: Complete enterprise logging solution
    • Text-based log levels ([INFO], [SUCCESS], [WARN], [ERROR], [DEBUG], [PROCESS]) replacing emojis
    • Fully customizable color schemes using colors package with professional enterprise defaults
    • Multiple output formats: text (default), emoji (legacy), minimal, JSON for log aggregation
    • Runtime configuration changes without restart: setLoggerFormat(), setLoggerColors(), setLoggerPreset()
    • Enterprise presets: enterprise (default), legacy, minimal, json, debug, silent modes
    • Backward compatibility with legacy emoji logging via preset selection
    • Advanced color support with 256-color terminal compatibility
    • Child logger creation for modular applications with inherited configurations
    • Manual logging API: db.log.info(), db.log.success(), db.log.warn(), db.log.error()
    • Quick preset switchers: enableTextLogging(), enableEmojiLogging(), enableMinimalLogging()

[1.5.0] - 2025-08-05

  • 🔐 OFFLINE HSM INTEGRATION: 100% Offline Hardware Security Module implementation
    • Complete offline operation with no external dependencies or network requirements
    • Hardware-level security simulation with tamper detection and system fingerprinting
    • HSM-secured blockchain hash generation with salt-based protection
    • Encrypted private key storage using AES-256-GCM with auto-backup
    • Secure key derivation functions (PBKDF2) with configurable iterations
    • Multi-algorithm support: RSA, ECDSA, AES encryption with audit logging
    • Air-gapped ready design for maximum security in isolated environments
  • Enterprise Authentication & API Suite: Complete JWT authentication system with user management
    • JWT token-based authentication with role-based access control (admin, user, readonly, api)
    • API key generation and management for third-party integrations
    • Session management with automatic cleanup and security features
    • Login protection with account lockout and retry limitations
  • Auto-Generated REST API: Full REST API with automatic CRUD endpoint generation
    • Auto-generated endpoints for all collections with OpenAPI/Swagger documentation
    • Advanced filtering, pagination, sorting, and search capabilities
    • Bulk operations support and rate limiting with CORS
    • Authentication middleware integration for secure access
  • Real-time Dashboard Enhancement: WebSocket-based live monitoring and metrics
    • Real-time system metrics streaming (CPU, memory, database operations)
    • Live alerts and notifications with client subscription management
    • Real-time query execution and user activity tracking
    • Multi-channel WebSocket communication for different data types
  • Master-Slave Replication: High availability with automatic failover capabilities
    • Operation log synchronization between master and slave nodes
    • Automatic failover with distributed master election process
    • Heartbeat monitoring, health checks, and manual failover support
    • Network-based replication protocol with compression

[1.4.0] - 2025-08-03

  • Security & Privacy Suite: Advanced security features for data protection and privacy
    • Self-Destruct Mode: db.activateSelfDestruct() with PIN protection and deep wipe
    • Dead Man's Switch: Automatic destruction after inactivity period
    • Paranoia Mode: Enhanced logging and tampering protection
    • One-Time Access Keys: Data that self-destructs after single read
    • Wipe Command: Pattern-based secure data deletion
    • Decoy Database: Returns fake data when wrong password is used
    • Execution Triggers: Data that executes code when accessed

[1.3.0] - 2025-08-02

  • Terminal UI Framework: Rich terminal components with colors integration for enhanced developer experience
    • ASCII charts: bar chart, line chart, pie chart visualization in terminal
    • Dynamic data tables with sorting and filtering capabilities
    • Real-time log monitors with colored levels (info, warn, error)
    • Component API: alpha.ui.createComponent({ type: 'chart', data }) for easy UI creation
  • Profiling & Performance Monitor: System performance monitoring through terminal interface
    • CPU, RAM, Disk I/O live graphics and monitoring
    • alpha.ui.monitor('cpu') for real-time system monitoring
    • Log density analysis, query duration tracking, data flow analytics
    • Performance insights and bottleneck detection

[1.2.0] - 2025-07-31

  • Dashboard (port 3000) and Streaming (port 8080) are now disabled by default. These services will only start if you explicitly call startDashboard() or startStreaming().
  • This prevents unwanted open ports when BigBaseAlpha is integrated into other projects, improving security and resource management.
  • Monitoring system now safely ignores ENOENT errors for test/temporary directories, ensuring clean test runs.
  • Full multi-format data storage support: .json, .db (binary/encrypted), .csv, .xml, .yaml, .bin, .hybrid formats are now supported for collections and backups.
  • New formats added in v1.1.0: .db (binary/encrypted), .csv, .xml, .yaml, .bin, .hybrid.
  • See CHANGELOG.md for full details and previous versions.

[1.1.0] - 2025-07-31 (Summary)

  • Centralized log control: silent and logger options for all core and plugin logs
  • All logs can now be silenced or redirected in embedded/SDK usage
  • Buffer serialization/deserialization for .db format fully fixed and tested
  • Internal plugin log calls now respect the main instance's silent/logger options
  • Test scripts and error messages fully translated to English
  • .db file header bug (slice length) resolved for robust binary compatibility
  • Minor test and documentation improvements License Node.js Enterprise

✨ Core Features

� v1.5.0 Enterprise Features (NEW!)

  • 🔐 JWT Authentication & User Management: Complete authentication system with role-based access control
  • 🌐 Auto-Generated REST API: Full REST API with automatic CRUD endpoints and Swagger documentation
  • 📊 Real-time Dashboard: WebSocket-based live monitoring with real-time metrics and alerts
  • 🔄 Master-Slave Replication: High availability with automatic failover and data synchronization

�🔧 Database Engine

  • Multi-format Storage: JSON, Binary, and Hybrid storage
  • Advanced Querying: Powerful query syntax with aggregation
  • Real-time Events: Live data change notifications
  • ACID Transactions: Data integrity and consistency
  • Schema Validation: Flexible data validation rules

🛡️ Security & Performance

  • AES-256 Encryption: Industry-standard data protection
  • Intelligent Caching: Memory-based caching with TTL
  • Advanced Indexing: B-tree indexing for fast queries
  • Audit Logging: Complete operation tracking
  • Role-based Access: Granular permission system

🌊 Enterprise Features

  • Stream Processing: Real-time data processing pipelines
  • Blockchain Integration: Cryptocurrency wallets and smart contracts
  • Machine Learning: Built-in ML algorithms and pattern recognition
  • Business Intelligence: KPI tracking and analytics
  • API Gateway: Microservices management and load balancing
  • Data Replication: Master-slave replication with failover
  • ETL Pipeline: Extract, Transform, Load operations

🔒 Security & Privacy Suite (New in v1.4.0)

  • Self-Destruct Mode: Database can destroy itself with PIN protection and configurable wipe levels
  • Dead Man's Switch: Automatic destruction after period of inactivity
  • Paranoia Mode: Enhanced logging, encryption, and tampering protection
  • One-Time Access Keys: Data that automatically deletes after single read
  • Secure Wipe: Pattern-based data deletion with multiple overwrite iterations
  • Decoy Database: Shows fake data when wrong authentication is used
  • Execution Triggers: Data that executes custom code when accessed

🎨 Terminal UI & Analytics (v1.3.0)

  • Terminal UI Framework: Rich ASCII charts, tables, and dashboards
  • Performance Analytics: Real-time CPU, memory, and disk monitoring
  • Query Profiling: Detailed performance analysis and optimization tips
  • Interactive Components: Progress bars, log monitors, and data tables
  • System Metrics: Live system performance tracking and reporting

🖥️ Management Tools

  • Web Dashboard: Professional monitoring interface
  • CLI Tools: Complete command-line interface
  • Plugin System: Extensible architecture
  • Backup & Restore: Automated data protection
  • Real-time Monitoring: System health and performance tracking

🚀 Quick Start

Installation

npm install bigbasealpha

From GitHub

git clone https://github.com/ByAlphas/bigbasealpha.git
cd bigbasealpha
npm install

🚀 Quick Start with v1.5.0 HSM & Enterprise Features

import BigBaseAlpha from 'bigbasealpha';

// Initialize with v1.5.0 HSM and enterprise features
const db = new BigBaseAlpha({
  path: './data',
  format: 'json',
  encryption: true,
  // v1.5.0 HSM & Enterprise Features
  enableHSM: true,         // 100% Offline HSM Security
  enableAuth: true,        // JWT Authentication
  enableRestAPI: true,     // Auto-generated REST API
  enableRealtime: true,    // Real-time dashboard
  enableReplication: true  // Master-slave replication
});

await db.init();

// v1.5.0: HSM Operations (100% Offline)
const keyId = await db.hsm.generateKey('secure-key', 'symmetric', 256);
const encrypted = await db.hsm.encrypt('sensitive data', keyId);
const hsmHealth = await db.hsm.healthCheck();

// v1.5.0: Start enterprise services
await db.startEnterpriseServices({
  restAPI: { port: 3001 },
  realtimeDashboard: { port: 8080 },
  replication: { role: 'master', port: 9001 }
});

// v1.5.0: Create authenticated user
const user = await db.authManager.createUser({
  username: 'admin',
  password: 'secure123',
  role: 'admin'
});

// v1.5.0: Generate API key for third-party access
const apiKey = await db.authManager.generateAPIKey(user.id, 'my-app');

// Traditional database operations (enhanced with v1.5.0 security)
await db.createCollection('users');
await db.insert('users', {
  name: 'John Doe',
  email: 'john@example.com',
  age: 30
});

// Access via auto-generated REST API:
// GET    http://localhost:3001/api/users
// POST   http://localhost:3001/api/users
// PUT    http://localhost:3001/api/users/:id
// DELETE http://localhost:3001/api/users/:id
// Swagger UI: http://localhost:3001/api-docs

// Real-time monitoring dashboard:
// http://localhost:8080/dashboard

🏢 v1.5.0 Enterprise Features Deep Dive

🔐 JWT Authentication & User Management

// Complete user management system
const authManager = db.authManager;

// Create users with different roles
await authManager.createUser({
  username: 'admin',
  password: 'secure123',
  role: 'admin',
  email: 'admin@company.com'
});

// Login and get JWT token
const loginResult = await authManager.login('admin', 'secure123');
console.log('JWT Token:', loginResult.token);

// Generate API keys for third-party integrations
const apiKey = await authManager.generateAPIKey(loginResult.user.id, 'mobile-app');

// Validate tokens and permissions
const isValid = await authManager.validateToken(loginResult.token);

🌐 Auto-Generated REST API

// Start REST API server
await db.restAPI.start(3001);

// API automatically generates endpoints for all collections:
// GET    /api/users              - List all users (with pagination)
// POST   /api/users              - Create new user
// PUT    /api/users/:id          - Update user
// DELETE /api/users/:id          - Delete user

// Interactive API documentation: http://localhost:3001/api-docs

📊 Real-time Dashboard & Monitoring

// Start real-time dashboard
await db.realtimeDashboard.start(8080);

// WebSocket connection for real-time data
const ws = new WebSocket('ws://localhost:8080');
ws.send(JSON.stringify({
  type: 'subscribe',
  channel: 'system-metrics'  // CPU, memory, database operations
}));

// Access web dashboard: http://localhost:8080/dashboard

🔄 Master-Slave Replication

// Master node setup
await masterDB.replicationManager.startMaster(9001);

// Slave node setup  
await slaveDB.replicationManager.connectToMaster('localhost', 9001);

// All operations on master are automatically synced to slave
// Automatic failover if master goes down

🚀 Complete v1.5.0 Demo

# Run the comprehensive v1.5.0 demo
node demo-v1.5.0.js

# Showcases all enterprise features working together

🔒 Security & Privacy Suite (New in v1.4.0)

import BigBaseAlpha from 'bigbasealpha';

const db = new BigBaseAlpha({ security: { paranoidLogging: true } });
await db.init();

// Self-Destruct Mode
const destruct = db.activateSelfDestruct({
  timeout: 60000,     // 1 minute
  secure: true,       // PIN required to abort
  wipeLevel: "deep"   // Overwrite 3 times with random data
});

console.log(`Emergency PIN: ${destruct.pin}`);
// Cancel with: db.abortDestruct(destruct.pin)

// Dead Man's Switch - Auto-destruct after inactivity
db.enableDeadMansSwitch({
  delay: 24 * 60 * 60 * 1000, // 24 hours
  triggerMessage: "No activity detected, erasing everything...",
  callback: () => console.log("Goodbye...")
});

// Paranoia Mode - Enhanced security logging
db.enableParanoia({
  encryption: "AES-256-GCM",
  tamperCheck: true
});

// One-Time Access Keys
await db.setOneTime("secret", "This message will self-destruct");
const message = await db.getOneTime("secret"); // Auto-deleted after read

// Secure Wipe
await db.wipe("sensitive*", { confirm: true, wipeLevel: "deep" });

// Decoy Database
const decoy = db.enableDecoy({
  password: "correcthorsebatterystaple",
  decoyData: { fake: "This is fake data" }
});

// Execution Triggers
await db.setTrigger("trap", "🔒", {
  onRead: () => {
    console.log("Trap activated!");
    db.wipe("*", { confirm: true });
  }
});

📝 v1.5.1 Modular Logger Configuration

BigBaseAlpha v1.5.1 introduces a powerful, fully customizable logging system that replaces emoji-based logs with professional text-based formats while maintaining backward compatibility.

🎯 Quick Logger Setup

import BigBaseAlpha from 'bigbasealpha';

// Enterprise logging (default in v1.5.1)
const db = new BigBaseAlpha({
  logger: {
    preset: 'enterprise'  // [INFO], [SUCCESS], [WARN], [ERROR] format
  }
});

// Legacy emoji logging (pre-v1.5.1 compatibility)
const dbLegacy = new BigBaseAlpha({
  logger: {
    preset: 'legacy'  // ✅, ⚠️, ❌ emoji format
  }
});

// Production minimal logging
const dbProd = new BigBaseAlpha({
  logger: {
    preset: 'minimal'  // ✓, !, X minimal format
  }
});

// JSON logging for log aggregation
const dbJSON = new BigBaseAlpha({
  logger: {
    preset: 'json'  // Structured JSON output
  }
});

🎨 Custom Color Schemes

const db = new BigBaseAlpha({
  logger: {
    format: 'text',
    colors: true,
    colorScheme: {
      info: 'blue',
      success: 'brightGreen',
      warn: 'brightYellow',
      error: 'brightRed',
      debug: 'magenta',
      process: 'cyan'
    }
  }
});

// Custom company branding
const dbBranded = new BigBaseAlpha({
  logger: {
    prefix: 'MyCompany',
    timestamp: true,
    colorScheme: {
      success: 'brightBlue',  // Company blue
      process: 'brightMagenta'
    }
  }
});

⚙️ Runtime Configuration

await db.init();

// Switch logging format without restart
db.setLoggerFormat('emoji');      // Switch to emoji
db.setLoggerFormat('minimal');    // Switch to minimal
db.setLoggerFormat('json');       // Switch to JSON

// Quick preset changes
db.enableTextLogging();           // [INFO] format
db.enableEmojiLogging();          // ✅ format
db.enableMinimalLogging();        // ✓ format
db.enableJSONLogging();           // JSON format
db.enableSilentLogging();         // No output

// Color customization
db.setLoggerColors(false);        // Disable colors
db.setLoggerColorScheme({
  warn: 'brightRed',
  error: 'red'
});

// Apply complete preset
db.setLoggerPreset('enterprise');

📊 Manual Logging API

// Direct logging access
db.log.info('Database connected successfully');
db.log.success('Operation completed');
db.log.warn('Configuration issue detected');
db.log.error('Connection failed');
db.log.debug('Debug information');
db.log.process('Starting backup process...');

// Child logger for modules
const moduleLogger = db.createChildLogger({
  prefix: 'MyModule',
  colorScheme: { info: 'brightCyan' }
});

🔧 Available Presets

Preset Format Use Case Example Output
enterprise Text-based Production systems [2025-08-06T16:07:02.006Z] [SUCCESS] [BigBaseAlpha] Database initialized
legacy Emoji-based Backward compatibility ✅ [BigBaseAlpha] Database initialized
minimal Minimal symbols Resource-constrained ✓ Database initialized
json Structured JSON Log aggregation {"timestamp":"2025-08-06T16:07:02.006Z","level":"SUCCESS","message":"Database initialized"}
debug Detailed text Development [2025-08-06T16:07:02.006Z] [DEBUG] [BigBaseAlpha] Detailed debug information
silent No output Silent operation (no output)

🎨 Terminal UI Framework (v1.3.0)

import BigBaseAlpha from 'bigbasealpha';

const db = new BigBaseAlpha({ ui: { colors: true, animation: true } });
await db.init();

// Create beautiful charts
const chart = db.createChart({
  type: 'bar',
  values: [
    { label: 'Users', value: 150 },
    { label: 'Orders', value: 89 },
    { label: 'Products', value: 200 }
  ]
}, { title: 'Database Stats', color: 'green' });

chart.render(); // Displays ASCII bar chart

// Create interactive tables
const table = db.createTable(userData, {
  title: 'User Management',
  sortBy: 'name',
  filterBy: 'active'
});
table.render();

// Real-time log monitoring
const logMonitor = db.createLogMonitor(logSource, {
  title: 'System Logs', 
  levels: ['info', 'warn', 'error']
});

🔍 Performance Analytics (v1.3.0)

// Real-time system monitoring
const cpuMonitor = db.monitor('cpu', { duration: 30000 });
const memoryMonitor = db.monitor('memory', { interval: 1000 });

// Query profiling
const result = await db.executeQueryWithProfiling('users', {
  age: { $gte: 25 }
});
console.log(`Query took: ${result.performance.duration}ms`);
console.log(`Efficiency: ${result.analysis.efficiency}%`);

// Performance reporting
const report = db.generatePerformanceReport({
  format: 'terminal',
  includeCharts: true
});

// System metrics
const metrics = db.getSystemMetrics();
console.log(`CPU: ${metrics.cpu.average}%`);
console.log(`Memory: ${metrics.memory.system.percentage}%`);

Web Dashboard

npm run dashboard
# Access at: http://localhost:3000

CLI Commands

npm run status          # Database status
npm run test           # Run tests
npm run backup         # Create backup
npm run demo:ui        # Terminal UI demo
npm run demo:security  # Security features demo
npm run demo:paranoia  # Paranoia mode demo
npm run monitor:cpu    # Live CPU monitoring
npm run monitor:memory # Live memory monitoring
npm run performance:report # Generate performance report
npm run emergency      # Emergency shutdown (destructive!)
bigbase collections    # List collections
bigbase stats         # View statistics

📈 Performance Benchmarks

Real Test Results (Latest v1.5.0 Ultra-Performance Benchmark):

Operation Laboratory Production Notes
Read 1,045,402 ~350,000 🚀 10.1x faster than v1.2.1!
Query 299,322 ~100,000 🔍 3.2x faster than v1.2.1!
Insert 244 ~200 ✍️ 6.3x faster than v1.2.1!
Update 771 ~600 📝 2.1x faster than v1.2.1!
Delete 784 ~600 🗑️ 3.5x faster than v1.2.1!

Comparison with Popular Databases:

Database Lab Read Production Read Lab Query Production Query
BigBaseAlpha v1.5.0 1,045,402 ~350,000 299,322 ~100,000
Redis ~100,000 ~70,000 ~80,000 ~55,000
SQLite ~40,000 ~25,000 ~8,000 ~5,000
MongoDB ~15,000 ~10,000 ~5,000 ~3,000

🎯 Performance Highlights:

  • 🚀 Read Speed: 350,000+ ops/sec in production (5x faster than Redis!)
  • 🔍 Query Speed: 100,000+ ops/sec in production (33x faster than MongoDB!)
  • 🛡️ Enterprise Features: Full ACID compliance with high speed
  • 💾 Persistent: Unlike Redis, data persists to disk with enterprise security

⚠️ Benchmark Reality Check:

Testing Environment: These benchmarks represent ideal conditions (single client, warm cache, no network latency).

Production Reality: Expect 25-40% of benchmark numbers in real-world scenarios with concurrent users, network overhead, and production constraints.

Realistic Expectations:

  • READ: ~350,000 ops/sec (still Redis-level!)
  • QUERY: ~100,000 ops/sec (20x faster than MongoDB!)
  • WRITE: ~200 ops/sec (5x faster than v1.2.1)

Even with this reality adjustment, BigBaseAlpha significantly outperforms traditional databases in production environments.

🚀 Run Your Own Benchmark:

npm run benchmark       # Quick performance test
npm run benchmark:full  # Comprehensive comparison

🏗️ Architecture

BigBaseAlpha/
├── src/
│   ├── alpha.js          # Main database class
│   ├── storage/          # Storage engine
│   ├── security/         # Security layer
│   ├── caching/          # Caching system
│   ├── indexing/         # Indexing engine
│   ├── cli/              # Command line interface
│   ├── dashboard/        # Web dashboard
│   ├── streaming/        # Stream processing
│   ├── blockchain/       # Blockchain integration
│   ├── ml/               # Machine learning
│   └── utils/            # Utilities
├── examples/             # Usage examples
├── test/                 # Test files
└── README.md

🔧 Advanced Configuration

const config = {
  // Core settings
  path: './data',
  format: 'json',
  encryption: true,
  caching: true,
  indexing: true,

  // Enterprise features
  streamProcessing: { enabled: true },
  blockchain: { enabled: true, network: 'testnet' },
  machineLearning: { enabled: true },
  replication: { enabled: true, mode: 'master-slave' },
  monitoring: { enabled: true, alerting: true }
};

🔍 Query Examples

// Basic queries
await db.find('users', { age: 25 });
await db.find('users', { age: { $gte: 18 } });

// Complex queries
await db.find('users', {
  $and: [
    { age: { $gte: 18 } },
    { role: { $in: ['admin', 'manager'] } }
  ]
});

// Aggregation
await db.aggregate('sales', [
  { $match: { date: { $gte: new Date('2024-01-01') } } },
  { $group: { _id: '$product', total: { $sum: '$amount' } } },
  { $sort: { total: -1 } }
]);

🌊 Enterprise Features

Stream Processing

const stream = await db.createDataStream('events');
await db.publishToStream('events', { type: 'user_action', data: {...} });

Blockchain Integration

const wallet = await db.createBlockchainWallet('user123');
const transaction = await db.sendBlockchainTransaction(wallet.address, 'recipient', 100);

Machine Learning

const model = await db.createMLModel('predictions', 'classification', trainingData);
const result = await db.predict('predictions', newData);

🛡️ Security Features

🔐 Hardware Security Module (HSM) - 100% Offline

  • Hardware-Level Security: Complete offline HSM implementation with tamper detection
  • Multi-Algorithm Support: RSA, ECDSA, AES encryption with configurable key sizes
  • Secure Key Storage: Encrypted private keys with automatic backup and recovery
  • Tamper Detection: System fingerprinting and integrity monitoring
  • Key Derivation: PBKDF2 with configurable iterations for secure key generation
  • Audit Trail: Complete HSM operation logging with security events

🔒 Traditional Security

  • AES-256 Encryption: HSM-enhanced data protection at rest
  • bcrypt Hashing: Secure password storage with HSM integration
  • Audit Logging: Complete operation tracking with HSM security events
  • Access Control: Role-based permissions with HSM-backed authentication
  • Input Validation: Data sanitization and validation

📋 Scripts

# v1.5.0 Enterprise Services
npm run services:start        # Start all v1.5.0 enterprise services
npm run api:start            # REST API server (port 3001)
npm run dashboard:realtime   # Real-time dashboard (port 8080)
npm run replication:master   # Start as master node
npm run replication:slave    # Start as slave node
npm run auth:demo           # Create demo admin user

# Traditional Database Commands
npm run start               # Start database
npm run dashboard           # Web dashboard (port 3000)
npm run test               # Run tests
npm run benchmark          # Performance benchmark
npm run backup             # Create backup
npm run cli                # CLI interface
npm run status             # Enhanced system status with v1.5.0 info

# Development & Testing
npm run demo-v1.5.0        # Complete v1.5.0 features demo
npm run test:auth          # Authentication system tests
npm run test:api           # REST API tests
npm run test:replication   # Replication tests

🤝 Contributing

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

📄 License

Apache License 2.0 - see LICENSE file for details.

🌟 Why BigBaseAlpha?

  • 🚀 High Performance: Optimized for speed and efficiency
  • 🔒 Enterprise Security: Production-ready security features with JWT authentication
  • 🌐 Complete API Suite: Auto-generated REST API with Swagger documentation
  • 📊 Real-time Monitoring: WebSocket-based live dashboard and metrics
  • 🔄 High Availability: Master-slave replication with automatic failover
  • 🌊 Modern Architecture: Built with latest JavaScript features and enterprise patterns
  • 📊 Rich Analytics: Built-in business intelligence and performance monitoring
  • 🔧 Developer Friendly: Intuitive API and extensive documentation

BigBaseAlpha v1.5.0 - Complete Enterprise Database Platform

🚀 Production Ready • 🌟 Enterprise Grade • ⚡ High Performance • 🔐 JWT Auth • 🌐 REST API • 📊 Real-time • 🔄 Replication

changelog

Changelog

[1.5.2] - 2025-08-06

Removed - Dependency Optimization

  • Benchmark Dependencies Cleanup: Removed unnecessary dependencies from production package
    • Removed mongodb: Only used for benchmark comparisons, not needed for core functionality
    • Removed ioredis (Redis): Only used for performance testing against Redis
    • Removed better-sqlite3 (SQLite): Only used for benchmark testing against SQLite
  • Production Package Optimization: Reduced package size and installation time
    • Kept essential dependencies: bcrypt, colors, cors, express, ws
    • Cleaner dependency tree for production deployments
    • Faster npm install times for end users
    • Reduced security surface area by removing unused database drivers

[1.5.1] - 2025-08-06

Added - Modular Logger System

  • Enterprise Text-Based Logging: Professional logging system replacing emoji-based logs
    • Text-based log levels: [INFO], [SUCCESS], [WARN], [ERROR], [DEBUG], [PROCESS]
    • Full compatibility with enterprise environments and CI/CD systems
    • Improved readability for log files and terminal output
    • Professional timestamp formatting with ISO 8601 standard
  • Fully Customizable Color Schemes: Advanced color support using colors package
    • 256-color terminal support with professional color presets
    • Customizable color schemes for corporate branding
    • Runtime color configuration without restart required
    • Color disable option for file logging and low-color environments
  • Multiple Output Formats: Flexible logging formats for different use cases
    • Text format (default): Professional enterprise logging with timestamps
    • Emoji format (legacy): Maintains backward compatibility with pre-v1.5.1
    • Minimal format: Compact symbols for resource-constrained environments
    • JSON format: Structured logging for ELK stack and log aggregation systems
  • Runtime Configuration Management: Dynamic logger changes without system restart
    • setLoggerFormat(): Switch between text, emoji, minimal, JSON formats
    • setLoggerPreset(): Apply enterprise, legacy, minimal, debug, silent presets
    • setLoggerColors(): Enable/disable colors dynamically
    • setLoggerColorScheme(): Update color schemes on the fly
  • Professional Enterprise Presets: Pre-configured setups for different environments
    • Enterprise (default): Professional text-based logging with colors and timestamps
    • Legacy: Maintains emoji compatibility for existing deployments
    • Minimal: Compact output for production and resource-constrained systems
    • JSON: Structured output for Elasticsearch, Splunk, and log aggregation
    • Debug: Detailed logging for development and troubleshooting
    • Silent: No output for embedded systems and SDK usage
  • Manual Logging API: Direct access to logging functions
    • db.log.info(), db.log.success(), db.log.warn(), db.log.error()
    • db.log.debug(), db.log.process() for different log levels
    • Child logger creation for modular applications
    • Inherited configuration with override capability
  • Quick Preset Switchers: Convenience methods for common configurations
    • enableTextLogging(), enableEmojiLogging(), enableMinimalLogging()
    • enableJSONLogging(), enableDebugLogging(), enableSilentLogging()
    • One-method preset changes for rapid environment switching

Changed

  • Default Logging Format: Changed from emoji-based to professional text-based logging
  • Log Message Format: Improved consistency and readability across all modules
  • Color Scheme: Enhanced color support with professional enterprise defaults

Fixed

  • Emoji Compatibility Issues: Resolved emoji display problems in various terminal environments
  • Log Format Consistency: Standardized log message formatting across all system components

[1.5.0] - 2025-08-05

Added - Enterprise Authentication & API Features

  • JWT Authentication & User Management: Complete authentication system with role-based access control
    • JWT token-based authentication with refresh tokens
    • User management with roles: admin, user, readonly, api
    • API key generation and management for third-party access
    • Session management with automatic cleanup
    • Login attempt protection with account lockout
    • Multi-factor authentication ready architecture
  • Auto-Generated REST API: Full REST API with automatic endpoint generation
    • Auto-generated CRUD endpoints for all collections: GET, POST, PUT, DELETE, PATCH
    • OpenAPI/Swagger documentation with interactive UI
    • Pagination, filtering, sorting, and search capabilities
    • Bulk operations support (insert, update, delete many)
    • Rate limiting and CORS support
    • Authentication middleware integration
  • Real-time Dashboard Enhancement: WebSocket-based live monitoring
    • Real-time metrics streaming via WebSocket connections
    • Live system monitoring: CPU, memory, database operations
    • Real-time alerts and notifications system
    • Client subscription management for different data channels
    • Live query execution with real-time results
    • User activity tracking and session monitoring
  • Master-Slave Replication: High availability with automatic failover
    • Master-slave replication with operation log synchronization
    • Automatic failover with master election process
    • Heartbeat monitoring and health checks
    • Data synchronization with compression support
    • Network-based replication protocol
    • Manual failover capabilities for maintenance

Enhanced

  • New API Commands:
    • npm run api:start - Start REST API server (port 3001)
    • npm run dashboard:realtime - Start real-time dashboard (port 8080)
    • npm run replication:master - Start as master node
    • npm run replication:slave - Start as slave node
    • npm run auth:demo - Create demo admin user
    • npm run services:start - Start all v1.5.0 services
    • npm run status - Enhanced system status with v1.5.0 features

Architecture

  • Enterprise-Ready Features: Full authentication, API, and replication stack
  • Microservices Architecture: Separate services for API, dashboard, and replication
  • WebSocket Integration: Real-time communication for dashboard and monitoring
  • Security Enhancements: JWT tokens, API keys, role-based permissions
  • High Availability: Master-slave replication with automatic failover

Breaking Changes

  • Authentication now required for REST API access
  • Dashboard WebSocket requires authentication tokens
  • New configuration structure for v1.5.0 features

[1.4.5] - 2025-08-03

Added - Performance Engine & Advanced Collection System

  • Lazy Write Performance Engine: Significant write performance improvements with configurable batching
    • performance: { lazyWrite: true, batchSize: 100, flushDelay: 2000 } - Batch processing optimization
    • ~12-20% write performance improvement with background flush processing
    • Memory-efficient operations with compression support
  • Advanced Collection System: Complete document-based collection API with powerful querying
    • db.collection('name') - Auto-creating collections with document management
    • Advanced query operators: $gt, $lt, $gte, $lte, $regex, $and, $or, $not
    • Query optimization engine with execution plans and performance profiling
    • Automatic indexing system: collection.createIndex({ field: 1 }) for better query performance
  • Enhanced Query Performance: Advanced query engine with 0-2ms execution times
    • Complex query support: collection.find({ $and: [{ category: 'books' }, { price: { $lt: 50 } }] })
    • Query profiling: collection.find().explain() for performance analysis
    • Collection statistics: document count, index usage, memory consumption
  • Storage Integration Improvements: Fixed collection-storage integration bugs
    • Proper error handling with fallback mechanisms
    • Optimized document persistence layer with better reliability

Fixed

  • Collection system storage integration bug causing saveDocument is not a function error
  • Improved error handling in collection document operations
  • Better memory management in large document operations

Changed

  • Package cleanup: Demo files hidden from npm package via .npmignore
  • Performance test directories excluded from git repository
  • Optimized startup time and resource usage

[1.4.0] - 2025-08-03

Added - Security & Privacy Suite

  • Self-Destruct Mode: Database can destroy itself after a timeout with secure PIN cancellation
    • db.activateSelfDestruct({ timeout, secure, wipeLevel }) - Configurable destruction with deep wipe
    • Deep wipe overwrites data 3 times with random data for secure deletion
    • Secure PIN protection: db.abortDestruct("pin") to cancel destruction
  • Dead Man's Switch: Automatic database destruction after period of inactivity
    • db.enableDeadMansSwitch({ delay, triggerMessage, callback }) - Auto-destruct on inactivity
    • Perfect for offline systems and emergency situations
  • Paranoia Mode: Enhanced logging and tampering protection
    • Every operation (get, set, delete) is hashed and timestamped with encryption
    • db.enableParanoia({ encryption, tamperCheck }) - Self-encrypting log system
  • One-Time Access Keys: Data that self-destructs after single read
    • db.set("key", "value", { once: true }) - Auto-delete after first access
  • Wipe Command: Pattern-based secure data deletion
    • db.wipe("pattern*") - Secure overwrite deletion for pattern matching
  • Fake Mode / Decoy Database: Returns fake data when wrong password is used
    • db.enableDecoy({ password, realDb, decoyDb }) - Honeypot protection
  • Execution Triggers: Data that executes code when accessed
    • Trigger functions on data read: { onRead: () => {} } option

[1.3.0] - 2025-08-02

Added

  • Terminal UI Framework: Rich terminal components with colors integration for enhanced developer experience
    • ASCII charts: bar chart, line chart, pie chart visualization in terminal
    • Dynamic data tables with sorting and filtering capabilities
    • Real-time log monitors with colored levels (info, warn, error)
    • Component API: alpha.ui.createComponent({ type: 'chart', data }) for easy UI creation
  • Profiling & Performance Monitor: System performance monitoring through terminal interface
    • CPU, RAM, Disk I/O live graphics and monitoring
    • alpha.ui.monitor('cpu') for real-time system monitoring
    • Log density analysis, query duration tracking, data flow analytics
    • Performance insights and bottleneck detection

[1.2.0] - 2025-07-31

Added

  • Dashboard (port 3000) and Streaming (port 8080) are now disabled by default. These services will only start if you explicitly call startDashboard() or startStreaming().
  • This prevents unwanted open ports when BigBaseAlpha is integrated into other projects, improving security and resource management.

[1.1.0] - 2025-07-31

Added

  • Centralized log control: silent and logger options for all core and plugin logs
  • All logs can now be silenced or redirected in embedded/SDK usage
  • Buffer serialization/deserialization for .db format fully fixed and tested
  • Full multi-format data storage support: .json, .db (binary/encrypted), .csv, .xml, .yaml, .bin, .hybrid formats are now supported for collections and backups.
  • New formats added in this release: .db (binary/encrypted), .csv, .xml, .yaml, .bin, .hybrid.
  • All format tests (json, binary, hybrid, csv, xml, yaml, db) pass without error
  • .db files can now be fully encrypted (encryption: true), making their contents unreadable and secure for production use. This ensures sensitive data is not visible even if the file is accessed directly.

Changed

  • Internal plugin log calls now respect the main instance's silent/logger options
  • Test scripts and error messages fully translated to English

Fixed

  • .db file header bug (slice length) resolved for robust binary compatibility
  • Minor test and documentation improvements

See the full documentation in the README.md for usage, security, and upgrade notes.