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

@zuziadev/base

v1.0.1

Published

A flexible database abstraction layer supporting multiple database types

Readme

@zuziadev/base

Çoklu veritabanı desteği sunan esnek bir veritabanı soyutlama katmanı.

Özellikler

  • 🔄 Çoklu veritabanı desteği (JSON, Firebase, MongoDB, BSON, YAML)
  • 🚀 Basit ve tutarlı API
  • ⚡ Asenkron işlemler
  • 🔒 Güvenli veri yönetimi
  • 📦 Kolay entegrasyon

Kurulum

npm install @zuziadev/base

Kullanım

JSON Veritabanı

const { Base } = require('@zuziadev/base');

// JSON veritabanı başlatma
const db = new Base({
  type: 'json',
  config: {
    path: './data.json' // Opsiyonel, varsayılan: './data.json'
  }
});

// Veri ekleme/güncelleme
await db.set('users.john', {
  name: 'John Doe',
  email: '[email protected]',
  age: 30
});

// Veri okuma
const user = await db.get('users.john');
console.log(user); // { name: 'John Doe', email: '[email protected]', age: 30 }

// Veri kontrolü
const exists = await db.has('users.john'); // true

// Veri silme
await db.delete('users.john');

Firebase Veritabanı

const { Base } = require('@zuziadev/base');

// Firebase veritabanı başlatma
const db = new Base({
  type: 'firebase',
  config: {
    credential: require('./firebase-credentials.json'),
    databaseURL: 'https://your-project.firebaseio.com'
  }
});

// Veri ekleme/güncelleme
await db.set('users/john', {
  name: 'John Doe',
  email: '[email protected]',
  role: 'user'
});

// Veri okuma
const user = await db.get('users/john');
console.log(user); // { name: 'John Doe', email: '[email protected]', role: 'user' }

// Veri kontrolü
const exists = await db.has('users/john'); // true

// Veri silme
await db.delete('users/john');

MongoDB Veritabanı

const { Base } = require('@zuziadev/base');

// MongoDB veritabanı başlatma
const db = new Base({
  type: 'mongodb',
  config: {
    connectionString: 'mongodb://localhost:27017/mydb',
    collection: 'users' // Opsiyonel, varsayılan: 'default'
  }
});

// Veri ekleme/güncelleme
await db.set('john', {
  name: 'John Doe',
  email: '[email protected]',
  age: 30
});

// Veri okuma
const user = await db.get('john');
console.log(user); // { name: 'John Doe', email: '[email protected]', age: 30 }

// Veri kontrolü
const exists = await db.has('john'); // true

// Veri silme
await db.delete('john');

BSON Veritabanı

const { Base } = require('@zuziadev/base');

// BSON veritabanı başlatma
const db = new Base({
  type: 'bson',
  config: {
    path: './data.bson' // Opsiyonel, varsayılan: './data.bson'
  }
});

// Veri ekleme/güncelleme
await db.set('users.john', {
  name: 'John Doe',
  email: '[email protected]',
  age: 30
});

// Veri okuma
const user = await db.get('users.john');
console.log(user); // { name: 'John Doe', email: '[email protected]', age: 30 }

// Veri kontrolü
const exists = await db.has('users.john'); // true

// Veri silme
await db.delete('users.john');

YAML Veritabanı

const { Base } = require('@zuziadev/base');

// YAML veritabanı başlatma
const db = new Base({
  type: 'yaml',
  config: {
    path: './data.yaml' // Opsiyonel, varsayılan: './data.yaml'
  }
});

// Veri ekleme/güncelleme
await db.set('users.john', {
  name: 'John Doe',
  email: '[email protected]',
  age: 30
});

// Veri okuma
const user = await db.get('users.john');
console.log(user); // { name: 'John Doe', email: '[email protected]', age: 30 }

// Veri kontrolü
const exists = await db.has('users.john'); // true

// Veri silme
await db.delete('users.john');

API Referansı

Base Sınıfı

const db = new Base(options);

Parametreler

  • options (Object)
    • type (String): Veritabanı türü ('json', 'firebase', 'mongodb', 'bson', 'yaml')
    • config (Object): Veritabanı yapılandırması

Metodlar

set(key, value)

Veri ekler veya günceller.

await db.set('users.john', { name: 'John Doe' });

get(key)

Veri okur.

const user = await db.get('users.john');

has(key)

Veri varlığını kontrol eder.

const exists = await db.has('users.john');

delete(key)

Veri siler.

await db.delete('users.john');

Veritabanı Türleri ve Yapılandırmaları

JSON Veritabanı

{
  type: 'json',
  config: {
    path: './data.json' // Opsiyonel
  }
}

Firebase Veritabanı

{
  type: 'firebase',
  config: {
    credential: require('./firebase-credentials.json'),
    databaseURL: 'https://your-project.firebaseio.com'
  }
}

MongoDB Veritabanı

{
  type: 'mongodb',
  config: {
    connectionString: 'mongodb://localhost:27017/mydb',
    collection: 'users' // Opsiyonel
  }
}

BSON Veritabanı

{
  type: 'bson',
  config: {
    path: './data.bson' // Opsiyonel
  }
}

YAML Veritabanı

{
  type: 'yaml',
  config: {
    path: './data.yaml' // Opsiyonel
  }
}

Bağımlılıklar

  • bson: ^5.5.0
  • firebase-admin: ^11.11.0
  • js-yaml: ^4.1.0
  • mongodb: ^6.3.0

Lisans

MIT

İletişim