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

@akib6074/simple-orm

v1.0.0

Published

A simple PostgreSQL ORM for TypeScript with connection pooling and CRUD operations

Readme

Simple ORM for PostgreSQL

A lightweight, type-safe ORM for PostgreSQL written in TypeScript. Features connection pooling, CRUD operations, and a simple API.

Installation

npm install @akib6074/simple-orm

Features

  • 🔄 Connection pooling for better performance
  • 🔒 Type-safe database operations
  • 📝 Simple and intuitive API
  • 🛠️ Full CRUD operations support
  • 🔍 Flexible query building
  • 🔐 SSL support for secure connections

Quick Start

import { Model } from '@akib6074/simple-orm';

// Define your model
class User extends Model<{
  id?: number;
  name: string;
  email: string;
}> {
  static tableName = 'users';
  static columns = ['id', 'name', 'email'];
}

// Initialize the database connection
await User.initialize({
  host: 'localhost',
  port: 5432,
  database: 'your_database',
  user: 'your_username',
  password: 'your_password'
});

// Create a new user
const newUser = await User.create({
  name: 'John Doe',
  email: '[email protected]'
});

// Find all users
const allUsers = await User.findAll();

// Find users with specific conditions
const specificUsers = await User.findAllWhere({ name: 'John' });

// Find user by ID
const user = await User.findById(1);

// Update user
const updatedUser = await User.update(1, { name: 'Jane Doe' });

// Delete user
const deleted = await User.delete(1);

// Don't forget to close the connection pool when done
await User.close();

API Reference

Model Class

The base class that provides all database operations.

Static Methods

  • initialize(config: DatabaseConfig): Promise<void>

    • Initializes the database connection pool
    • Required before any database operations
  • findAll(): Promise<ModelAttributes[]>

    • Returns all records from the table
  • findAllWhere(conditions: Partial<ModelAttributes>): Promise<ModelAttributes[]>

    • Returns records matching the given conditions
  • findById(id: number): Promise<ModelAttributes | null>

    • Returns a single record by ID
  • create(data: Partial<ModelAttributes>): Promise<ModelAttributes>

    • Creates a new record and returns it
  • update(id: number, data: Partial<ModelAttributes>): Promise<ModelAttributes | null>

    • Updates a record and returns the updated version
  • delete(id: number): Promise<boolean>

    • Deletes a record and returns true if successful
  • close(): Promise<void>

    • Closes the database connection pool

Types

interface DatabaseConfig {
  host: string;
  port: number;
  database: string;
  user: string;
  password: string;
  ssl?: boolean;
}

interface ModelAttributes {
  [key: string]: any;
}

Contributing

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

License

MIT