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 🙏

© 2026 – Pkg Stats / Ryan Hefner

xplorers-database-library

v1.0.0

Published

A Node.js library for interacting with CockroachDB

Readme

Database Library

A Node.js library for interacting with a PostgreSQL database, designed to work with CockroachDB. This library includes basic functionalities for connecting, executing queries, and managing database connections. The library also supports database migrations via Flyway.

Installation Steps

Step 1: Install the library

pnpm install https://github.com/xplorer-io/explorers-database

Step 2: Setup Environment Variables

Create a .env file in the root of your project and add the DATABASE_URL for your CockroachDB database connection.

DATABASE_URL=postgresql://user:password@localhost:26257/database_name?sslmode=disable

Replace user, password and database_name with your actual database credentials.

Step3: Configure Flyway (Optional, for Migrations)

If you want to use Flyway for managing migrations, ensure your flyway.conf is correctly configured with database connection strings. Example flyway.conf

flyway.url=${DATABASE_URL}
flyway.user=${FLYWAY_USER}
flyway.password=${FLYWAY_PASSWORD}
flyway.locations=${PATH TO YOUR SCHEMA/ SP FILE}

Flyway Naming Convention

For Flyway it's essential to follow a consistent naming convention for migration files, as Flyway organizes migrations by their version number and ensures they're applied in the correct order.

Schema Migrations Use the following naming convention for schema in migration files:

V<version_number>__<description.sql> V: Indicates a versioned migration version_number: A unique version number to order migrations. Example: V1.01__events.sql

For Stored Procedure or Repeateable Migrations: For stored procedures or repeatable migrations—migrations Flyway will apply every time they change—use the prefix R: R_<description>.sql

R: Indicates a repeateable migration description: A clear, concise description of the migration content. Avoid using version numbers, as these will be reapplied whenever they change. R_Get_Events.sql

Example usage:

import DatabaseLibrary from ".";

let config = {
    "url":"your database url",
    "user":"username",
    "password":"password"
}

const db_config = new DatabaseLibrary(config)

const query = "select * from events where location = $1"
// Using $1, $2, etc., for parameters to prevent SQL injection and ensure safe query execution.
// These placeholders are replaced with values in the params array when the query is executed.
const params = ['Test Location']
async function runQuery(){
    const rows = await db_config.execute(query, params)
    console.log(rows)
}

runQuery()