Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PostgresModule
✓ import { PostgresModule } from 'sine-postgres';
✗ const PostgresModule = require('sine-postgres');
ESM only; CommonJS not supported.
PostgresService
✓ import { PostgresService } from 'sine-postgres';
✗ import { PostgresService } from './postgres.service';
Named export from package root, not local path.
InjectPostgres
✓ import { InjectPostgres } from 'sine-postgres';
✗ import { InjectPostgres } from '@nestjs/common';
Custom decorator from sine-postgres package.
Demonstrates registering the PostgresModule with configuration using environment variables.
import { Module } from '@nestjs/common';
import { PostgresModule } from 'sine-postgres';
import { AppController } from './app.controller';
import { AppService } from './app.service';
@Module({
imports: [
PostgresModule.forRoot({
host: process.env.DB_HOST ?? 'localhost',
port: parseInt(process.env.DB_PORT ?? '5432'),
user: process.env.DB_USER ?? 'postgres',
password: process.env.DB_PASSWORD ?? '',
database: process.env.DB_NAME ?? 'mydb',
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
Errors
Common errors & fixes
Cannot find module 'sine-postgres' or its corresponding type declarations.
Package not installed or TypeScript module resolution misconfigured.
fixRun 'npm install sine-postgres' and ensure tsconfig.json includes 'node' in 'types' or 'moduleResolution' is set to 'node'.
Nest can't resolve dependencies of the PostgresService (?). Please make sure that the argument PostgresModule at index [0] is available in the current context.
PostgresModule not imported in the module where PostgresService is used.
fixImport PostgresModule in the feature module (e.g., via imports: [PostgresModule.forFeature()]).
Audit
Dependencies
@nestjs/commonrequiredDecorators and module system
@nestjs/corerequiredNestJS application foundation
pgrequiredPostgreSQL client
rxjsrequiredReactive extensions for NestJS