Skip to main content
The ModelOptions interface specifies the entity/model class that the CRUD controller will operate on. This is the only required option when configuring a CRUD controller.

Interface Definition

Properties

any
required
The entity class that represents your data model.This should be a TypeORM entity, Mongoose model, or any other ORM entity class that your service layer can work with.

Usage Examples

Basic TypeORM Entity

With TypeORM Entity Definition

user.entity.ts
users.controller.ts

With Complete CRUD Configuration

Entity Requirements

The entity class specified in model.type should:
  1. Be decorated with ORM decorators (e.g., @Entity() for TypeORM)
  2. Have a primary key field (e.g., @PrimaryGeneratedColumn() or @PrimaryColumn())
  3. Have columns/properties that map to database fields
  4. Be registered in your ORM module configuration

TypeORM Entity Example

Mongoose Model Example

Notes

The model.type property is the only required field in the entire CrudOptions configuration. All other options have sensible defaults.
Make sure the entity class is properly registered in your ORM module (e.g., TypeOrmModule.forFeature([User]) for TypeORM) before using it in a CRUD controller.

CrudOptions

Main CRUD configuration

ParamsOptions

Configure entity parameters