UNPKG

bigbasealpha

Version:

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

117 lines (99 loc) 4.21 kB
/** * BigBaseAlpha v1.5.0 - Minimal Setup Example * Clean database installation with only core features * * @copyright 2025 ByAlphas. All rights reserved. */ import BigBaseAlpha from '../src/alpha.js'; async function minimalSetup() { console.log('🚀 BigBaseAlpha v1.5.0 - Minimal Setup'); console.log('====================================='); console.log('✅ Clean installation with core features only'); console.log('✅ No extra modules - fastest startup'); console.log(''); // 🔧 Minimal configuration - only core features const db = new BigBaseAlpha({ path: './minimal_data', format: 'json', silent: false, // Show important logs // 📦 All advanced modules disabled by default modules: { authentication: false, // Disable auth for simple use hsm: false, // Disable HSM for basic setup apiGateway: false, // No API gateway needed machineLearning: false, // No ML features replication: false, // No replication monitoring: false, // No advanced monitoring databaseConnectors: false, graphql: false, eventSourcing: false, blockchain: false, streamProcessor: false, restAPI: false, realtimeDashboard: false } }); try { console.log('📡 Initializing BigBaseAlpha (minimal)...'); await db.init(); console.log('✅ BigBaseAlpha initialized successfully!'); console.log(''); // Create a simple collection console.log('📚 Creating collections...'); await db.createCollection('users'); await db.createCollection('products'); console.log('✅ Collections created'); console.log(''); // Insert some data console.log('📝 Adding sample data...'); const user1 = await db.insert('users', { name: 'John Doe', email: 'john@example.com', age: 30 }); console.log('👤 User added:', user1.name); const product1 = await db.insert('products', { name: 'Laptop', price: 999.99, category: 'Electronics' }); console.log('📦 Product added:', product1.name); // Query data console.log(''); console.log('🔍 Querying data...'); const allUsers = await db.find('users'); console.log(`👥 Found ${allUsers.length} users`); const expensiveProducts = await db.find('products', { price: { $gte: 500 } }); console.log(`💰 Found ${expensiveProducts.length} expensive products`); // Update data console.log(''); console.log('✏️ Updating data...'); await db.update('users', user1._id, { age: 31 }); console.log('✅ User age updated'); // System status console.log(''); console.log('📊 System Status:'); console.log('─'.repeat(30)); console.log(`Collections: ${db.collections.size}`); console.log(`Total operations: ${db.stats.totalOperations}`); console.log(`Memory usage: ${process.memoryUsage().heapUsed / 1024 / 1024} MB`); console.log('✅ All operations completed successfully!'); console.log(''); console.log('💡 Tips:'); console.log(' • This is a minimal setup with only core features'); console.log(' • To enable advanced features, see examples/full-setup.js'); console.log(' • Authentication: modules.authentication = true'); console.log(' • REST API: modules.restAPI = true'); console.log(' • Real-time Dashboard: modules.realtimeDashboard = true'); } catch (error) { console.error('❌ Error:', error.message); } finally { await db.close(); console.log('🔚 Database closed'); } } // Run minimal setup minimalSetup().catch(console.error); export default minimalSetup;