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

@michinded/odbc-orm-js

v0.1.0-beta.0

Published

A lightweight ORM for ODBC databases

Readme

@michinded/odbc-orm-js

A lightweight ORM for ODBC databases written in JavaScript. Manage multiple database connections with a simple, Laravel-inspired configuration system.

Features

  • Multiple Database Connections - Manage multiple ODBC connections with unique aliases
  • Simple Configuration - Laravel-style config files with environment variable support
  • Auto Setup - Automatically creates configuration files on installation
  • Singleton Pattern - Efficient connection management across your application
  • Well Documented - Comprehensive JSDoc documentation for all classes and methods

Installation

npm install @michinded/odbc-orm-js

or with pnpm:

pnpm add @michinded/odbc-orm-js

After installation, the package automatically creates:

  • config/connections.js - Database connections configuration
  • .env.example - Environment variables template

Configuration

1. Setup Environment Variables

Copy .env.example to .env and update with your database credentials:

# .env
DB_PRIMARY_CONNECTION_STRING=DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=mydb;UID=user;PWD=password
DB_SECONDARY_CONNECTION_STRING=DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=otherdb;UID=user;PWD=password

2. Configure Connections

Edit config/connections.js to define your database connections:

require('dotenv').config();

module.exports = {
    // Default connection alias
    default: 'primary',

    // Array of database connections
    connections: [
        {
            alias: 'primary',
            connectionString: process.env.DB_PRIMARY_CONNECTION_STRING,
            options: {}
        },
        {
            alias: 'secondary',
            connectionString: process.env.DB_SECONDARY_CONNECTION_STRING,
            options: {}
        }
    ]
};

Usage

Basic Usage

const { DB } = require('@michinded/odbc-orm-js');

async function example() {
    // Use default connection
    const conn = await DB.connection();
    const result = await conn.query('SELECT * FROM users');
    console.log(result);

    // Close connection when done
    await DB.closeConnection();
}

Using Multiple Connections

const { DB } = require('@michinded/odbc-orm-js');

async function multipleConnections() {
    // Connect to primary database
    const primary = await DB.connection('primary');
    const users = await primary.query('SELECT * FROM users');

    // Connect to secondary database
    const secondary = await DB.connection('secondary');
    const products = await secondary.query('SELECT * FROM products');

    // Close specific connection
    await DB.closeConnection('primary');

    // Or close all connections
    await DB.closeConnection();
}

Get Available Connections

const { DB } = require('@michinded/odbc-orm-js');

// List all configured connection aliases
const aliases = DB.getAliases();
console.log('Available connections:', aliases);

// Get default connection alias
const defaultAlias = DB.getDefaultAlias();
console.log('Default connection:', defaultAlias);

API Reference

DB.connection(alias)

Gets a database connection by alias.

  • Parameters:
    • alias (string, optional) - Connection alias. Uses default if not provided.
  • Returns: Promise - ODBC connection object
  • Throws: Error if connection alias not found

DB.closeConnection(alias)

Closes a specific connection or all connections.

  • Parameters:
    • alias (string, optional) - Connection alias. Closes all if not provided.
  • Returns: Promise

DB.getAliases()

Gets list of all configured connection aliases.

  • Returns: Array - Array of connection aliases

DB.getDefaultAlias()

Gets the default connection alias.

  • Returns: string|null - Default connection alias

Examples

Check the examples/ directory for more usage examples:

node examples/basic-usage.js

Requirements

  • Node.js >= 14.0.0
  • ODBC Driver installed on your system

Project Structure

@michinded/odbc-orm-js/
├── src/
│   ├── core/
│   │   ├── Connection.js         # Connection wrapper class
│   │   └── ConnectionManager.js  # Manages multiple connections
│   └── index.js                  # Main entry point
├── stubs/
│   ├── .env.example             # Environment variables template
│   └── connections.js.stub      # Connections config template
├── scripts/
│   └── postinstall.js           # Auto-setup script
└── examples/
    └── basic-usage.js           # Usage examples

License

MIT

Author

Michinded

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.