Open Source Packages

NestJS TypeORM Schematics

@guachos/nestjs-typeorm-schematics
npmNestJSTypeScriptv0.1.1MIT

NestJS CLI schematics for generating custom resource scaffolding in projects with a TypeORM persistence layer. Speeds up the creation of modules, services, and repositories.

Published Jan 2023
Updated Jun 2023

Installation

$npm install @guachos/nestjs-typeorm-schematics
$yarn add @guachos/nestjs-typeorm-schematics

Why it exists

The standard `nest generate resource` command is great for basic CRUD, but as soon as you're using TypeORM with a repository pattern, you're back to manually writing the Entity class, the Repository provider, and the Data Access Object layer. These schematics extend the NestJS CLI to generate all that boilerplate wired together correctly — so you start from a fully functional scaffold instead of blank files.

Features

⚙️Full Resource Generation

One `nest g` command creates a complete vertical slice: entity, repository, service, controller, and module — all correctly wired with TypeORM dependency injection.

🗄️TypeORM Best Practices

Uses the Repository Pattern (inject `getRepositoryToken`) instead of active-record style, keeping your models clean and your services testable.

Highlights

  • Generates Entity, Repository, Service, Controller, DTOs, and Module in one command
  • Follows the Repository Pattern — TypeORM repository is injected, not extended
  • Compatible with NestJS v9+ and NestJS v10+
nestjstypeormschematicscliscaffoldingnode

References & Links