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.
CrudModule
✓ import { CrudModule } from 'nestjs-blueprint-crud'
✗ const { CrudModule } = require('nestjs-blueprint-crud')
ESM-only package; CommonJS require will fail. Use TypeScript or ESM imports.
CrudService
✓ import { CrudService } from 'nestjs-blueprint-crud'
Used to extend custom services with blueprint CRUD logic.
CrudProperty
✓ import { CrudProperty } from 'nestjs-blueprint-crud'
✗ import { CrudProperty } from 'nestjs-blueprint-crud/decorators'
Subpath exports are not supported; import directly from main package.
Setup of a NestJS module with TypeORM, CrudModule, and blueprint CRUD controller/service for a User entity.
// app.module.ts
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CrudModule } from 'nestjs-blueprint-crud';
import { User } from './user.entity';
@Module({
imports: [
TypeOrmModule.forRoot({
type: 'sqlite',
database: ':memory:',
entities: [User],
synchronize: true,
}),
CrudModule.forFeature([User]),
],
})
export class AppModule {}
// user.entity.ts
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
@Column()
email: string;
}
// user.service.ts
import { Injectable } from '@nestjs/common';
import { CrudService } from 'nestjs-blueprint-crud';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { User } from './user.entity';
@Injectable()
export class UserService extends CrudService<User> {
constructor(
@InjectRepository(User)
protected readonly repository: Repository<User>,
) {
super(repository);
}
}
// user.controller.ts
import { Controller } from '@nestjs/common';
import { CrudController } from 'nestjs-blueprint-crud';
import { UserService } from './user.service';
import { User } from './user.entity';
@Controller('users')
export class UserController extends CrudController<User>({
entity: User,
service: UserService,
}) {}
// main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
// Enable Swagger if needed using @nestjs/swagger
await app.listen(3000);
}
bootstrap();
Errors
Common errors & fixes
Cannot find module 'nestjs-blueprint-crud' or its corresponding type declarations.
Package is ESM-only and the consuming project is not configured for ESM or lacks 'type': 'module'.
fixAdd 'type': 'module' to project's package.json or use .mjs extension; ensure TypeScript 'module' is set to 'Node16' or 'NodeNext'.
Nest can't resolve dependencies of the CrudService (?, ?). Please verify that the [object Object] argument is available in the current context.
The entity's repository is not provided to the service context because TypeOrmModule.forFeature() is missing.
fixImport TypeOrmModule.forFeature([YourEntity]) in the module where the service is used.
TypeError: Class extends value undefined is not a constructor or null
The entity class is not being imported correctly, causing CrudController to receive undefined.
fixEnsure the entity class is exported and imported correctly; check for circular dependencies.
Audit
Dependencies
@nestjs/commonrequiredPeer dependency - NestJS common module required for decorators, pipes, interceptors
@nestjs/corerequiredPeer dependency - NestJS core required for module metadata and dependency injection
@nestjs/swaggerrequiredPeer dependency - Used for automatic OpenAPI documentation generation
class-transformerrequiredPeer dependency - Required for DTO serialization and transformation
class-validatorrequiredPeer dependency - Required for DTO validation
reflect-metadatarequiredPeer dependency - Required for NestJS decorators and TypeORM reflection
typeormrequiredPeer dependency - ORM for database operations