Secure, efficient, and reliable backups with encryption and versioning
🔐 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.
Secure your data with AES-256-GCM encryption before it leaves your system
Decentralized and reliable storage through Pinata integration
Track changes over time with built-in version control
Optimize performance with intelligent file caching
Detailed operation tracking for better monitoring
Compare backups with local files to track changes
# 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')
}
};
// 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')
}
};
// 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();
// Backup with encryption
const backup = await mogu.backup('./data', {
encryption: {
enabled: true,
key: 'your-encryption-key'
}
});
// Compare changes
const comparison = await mogu.compare(backup.hash, './data');
if (!comparison.isEqual) {
console.log('Changes detected!');
console.log(`Time since backup: ${comparison.formattedDiff}`);
}
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);
}
Mogu provides comprehensive documentation for LLM integration. Check out the detailed documentation to implement the features in your project.
📚 View Complete LLM Documentation