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 🙏

© 2024 – Pkg Stats / Ryan Hefner

lixbase

v2.0.0

Published

A manual sharded and managed NoSQL📦 object-focused database made for the cool kids.

Downloads

19

Readme

Lixbase @2.0.0 Node.JS [MIT License]

Banner

A manual sharded and managed NoSQL object-focused database made for the cool kids.

Built with 💛 by Nitlix

  • Nitlix - The creator of this project

Installation

Using NPM:

$ npm i lixbase --save

or

$ npm install lixbase --save

Features

More added soon.

Quickstart showcase

🥳 showcase.js

Here is our initial starting file, where we use Lixbase to manage our database files.

import Lixbase from "./src/index.js"


async function main() {
    let client = new Lixbase.Client


    //Custom object - Account
    client.objects.account = {
        id: null,
        type: null,
        data: null,
        created: null
    }

    //Custom object - Session
    client.objects.session = {
        id: null,
        type: null,
        data: null
    }

    //Custom saving directory
    client.dir = 'custom_dir_name'

    //Custom Dynamic ID Generation
    client.format.id = '[SHARD]-[TIME]-[RANDOM]'

    //No autosave
    client.autosave = -1

    //Autosaving every 10 seconds
    client.autosave = 10


    
    //Initialise our client after the configuration
    await client.init("shard_name")

    //Create new account object in the database
    client.addObject('account', {data: 'test', created: Date.now()}) 

    //Create new session object in the database
    client.addObject('session', {data: 'test2'}, 5)

    //Create another session object in the database, just for show
    client.addObject('session', {data: 'test3'}, 5)

    //Brand new query function, like SQL, but on steroids.
    //Returns a dict with objects that match the query function.
    //(Which is matching the data key 'data' to the string 'test')
    //Check out the output!
    console.log(
        client.query(['*'], (data)=>{
            if (data.data == 'test') {
                return true
            }
            return false
        }, ['data', 'created'])
    ) 


    //Save the database file
    client.save()



    // After all of this
    // check out /custom_dir_name/shard_name.json!
    // Good luck developing!
}


main()

✅ The output JSON

The file used to store and manage our database's object located at (custom_dir_name/shard_name.json).

😎 Documentation

Lixbase is assumed to be imported as "Lixbase" using

import Lixbase from "lixbase"

Client

Initialise using:

let client = new Lixbase.Client

Client Properties

Data

client.data
// The raw JSON data of your database.
// Can be edited:
client.data.id['hello'] = 'world'

Shard

client.shard
// The shard of your database
// Initially set with:
client.init("Shard goes here")

Autosave

client.autosave
// The period of autosave in your database (in seconds)
// At init(), if it is lower than 0:
// then autosaving won't happen.

// Change it before init()

Object types

client.objects
// The storage for all batch object types of your database.
// Stored in a dict.
// Create a new object structure using:

client.objects.account = {
    id: null,
    type: null,
    name: null,
    data: null
}

// WARNING!
// Each object type registry must have an 'id' and 'type'.

Directory

client.dir
// The directory where the database filed will be saved in.
// Change the variable before init()

Database Orientation

client.databaseOrientation
// When creating a database file 
// Lixbase will use this default structure.
// Do not edit out the existing modules unless
// you are planning to build a custom
// database using Lixbase.

// Use before init()

// Example usage:
client.databaseOrientation = {
    'id': {},
    'batch': {},
    'pets': {
        'cats': [],
        'dogs': []
    }
}

Formats

client.format.id
// The format for dynamically generating IDs on the go.
// The variables are:
// [SHARD], [TIME], [RANDOM], [NEXT]

// Example:
client.format.id = '[SHARD]-[TIME]-[RANDOM]'



// The [NEXT] Variable must go at the end
// it handles the going up of IDs in order.
// For example: 
client.shard = 'N1'
client.format.id = '[SHARD]-[NEXT]'

//The first object will have an ID of:
'N1-0'
//The next one will be:
'N1-1'
//And so on. 

Backups

client.backups.enabled
// Bool
// Used at init() to trigger the backups thread.

client.backups.interval
// Integer interval in MINUTES.

client.backups.dir
// Custom directory name for backups

client.backups.format
// The format for backup file saves
// The variables are:
// [SHARD], [TIME], [RANDOM]
// Example:
client.backups.format = '[SHARD]-[TIME]'

⚒️ Functions

.init()

await client.init(shard)

// Initialises the database using the provided shard.
// Default shard name: "N1"
// Creates any new files needed
// Starts out any background processes
// like autosave and backups.

// Use await for client.init(shard) to wait for it to finish.

This library is still being developed. It may have some bugs!

More docs coming later!