Mogu Logo

Modern Decentralized Backup System

Secure, efficient, and reliable backups with encryption and versioning

✨ Why Mogu?

🔐 Mogu is a modern backup system that solves data security and reliability challenges by combining end-to-end encryption with decentralized IPFS storage.

🌐 Unlike traditional cloud backup services, Mogu ensures your data remains under your control, encrypted before leaving your system, and securely distributed across the IPFS network.

🚀 With advanced features like automatic versioning, smart caching, and detailed version comparison, Mogu is the perfect choice for developers and teams who need a robust, secure, and easy-to-integrate backup system.

Features

🔒 End-to-End Encryption

Secure your data with AES-256-GCM encryption before it leaves your system

📦 IPFS Storage

Decentralized and reliable storage through Pinata integration

🔄 Automatic Versioning

Track changes over time with built-in version control

💾 Smart Caching

Optimize performance with intelligent file caching

📝 Structured Logging

Detailed operation tracking for better monitoring

🔍 Version Comparison

Compare backups with local files to track changes

🚀 Quick Start

Installation and Setup

# Install Mogu
yarn add @scobru/mogu

# or
npm install @scobru/mogu

# Initialize and use
import { Mogu } from 'mogu';

const baseConfig = {
  storage: {
    service: 'PINATA' as const,
    config: {
      pinataJwt: process.env.PINATA_JWT || '',
      pinataGateway: process.env.PINATA_GATEWAY || ''
    }
  },
  paths: {
    backup: './backup',
    restore: './restore',
    storage: './storage',
    logs: path.join(process.cwd(), 'logs')
  }
};

🌐 IPFS-CLIENT Configuration

// Configure with IPFS-CLIENT
const ipfsConfig = {
  storage: {
    service: 'IPFS-CLIENT' as const,
    config: {
      url: 'http://localhost:5001' // Your IPFS node HTTP API endpoint
    }
  },
  paths: {
    backup: './backup',
    restore: './restore',
    storage: './storage',
    logs: path.join(process.cwd(), 'logs')
  }
};

📦 Direct Storage Operations

// Upload JSON data directly
const jsonResult = await mogu.uploadJson({
  name: "test",
  data: { key: "value" }
});
console.log("JSON uploaded:", jsonResult.id);

// Upload a single file
const fileResult = await mogu.uploadFile("./path/to/file.txt");
console.log("File uploaded:", fileResult.id);

// Get data by hash
const data = await mogu.getData("QmHash...");
console.log("Retrieved data:", data);

// Get metadata
const metadata = await mogu.getMetadata("QmHash...");
console.log("Content metadata:", metadata);

// Check if content is pinned
const isPinned = await mogu.isPinned("QmHash...");
console.log("Is content pinned?", isPinned);

// Unpin content
const unpinned = await mogu.unpin("QmHash...");
if (unpinned) {
  console.log("Content unpinned successfully");
}

// Get storage service instance
const storage = mogu.getStorage();

📚 Documentation

🔐 Encrypted Backup

// Backup with encryption
const backup = await mogu.backup('./data', {
  encryption: {
    enabled: true,
    key: 'your-encryption-key'
  }
});

🔄 Version Comparison

// Compare changes
const comparison = await mogu.compare(backup.hash, './data');
if (!comparison.isEqual) {
  console.log('Changes detected!');
  console.log(`Time since backup: ${comparison.formattedDiff}`);
}

⚠️ Error Handling

try {
  const deleted = await mogu.delete('non-existent-hash');
  if (!deleted) {
    console.log('Backup not found or already deleted');
  }
} catch (error) {
  console.error('Operation failed:', error);
}

🤖 LLM Integration

Mogu provides comprehensive documentation for LLM integration. Check out the detailed documentation to implement the features in your project.

📚 View Complete LLM Documentation