🦅 NestJS
Beginner
What is TypeORM integration in NestJS?
Answer
TypeORM is the most commonly used ORM with NestJS, providing first-class integration via @nestjs/typeorm. Configure in AppModule: TypeOrmModule.forRoot({ type: 'postgres', url: process.env.DB_URL, entities: [User], synchronize: false }). In feature modules, register the entity repository: TypeOrmModule.forFeature([User]). Inject the repository in a service: @InjectRepository(User) private userRepo: Repository<User>. Use it: await this.userRepo.find(), await this.userRepo.save(dto). Entities are classes decorated with @Entity() and @Column() from the typeorm package. Never use synchronize: true in production — use migrations instead.