@krunal_tarale-5/ultimate-streaming-package
Version:
🚀 Ultimate Real-Time Streaming Package v2.1.9 - Multi-Platform, Multi-Collection Architecture with Native MongoDB & MySQL Support, 99.96% Performance Improvement. Enterprise-grade real-time data streaming with Socket.IO integration, dynamic schema evolut
391 lines (312 loc) • 8.88 kB
Markdown
# 🚀 Quick Start Guide
**Get up and running with Ultimate Streaming Package in 5 minutes!**
## 📋 **Prerequisites**
- Node.js 14+ installed
- MySQL or MongoDB database running
- Basic JavaScript knowledge
## 🎯 **5-Minute Setup**
### Step 1: Install the Package
```bash
npm install @krunal_tarale-5/ultimate-streaming-package@2.1.4
```
### Step 2: Basic MySQL Setup
```javascript
const UltimateStreamer = require('@krunal_tarale-5/ultimate-streaming-package');
// Initialize with MySQL
await UltimateStreamer.init({
dbType: 'mysql',
host: 'localhost',
port: 3306,
database: 'myapp',
user: 'root',
password: '',
enableCache: true
});
console.log('✅ Connected to MySQL successfully!');
```
### Step 3: Push Your First Data
```javascript
// Push data to native table
await UltimateStreamer.push('orders', {
orderId: 'ORD-001',
customerId: 'CUST-001',
total: 1500.00,
status: 'pending'
});
console.log('✅ Data pushed successfully!');
```
### Step 4: Listen for Real-time Updates
```javascript
// Listen for real-time updates
UltimateStreamer.on('orders', (data, meta) => {
console.log('🔄 Real-time update:', data.orderId, meta.changeType);
});
```
### Step 5: Test Real-time Updates
```javascript
// Update the order (this will trigger the real-time event)
await UltimateStreamer.update('orders',
{ orderId: 'ORD-001' },
{ status: 'shipped' }
);
// You should see the real-time update in your console!
```
## 🎯 **MongoDB Setup**
### Step 1: MongoDB Configuration
```javascript
const UltimateStreamer = require('@krunal_tarale-5/ultimate-streaming-package');
// Initialize with MongoDB
await UltimateStreamer.init({
dbType: 'mongodb',
host: 'localhost',
port: 27017,
database: 'myapp',
enableCache: true
});
console.log('✅ Connected to MongoDB successfully!');
```
### Step 2: Push Data to MongoDB
```javascript
// Push data to native collection
await UltimateStreamer.push('users', {
userId: 'USR-001',
email: 'john@example.com',
name: 'John Doe',
role: 'customer'
});
console.log('✅ Data pushed to MongoDB successfully!');
```
## 🏗️ **Multi-Collection Examples**
### E-commerce Platform
```javascript
// Initialize
await UltimateStreamer.init({
dbType: 'mysql',
host: 'localhost',
port: 3306,
database: 'ecommerce',
user: 'root',
password: '',
enableCache: true
});
// Push different data types to separate tables
await UltimateStreamer.push('orders', {
orderId: 'ORD-001',
customerId: 'CUST-001',
total: 1500.00,
status: 'pending',
items: [
{ productId: 'PROD-001', quantity: 2, price: 750.00 }
]
});
await UltimateStreamer.push('users', {
userId: 'USR-001',
email: 'john@example.com',
name: 'John Doe',
role: 'customer',
lastLogin: new Date()
});
await UltimateStreamer.push('products', {
productId: 'PROD-001',
name: 'Gaming Laptop',
price: 999.99,
stock: 50,
category: 'electronics'
});
// Listen for updates on each collection
UltimateStreamer.on('orders', (data, meta) => {
console.log('📦 Order update:', data.orderId, meta.changeType);
});
UltimateStreamer.on('users', (data, meta) => {
console.log('👤 User update:', data.userId, meta.changeType);
});
UltimateStreamer.on('products', (data, meta) => {
console.log('🛍️ Product update:', data.productId, meta.changeType);
});
```
### Analytics Dashboard
```javascript
// Initialize
await UltimateStreamer.init({
dbType: 'mysql',
host: 'localhost',
port: 3306,
database: 'analytics',
user: 'root',
password: '',
enableCache: true
});
// Push analytics data
await UltimateStreamer.push('social_media_analytics', {
platform: 'twitter',
followers: 125000,
tweets: 15420,
engagement: 8.5,
timestamp: new Date()
});
await UltimateStreamer.push('website_analytics', {
page: '/home',
visitors: 15420,
bounceRate: 23.5,
avgTimeOnPage: 180,
timestamp: new Date()
});
// Listen for real-time analytics updates
UltimateStreamer.on('social_media_analytics', (data, meta) => {
console.log('📊 Social media update:', data.platform, data.followers);
});
UltimateStreamer.on('website_analytics', (data, meta) => {
console.log('🌐 Website update:', data.page, data.visitors);
});
```
## 🔧 **Advanced Features**
### Query-Based Updates
```javascript
// Update specific records
const result = await UltimateStreamer.update('orders',
{ orderId: 'ORD-001' }, // Find this order
{
status: 'shipped',
shippedAt: new Date(),
trackingNumber: 'TRK-123456'
}
);
console.log('Updated:', result.found); // true/false
```
### Get Data with Queries
```javascript
// Get all pending orders
const pendingOrders = await UltimateStreamer.get('orders', {
where: { status: 'pending' }
});
// Get orders with total > 1000
const highValueOrders = await UltimateStreamer.get('orders', {
where: { total: { $gt: 1000 } }
});
// Get user by email
const user = await UltimateStreamer.get('users', {
where: { email: 'john@example.com' }
});
```
### Dynamic Schema Support
```javascript
// Tables/collections created automatically
// New fields added automatically on update
await UltimateStreamer.update('orders',
{ orderId: 'ORD-001' },
{
deliveredAt: new Date(), // New field added automatically
deliveryNotes: 'Left at front door', // New field added automatically
customerSignature: 'John Doe' // New field added automatically
}
);
```
## 🚀 **Complete Example**
Here's a complete working example:
```javascript
const UltimateStreamer = require('@krunal_tarale-5/ultimate-streaming-package');
async function startStreaming() {
try {
// 1. Initialize
await UltimateStreamer.init({
dbType: 'mysql',
host: 'localhost',
port: 3306,
database: 'myapp',
user: 'root',
password: '',
enableCache: true
});
console.log('✅ Connected to database');
// 2. Set up real-time listeners
UltimateStreamer.on('orders', (data, meta) => {
console.log('🔄 Order update:', data.orderId, meta.changeType);
});
UltimateStreamer.on('users', (data, meta) => {
console.log('🔄 User update:', data.userId, meta.changeType);
});
// 3. Push initial data
await UltimateStreamer.push('orders', {
orderId: 'ORD-001',
customerId: 'CUST-001',
total: 1500.00,
status: 'pending'
});
await UltimateStreamer.push('users', {
userId: 'USR-001',
email: 'john@example.com',
name: 'John Doe'
});
console.log('✅ Initial data pushed');
// 4. Simulate real-time updates
setInterval(async () => {
await UltimateStreamer.update('orders',
{ orderId: 'ORD-001' },
{
status: Math.random() > 0.5 ? 'shipped' : 'pending',
updatedAt: new Date()
}
);
}, 5000);
console.log('🚀 Real-time streaming started!');
} catch (error) {
console.error('❌ Error:', error.message);
}
}
startStreaming();
```
## 🎮 **Try the Live Demos**
### Real-Time Analytics Dashboard
```bash
cd real-time-analytics-dashboard
npm install
npm start
# Visit http://localhost:3000
```
### MySQL Analytics Dashboard
```bash
cd mysql-analytics-dashboard
npm install
npm start
# Visit http://localhost:3000
```
## 🔍 **Common Issues & Solutions**
### 1. **Connection Failed**
```javascript
// Check your database configuration
await UltimateStreamer.init({
dbType: 'mysql',
host: 'localhost', // Make sure this is correct
port: 3306,
database: 'myapp',
user: 'root',
password: ''
});
```
### 2. **Real-time Updates Not Working**
```javascript
// Make sure you're listening to the right collection
UltimateStreamer.on('orders', (data, meta) => {
console.log('Order update:', data);
});
```
### 3. **Data Not Appearing**
```javascript
// Check if data was pushed successfully
const result = await UltimateStreamer.push('orders', orderData);
console.log('Push result:', result);
// Check if data exists
const data = await UltimateStreamer.get('orders');
console.log('All orders:', data);
```
## 📚 **Next Steps**
1. **Explore the API**: Check out the [API Reference](../api-reference/) for all available methods
2. **Integration Guides**: See [Integration Guides](../integration/) for framework-specific setup
3. **Performance Tips**: Read [Performance Benchmarks](../benchmarks/) for optimization
4. **Deployment**: Follow [Production Deployment](../integration/#production) guide
## 🤝 **Need Help?**
- **Documentation**: [Complete Documentation](../)
- **GitHub Issues**: [Report bugs or request features](https://github.com/krunal-tarale/ultimate-streaming-package/issues)
- **Email Support**: [krunaltarale555@gmail.com](mailto:krunaltarale555@gmail.com)
---
**🎉 Congratulations!** You're now ready to build amazing real-time applications with Ultimate Streaming Package!