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

@slickteam/nestjs-pg-typeorm

v2.1.4

Published

Module for Postgresql Typeorm with Nestjs

Readme

@slickteam/nestjs-pg-typeorm

npm version License: MIT

A NestJS module that provides pre-configured PostgreSQL database integration using TypeORM.

Table of Contents

Prerequisites

  • Node.js >= 18
  • NestJS >= 11
  • PostgreSQL database

Installation

npm install @slickteam/nestjs-pg-typeorm

Or with pnpm:

pnpm add @slickteam/nestjs-pg-typeorm

Configuration

Add the following environment variables to your .env file:

# Required
POSTGRESQL_ADDON_HOST=localhost
POSTGRESQL_ADDON_PORT=5432
POSTGRESQL_ADDON_USER=user
POSTGRESQL_ADDON_PASSWORD=password
POSTGRESQL_ADDON_DB=db_name
POSTGRESQL_MAX_POOL_SIZE=25

# Optional
POSTGRESQL_SYNCHRONIZE=false          # Auto-sync schema (disable in production)
POSTGRESQL_LOGGER=                    # Logger type: advanced-console | simple-console | file | debug
POSTGRESQL_LOGGING=false              # Enable SQL query logging
POSTGRESQL_ENTITY_PATH=dist/**/*.entity.js,dist/**/*Entity.js
POSTGRESQL_MIGRATION_PATH=dist/migration/*.js

Environment Variables Reference

| Variable | Required | Default | Description | | --------------------------- | -------- | --------------------------------------- | -------------------------------- | | POSTGRESQL_ADDON_HOST | Yes | - | Database host | | POSTGRESQL_ADDON_PORT | Yes | - | Database port | | POSTGRESQL_ADDON_USER | Yes | - | Database user | | POSTGRESQL_ADDON_PASSWORD | Yes | - | Database password | | POSTGRESQL_ADDON_DB | Yes | - | Database name | | POSTGRESQL_MAX_POOL_SIZE | Yes | - | Connection pool size | | POSTGRESQL_SYNCHRONIZE | No | false | Auto-synchronize database schema | | POSTGRESQL_LOGGER | No | - | TypeORM logger type | | POSTGRESQL_LOGGING | No | false | Enable query logging | | POSTGRESQL_ENTITY_PATH | No | dist/**/*entity.js,dist/**/*Entity.js | Glob patterns for entity files | | POSTGRESQL_MIGRATION_PATH | No | dist/migration/*.js | Glob pattern for migration files |

Usage

Import the DatabaseModule in your application module:

import { Module } from '@nestjs/common';
import { DatabaseModule } from '@slickteam/nestjs-pg-typeorm';

@Module({
  imports: [DatabaseModule],
})
export class AppModule {}

Using with Entities

Register your entities using TypeOrmModule.forFeature():

import { Module } from '@nestjs/common';
import { DatabaseModule, TypeOrmModule } from '@slickteam/nestjs-pg-typeorm';

import { User } from './entities/user.entity';
import { UserService } from './user.service';

@Module({
  imports: [DatabaseModule, TypeOrmModule.forFeature([User])],
  providers: [UserService],
})
export class UserModule {}

Injecting Repositories

import { Injectable } from '@nestjs/common';
import { InjectRepository, Repository } from '@slickteam/nestjs-pg-typeorm';

import { User } from './entities/user.entity';

@Injectable()
export class UserService {
  constructor(
    @InjectRepository(User)
    private readonly userRepository: Repository<User>,
  ) {}

  findAll(): Promise<User[]> {
    return this.userRepository.find();
  }
}

Exports

This module re-exports all TypeORM exports and provides the following:

| Export | Description | | --------------------------- | ---------------------------------------- | | DatabaseModule | Pre-configured TypeORM module | | TypeOrmModule | NestJS TypeORM module for entity binding | | TypeOrmModuleAsyncOptions | Async configuration options type | | TypeOrmModuleOptions | Configuration options type | | TypeOrmOptionsFactory | Options factory interface | | InjectDataSource | Decorator to inject DataSource | | InjectEntityManager | Decorator to inject EntityManager | | InjectRepository | Decorator to inject Repository |

All TypeORM exports (Entity, Column, Repository, etc.) are also available directly from this package.

Migration Commands

This package provides the slick-migration CLI for managing database migrations.

Using with npx

npx slick-migration <command> [options]

Using with package.json scripts

{
  "scripts": {
    "migration:create": "slick-migration create",
    "migration:generate": "slick-migration generate",
    "migration:run": "slick-migration run",
    "migration:revert": "slick-migration revert",
    "migration:show": "slick-migration show",
    "migration:drop": "slick-migration drop"
  }
}

Commands Reference

| Command | Description | Example | | ---------- | ---------------------------------------- | -------------------------------------------------- | | create | Create a new empty migration file | slick-migration create src/migrations/CreateUser | | generate | Generate a migration from schema changes | slick-migration generate src/migrations/AddEmail | | run | Run pending migrations | slick-migration run | | revert | Revert the last executed migration | slick-migration revert | | show | Show all migrations and their status | slick-migration show | | drop | Drop the database schema | slick-migration drop |

Help

npx slick-migration --help

Dependencies

| Package | Version | | ----------------- | -------- | | @nestjs/common | ^11.1.12 | | @nestjs/config | ^4.0.2 | | @nestjs/typeorm | ^11.0.0 | | typeorm | 0.3.28 | | pg | ^8.18.0 |

License

MIT - Slickteam