npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cloudloyaldb

v2.0.3

Published

Centralized NoSQL Database - MongoDB benzeri API ile cloud server'a veri saklama, real-time sync

Readme

CloudLoyalDB ☁️🚀

Centralized NoSQL Database with Multi-File Organization - MongoDB benzeri API ile cloud server'a veri saklama, real-time sync ve çoklu dosya yönetimi.

🌟 Yeni Özellikler

  • ☁️ Centralized Storage - Tüm projeleriniz aynı veriye erişebilir
  • Real-time Sync - WebSocket ile anlık veri senkronizasyonu
  • 📁 Multi-File System - Her database için ayrı JSON dosyası
  • 🗂️ Organized Data - data/ klasöründe düzenli dosya yapısı
  • 🔄 Auto Backup - 24 saatte bir otomatik backup
  • 🧹 Auto Cleanup - 2 günden eski backup'lar otomatik silinir
  • 📡 Multi-Project - Birden fazla proje aynı database'e erişebilir

📦 Kurulum

Client (NPM Package)

npm install cloudloyaldb

Server Kurulumu

# Server dosyalarını indirin
git clone https://github.com/yourusername/cloudloyaldb.git
cd cloudloyaldb

# Dependencies yükleyin  
npm install

# Server'ı başlatın
npm run server

🚀 Temel Kullanım

Bağlantı Kurma

const CloudLoyalDB = require('cloudloyaldb');

const db = new CloudLoyalDB({
    serverUrl: 'http://localhost:3000',
    apiKey: 'your-api-key',
    projectId: 'my-project',
    database: 'main'  // data/main.json
});

// Server'a bağlan
await db.connect();

// Koleksiyon seç
await db.use('test');

📁 Multi-Database Sistemi

Database Dosyaları

Server'da data/ klasöründe her database için ayrı JSON dosyası:

data/
├── main.json          # Ana database
├── botveri.json       # Discord bot verileri
├── ecommerce.json     # E-ticaret verileri
├── analytics.json     # Analitik verileri
└── logs.json          # Log verileri

Database Kullanımı

// Ana database
const mainDB = new CloudLoyalDB({
    serverUrl: 'http://localhost:3000',
    database: 'main'      // → data/main.json
});

// Bot verileri
const botDB = new CloudLoyalDB({
    serverUrl: 'http://localhost:3000', 
    database: 'botveri'   // → data/botveri.json
});

// E-ticaret verileri
const shopDB = new CloudLoyalDB({
    serverUrl: 'http://localhost:3000',
    database: 'ecommerce' // → data/ecommerce.json
});

await mainDB.connect();
await botDB.connect();
await shopDB.connect();

🎯 Pratik Örnekler

Discord Bot Yönetimi - data/botveri.json

const botDB = new CloudLoyalDB({
    database: 'botveri'
});

await botDB.connect();
await botDB.use('discord_bots');

// Bot ekle
await botDB.set('loyal_bot.name', 'LoyalBot');
await botDB.set('loyal_bot.token', 'BOT_TOKEN');
await botDB.push('loyal_bot.guilds', '1298554568468336660');
await botDB.set('loyal_bot.status', 'online');

// Bot durumunu kontrol
const botStatus = await botDB.get('loyal_bot.status'); // "online"
const hasBot = await botDB.has('loyal_bot'); // true

// Bot konfigürasyonu
await botDB.push('loyal_bot.features', 'moderation');
await botDB.push('loyal_bot.features', 'music');
await botDB.push('loyal_bot.features', 'fun');

console.log('Bot Özellikleri:', await botDB.get('loyal_bot.features'));
// ["moderation", "music", "fun"]

E-ticaret Sistemi - data/ecommerce.json

const shopDB = new CloudLoyalDB({
    database: 'ecommerce'
});

await shopDB.connect();

// Ürün yönetimi
await shopDB.use('products');
await shopDB.push('electronics', {
    id: 'laptop_001',
    name: 'MacBook Pro M2',
    price: 45000,
    stock: 15,
    tags: ['apple', 'laptop', 'premium']
});

// Kullanıcı sipariş
await shopDB.use('orders');
await shopDB.set('order_001.customer', 'Ahmet Yılmaz');
await shopDB.set('order_001.total', 45000);
await shopDB.push('order_001.items', {
    productId: 'laptop_001',
    quantity: 1,
    price: 45000
});

// Stok güncellemesi
const products = await shopDB.use('products').get('electronics');
products[0].stock -= 1; // Satış sonrası stok azalt
await shopDB.setByPriority('electronics', products[0], 0);

Analytics Veri Toplama - data/analytics.json

const analyticsDB = new CloudLoyalDB({
    database: 'analytics'
});

await analyticsDB.connect();
await analyticsDB.use('page_views');

// Sayfa görüntülenme sayacı
await analyticsDB.set('homepage.today', 150);
await analyticsDB.set('homepage.total', 98750);

// Kullanıcı aktivitesi
await analyticsDB.use('user_actions');
await analyticsDB.push('today', {
    userId: 'user123',
    action: 'login',
    timestamp: new Date().toISOString(),
    page: 'dashboard'
});

// İstatistik hesaplama
const todayViews = await analyticsDB.use('page_views').get('homepage.today');
const totalActions = await analyticsDB.use('user_actions').get('today');
console.log(`Bugün ${todayViews} görüntülenme, ${totalActions.length} kullanıcı eylemi`);

🔧 Croxydb Tarzı API

SET - Veri Ekleme/Güncelleme

await db.set("x.y.z", "abc"); // abc

// Nested objeler
await db.set("user.profile.name", "Ali");
await db.set("user.profile.age", 25);
await db.set("user.settings.theme", "dark");

GET/FETCH - Veri Alma

await db.get("x"); // {y: {z: "abc"}}
await db.fetch("x"); // {y: {z: "abc"}} - get() ile aynı

await db.get("x.y"); // {z: "abc"}
await db.get("x.y.z"); // "abc"

await db.get("user.profile"); // {name: "Ali", age: 25}
await db.get("user.profile.name"); // "Ali"

ALL - Tüm Koleksiyon

await db.all(); // {x: {y: {z: "abc"}}, user: {profile: {name: "Ali", age: 25}}}

PUSH - Array'e Ekleme

await db.push("a", "hello");  // ["hello"]
await db.push("a", "world");  // ["hello", "world"]

// Object array
await db.push("b", {test: "croxydb"});  // [{test: "croxydb"}]
await db.push("b", {test2: "croxydb2"}); // [{test: "croxydb"}, {test2: "croxydb2"}]

// Karmaşık objeler
await db.push("products", {
    id: 1,
    name: "Laptop",
    price: 25000,
    tags: ["electronics", "computer"]
});

UNPUSH - Array'den Değer Silme

await db.unpush("a", "hello"); // ["world"]
await db.unpush("products", {id: 1}); // Object'i siler

DELBYPRIORITY - Index ile Silme

await db.delByPriority("b", 0); // İlk elemanı sil
await db.delByPriority("b", 1); // İkinci elemanı sil
// [{test: "croxydb"}, {test2: "croxydb2"}] → [{test2: "croxydb2"}]

SETBYPRIORITY - Index ile Güncelleme

await db.setByPriority("b", {newtest: "hey this is edited"}, 0);
// [{test2: "croxydb2"}] → [{newtest: "hey this is edited"}]

await db.setByPriority("products", {
    id: 999,
    name: "Updated Product",
    price: 999
}, 0); // İlk ürünü günceller

HAS - Veri Kontrol

await db.has("x"); // true
await db.has("x.y"); // true  
await db.has("x.y.z"); // true
await db.has("nonexistent"); // false

await db.has("user.profile.name"); // true
await db.has("user.profile.phone"); // false

DELETE - Veri Silme

await db.delete("x.y.z"); // true - Sadece z'yi siler
await db.delete("x.y"); // true - y object'ini siler
await db.delete("x"); // true - Tüm x object'ini siler

await db.delete("products"); // Array'i siler
await db.delete("user.profile.age"); // Nested field siler

DELETEALL - Koleksiyon Temizleme

await db.deleteAll(); // true - Tüm koleksiyonu temizler

// Sonrasında
await db.all(); // {} - Boş obje döner

🌐 Multi-Project Veri Paylaşımı

Project A - E-ticaret Backend

const ecommerceDB = new CloudLoyalDB({
    serverUrl: 'http://localhost:3000',
    apiKey: 'your-api-key',
    projectId: 'ecommerce-backend',
    database: 'ecommerce'  // data/ecommerce.json
});

await ecommerceDB.connect();
await ecommerceDB.use('customers');
await ecommerceDB.set('customer123.name', 'Zeynep Öztürk');
await ecommerceDB.push('customer123.orders', {
    id: 'order_001',
    amount: 1500,
    date: new Date().toISOString()
});

Project B - Admin Dashboard (Aynı Database)

const adminDB = new CloudLoyalDB({
    serverUrl: 'http://localhost:3000', 
    apiKey: 'your-api-key',
    projectId: 'admin-dashboard',
    database: 'ecommerce'  // Aynı database!
});

await adminDB.connect();
await adminDB.use('customers');

// Project A'nın verilerine erişim
const customer = await adminDB.get('customer123'); 
console.log(customer.name); // "Zeynep Öztürk"
console.log(customer.orders); // [{id: 'order_001', amount: 1500, ...}]

// Müşteri statusu güncelle
await adminDB.set('customer123.status', 'VIP');
await adminDB.set('customer123.loyaltyPoints', 2500);

Project C - Discord Bot (Farklı Database)

const botDB = new CloudLoyalDB({
    serverUrl: 'http://localhost:3000',
    apiKey: 'your-api-key',
    projectId: 'discord-bot',
    database: 'botveri'  // data/botveri.json
});

await botDB.connect();
await botDB.use('discord_bots');

// Bot durumu güncelle
await botDB.set('loyal_bot.status', 'online');
await botDB.push('loyal_bot.active_guilds', '1298554568468336660');

// Real-time dinle
botDB.on('dataChanged', (change) => {
    if (change.database === 'botveri') {
        console.log('Bot verileri değişti:', change);
        // Bot'u restart et veya config'i yenile
        updateBotConfiguration(change);
    }
});

📊 Data Organization Benefits

File Yapısı Avantajları

| Özellik | Multi-File System | Single File | |---------|-------------------|-------------| | Performance | ✅ Sadece gerekli dosya yüklenir | ❌ Tüm veri RAM'de | | Organization | ✅ Domain'e göre ayrım | ❌ Karışık yapı | | Backup | ✅ Seçici backup | ❌ Tüm veri backup | | Collaboration | ✅ Team üyesi farklı DB'ye erişim | ❌ Conflict riski | | Maintenance | ✅ Kolay debug/inceleme | ❌ Karmaşık |

Database Seçimi Örnekleri

// Proje türüne göre database seçimi
const projectType = 'discord-bot';

let database;
switch(projectType) {
    case 'discord-bot':
        database = 'botveri';    // → data/botveri.json
        break;
    case 'e-commerce':
        database = 'ecommerce';  // → data/ecommerce.json
        break;
    case 'analytics':
        database = 'analytics';  // → data/analytics.json
        break;
    default:
        database = 'main';       // → data/main.json
}

const db = new CloudLoyalDB({ database });
await db.connect();

💾 Backup Sistemi

Her database için ayrı backup:

flydb-backups/
├── main-backup-2025-01-15T10-00-00-000Z.json
├── botveri-backup-2025-01-15T10-00-00-000Z.json  
├── ecommerce-backup-2025-01-15T10-00-00-000Z.json
└── analytics-backup-2025-01-15T10-00-00-000Z.json

Manuel Backup

// Belirli database'i backup et
const backupResult = await db.backup('my-backup');
console.log('Backup oluşturuldu:', backupResult.backupFile);

// Tüm database'leri backup et
const allBackups = await db.backupAll();

Otomatik Backup

# Server başladığında her database için kontrol
CloudLoyalDB: main.json - Son 10 dakika içinde backup mevcut
CloudLoyalDB: botveri.json - Backup oluşturuluyor...
CloudLoyalDB: ecommerce.json - Backup oluşturuluyor...

📁 Veri Yapısı Örnekleri

data/main.json - Ana Database

{
  "users": {
    "user123": {
      "name": "Ali Veli",
      "email": "[email protected]",
      "preferences": {
        "theme": "dark",
        "language": "tr"
      }
    }
  },
  "system_config": {
    "version": "1.0.0",
    "maintenance": false
  }
}

data/botveri.json - Discord Bot Database

{
  "discord_bots": {
    "loyal_bot": {
      "name": "LoyalBot",
      "token": "***",
      "guilds": ["1298554568468336660"],
      "status": "online",
      "features": ["moderation", "music", "fun"],
      "commands": {
        "ban": {"enabled": true, "permission": "ADMINISTRATOR"},
        "kick": {"enabled": true, "permission": "KICK_MEMBERS"}
      }
    }
  },
  "guild_settings": {
    "1298554568468336660": {
      "prefix": "!",
      "welcome_channel": "123456789",
      "mod_role": "987654321"
    }
  }
}

data/ecommerce.json - E-ticaret Database

{
  "products": {
    "electronics": [
      {
        "id": "laptop_001",
        "name": "MacBook Pro M2",
        "price": 45000,
        "stock": 15,
        "tags": ["apple", "laptop", "premium"]
      }
    ]
  },
  "customers": {
    "customer123": {
      "name": "Zeynep Öztürk",
      "email": "[email protected]",
      "orders": [
        {
          "id": "order_001",
          "total": 45000,
          "status": "completed"
        }
      ]
    }
  }
}

⚡ Real-time Events

// Tüm database değişikliklerini dinle
db.on('dataChanged', (change) => {
    const { database, collection, path, value, operation, timestamp } = change;
    console.log(`[${database}] ${collection}/${path} ${operation}:`, value);
});

// Sadece bot verilerini dinle
botDB.on('dataChanged', (change) => {
    if (change.database === 'botveri' && change.collection === 'discord_bots') {
        console.log('Bot konfigürasyonu değişti:', change);
        // Bot'u yeniden başlat
        restartBot(change.path);
    }
});

// Belirli koleksiyonu dinle
ecommerceDB.watch('orders', (change) => {
    console.log('Yeni sipariş:', change);
    // Email gönder, stok güncelle
    processNewOrder(change);
});

🎯 Hızlı Test

# 1. Server'ı başlat
npm run server

# 2. Demo'yu çalıştır (multi-database test)
npm run demo

# 3. Özel database testi
node -e "
const CloudLoyalDB = require('./index.js');
const db = new CloudLoyalDB({database: 'test'});
db.connect().then(() => {
    db.use('example').set('key', 'value');
    console.log('data/test.json created!');
});
"

💡 Croxydb'den Migration

// Eski croxydb kodu
const db = require("croxydb");
db.set("x.y.z", "abc");
const data = db.get("x");
db.push("a", "hello");

// Yeni CloudLoyalDB kodu
const db = new CloudLoyalDB({
    database: 'main'  // Spesifik database seç
});
await db.connect();
await db.use('main');
await db.set("x.y.z", "abc");
const data = await db.get("x");
await db.push("a", "hello");

🔧 API Reference

| Method | Syntax | Açıklama | Örnek | |--------|--------|----------|-------| | set() | await db.set(path, value) | Veri ekle/güncelle | await db.set("user.name", "Ali") | | get() | await db.get(path) | Veri al | await db.get("user.name") | | fetch() | await db.fetch(path) | get() ile aynı | await db.fetch("user") | | all() | await db.all() | Tüm koleksiyon | await db.all() | | push() | await db.push(path, value) | Array'e ekle | await db.push("hobbies", "reading") | | unpush() | await db.unpush(path, value) | Array'den değer sil | await db.unpush("hobbies", "gaming") | | delByPriority() | await db.delByPriority(path, index) | Index ile sil | await db.delByPriority("arr", 0) | | setByPriority() | await db.setByPriority(path, value, index) | Index ile güncelle | await db.setByPriority("arr", "new", 1) | | has() | await db.has(path) | Veri var mı | await db.has("user.name") | | delete() | await db.delete(path) | Veri sil | await db.delete("user.age") | | deleteAll() | await db.deleteAll() | Koleksiyonu temizle | await db.deleteAll() | | use() | await db.use(collection) | Koleksiyon seç | await db.use("users") |

🌟 Avantajlar

| Özellik | CloudLoyalDB | Croxydb | MongoDB | |---------|--------------|---------|---------| | Multi-Database | ✅ Dosya bazlı organizasyon | ❌ Tek dosya | ✅ Database/Collection | | Real-time Sync | ⚡ WebSocket anlık | ❌ Yok | ❌ Change Streams kompleks | | Easy Setup | 🚀 Tek komut | 🚀 Tek komut | ❌ Karmaşık kurulum | | File Organization | 📁 data/ klasöründe düzenli | 📄 Tek dosya | 🗄️ Binary storage | | Backup System | 🔄 Otomatik per-database | ❌ Manuel | ✅ Professional | | Team Collaboration | 👥 Database bazlı paylaşım | ❌ Zor | ✅ User management |

📞 Deployment

Docker ile Multi-Database

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .

# Data klasörü oluştur
RUN mkdir -p data

EXPOSE 3000 3001
CMD ["node", "server.js"]

Volume mounting

# Data klasörünü host'a bağla
docker run -v $(pwd)/data:/app/data -p 3000:3000 -p 3001:3001 cloudloyaldb

Lisans

MIT


🚀 CloudLoyalDB Multi-File System ile verilerinizi organize edin!
📧 Sorularınız için: GitHub Issues