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

@vishwaraviraaj/galaxydb

v1.0.0

Published

a local database library

Readme

GalaxyDB

GalaxyDB is a lightweight, file-based database system using CSV files for storage. It provides basic CRUD operations along with advanced query features like joins, aggregations, and sorting, making it ideal for small-scale applications that require structured data management without a dedicated database server.

Features

  • 📂 Stores data in CSV format for simplicity and easy readability.
  • Supports schema-based data validation.
  • 🔄 Implements various types of joins: inner, left, right, full, and natural joins.
  • 🔍 Provides sorting, filtering, and aggregation functions.
  • Maintains a structured index for efficient lookups.
  • 📜 Logs all operations for debugging and tracking purposes.

Installation

npm install galaxydb

Directory Structure

project-root/
├── database/   # 📂 Stores all CSV data files
├── schema/     # 📜 Stores all schema definitions
├── logs/       # 📝 Stores logs of operations
└── index.js    #    Driver Code

Usage

Importing GalaxyDB

const { GalaxyUtility } = require('galaxydb');
const { GalaxyDB } = require('galaxydb');

GalaxyUtility Methods

🔹 readTable(tableName)

Reads the given table and returns its headers and records.

const utility = new GalaxyUtility();
const data = utility.readTable('users');
console.log(data);

🔹 innerJoin(table1, table2, key1, key2)

Performs an inner join between two tables.

const result = utility.innerJoin('users', 'orders', 'user_id', 'user_id');

🔹 leftJoin(table1, table2, key1, key2)

Performs a left join between two tables.

const result = utility.leftJoin('users', 'orders', 'user_id', 'user_id');

🔹 rightJoin(table1, table2, key1, key2)

Performs a right join (alias for left join with reversed parameters).

const result = utility.rightJoin('users', 'orders', 'user_id', 'user_id');

🔹 fullJoin(table1, table2, key1, key2)

Performs a full join between two tables.

const result = utility.fullJoin('users', 'orders', 'user_id', 'user_id');

🔹 naturalJoin(table1, table2)

Performs a natural join between two tables based on common column names.

const result = utility.naturalJoin('users', 'orders');

🔹 rangeQuery(tableName, column, minValue, maxValue)

Filters records where column falls within the specified range.

const result = utility.rangeQuery('orders', 'amount', 100, 500);

🔹 sortBy(tableName, column, order)

Sorts records in ascending (asc) or descending (desc) order.

const result = utility.sortBy('users', 'age', 'desc');

🔹 groupBy(tableName, column)

Groups records by a specified column.

const result = utility.groupBy('orders', 'status');

🔹 count(tableName, column, value)

Counts the number of records where column matches value.

const result = utility.count('users', 'role', 'admin');

🔹 sum(tableName, column)

Calculates the sum of a numeric column.

const result = utility.sum('orders', 'amount');

🔹 avg(tableName, column)

Calculates the average value of a numeric column.

const result = utility.avg('orders', 'amount');

🔹 max(tableName, column)

Finds the maximum value in a column.

const result = utility.max('orders', 'amount');

🔹 min(tableName, column)

Finds the minimum value in a column.

const result = utility.min('orders', 'amount');

🔹 firstNRecords(tableName, N)

Returns the first N records from a table.

const result = utility.firstNRecords('users', 5);

🔹 countUnique(tableName, column)

Counts unique occurrences of values in a column.

const result = utility.countUnique('users', 'city');

🔹 exists(tableName, conditionFn)

Checks if records satisfying a condition exist.

const result = utility.exists('users', row => row.age > 30);

GalaxyDB Methods

🔹 new GalaxyDB(entity)

Creates a new instance of GalaxyDB for a specific entity.

const userDB = new GalaxyDB('users');

🔹 create(obj)

Inserts a new record.

userDB.create({ _id: '1', name: 'ABC DE', age: 30 });

🔹 readAll()

Reads all records from the table.

const users = userDB.readAll();

🔹 update(id, updatedData)

Updates a record by _id.

userDB.update('1', { age: 31 });

🔹 delete(id)

Deletes a record by _id.

userDB.delete('1');

🔹 queryWithForeignKey(primaryRepo, foreignRepo, foreignKey)

Performs a join between two repositories.

const ordersDB = new GalaxyDB('orders');
const result = GalaxyDB.queryWithForeignKey(userDB, ordersDB, 'user_id');