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

@inceptools/db

v1.0.2

Published

IncepTools DB Service - A modular database adapter for MongoDB, SQL (Sequelize), and Redis.

Readme

Overview

@inceptools/db is a powerful database adapter that provides seamless integration with multiple databases, including:

  • MongoDB (via Mongoose)
  • SQL (via Sequelize)
  • Redis

It simplifies database management by offering a unified API for different database types, allowing for efficient and scalable application development.

Features

  • Unified Interface: Work with MongoDB, SQL databases, and Redis using a consistent API.
  • Multiple Connections: Connect to multiple databases of different types simultaneously.
  • Type Safety: Full TypeScript support with proper type inference.
  • Migration Support: Built-in migration tools for MongoDB and SQL databases.
  • Logging: Configurable logging for all database operations.

Installation

npm install @inceptools/db

or

yarn add @inceptools/db

Quick Start

import { DBService, SUPPORTED_DBS } from "@inceptools/db";
import mongoose from "mongoose";
import { Sequelize, DataTypes } from "sequelize";

// Define your database schemas/models
const db = {
	mongodb: {
		users: new mongoose.Schema({
			name: String,
			email: String,
		}),
	},
	postgres: {
		contacts: (sequelize: Sequelize) => {
			return sequelize.define("Contact", {
				name: {
					type: DataTypes.STRING,
					allowNull: false,
				},
				email: {
					type: DataTypes.STRING,
					allowNull: false,
				},
			});
		},
	},
};

// Configure your database connections
const config = {
	mongodb: {
		type: SUPPORTED_DBS.MONGO_DB,
		connectionString: "mongodb://localhost:27017/myapp",
		models: db.mongodb,
	},
	postgres: {
		type: SUPPORTED_DBS.SQL,
		connectionString: "postgresql://user:password@localhost:5432/myapp",
		models: db.postgres,
		configOptions: {
			dialect: "postgres",
		},
	},
	redis: {
		type: SUPPORTED_DBS.REDIS,
		connectionString: "redis://localhost:6379",
	},
};

// Create a database service instance
const dbService = new DBService(config);

// Connect to all databases
await dbService.connect();

// Use your database models
const users = await dbService.mongodb.users.find();
const contacts = await dbService.postgres.contacts.findAll();
await dbService.redis.set("key", "value");

// Close all connections when done
await dbService.closeConnection();

Individual Database Usage

MongoDB

import { MongoService, SUPPORTED_DBS } from "@inceptools/db";
import mongoose from "mongoose";

// Define your MongoDB schemas
const schemas = {
	users: new mongoose.Schema({
		name: String,
		email: String,
		createdAt: { type: Date, default: Date.now },
	}),
};

// Create a MongoDB service instance
const mongoService = new MongoService({
	type: SUPPORTED_DBS.MONGO_DB,
	connectionString: "mongodb://localhost:27017/myapp",
	models: schemas,
});

// Connect to MongoDB
await mongoService.connect();

// Use your models
const newUser = await mongoService.users.create({
	name: "John Doe",
	email: "[email protected]",
});

const users = await mongoService.users.find();

// Close the connection when done
await mongoService.closeConnection();

Migrations

MongoDB Migrations

// Create a migration service
const mongoService = dbService.mongodb;
const migrationService = mongoService.migrationService;

// Initialize migrations
await migrationService.init();

// Generate a new migration
await migrationService.generateMigration("add-user-roles");

// Apply pending migrations
await migrationService.migrate();

SQL Migrations

// Create a migration service
const sqlService = dbService.postgres;
const migrationService = sqlService.migrationService;

// Initialize migrations
await migrationService.init();

// Generate a new migration
await migrationService.generateMigration("add-order-status");

// Apply pending migrations
await migrationService.migrate();

Support

@inceptools/db is an open-source project under the MIT license. If you find this package useful, consider supporting it by contributing or reporting issues on GitHub.

Stay in Touch

License

@inceptools/db is MIT licensed.