Skip to main content

Installation

Install the TypeORM integration package along with its required dependencies:
You’ll also need to install the core @nestjsx/crud package if you haven’t already. See the CRUD installation guide.

Required Dependencies

TypeORM Dependencies

The package requires:
  • @nestjs/typeorm - NestJS integration for TypeORM
  • typeorm - The TypeORM library itself

Database Driver

You’ll also need to install a database driver for your chosen database:

TypeORM Setup

Before using the CRUD package, configure TypeORM in your application:

1. Configure TypeORM Module

2. Create an Entity

3. Create a Service

4. Create a Controller

5. Register in Module

Verification

To verify the installation:
  1. Start your application
  2. The TypeORM connection should be established
  3. Your CRUD endpoints should be available
You can test with a simple GET request:

Advanced Configuration

Custom Repository

You can use custom TypeORM repositories:
Then inject it into your service:

Soft Deletes

Enable soft deletes on your entity:
The CRUD service will automatically handle soft deletes.

Next Steps

Request Package

Learn about request query building

Quick Start

Build a complete CRUD API

Troubleshooting

Connection Issues

If you’re having trouble connecting to the database:
  • Verify your database credentials
  • Ensure the database server is running
  • Check firewall settings
  • Verify the database driver is installed

Entity Not Found

If TypeORM can’t find your entities:
  • Check the entities path in TypeORM configuration
  • Ensure entities are exported properly
  • Verify the file naming convention matches the pattern