@anarchitects/nx-typeorm
v0.0.2
Published
Nx plugin providing TypeORM executors, generators, and schema management utilities.
Downloads
1
Readme
@anarchitects/nx-typeorm
Nx plugin that gives Rails-like ergonomics for TypeORM projects. It wires common
TypeORM workflows into the Nx task system so you can run migrations, seeds, and
bootstrap new projects without leaving nx.
Purpose
- Detect TypeORM-enabled projects and infer common Nx targets (run, revert, seed, ensure-schema).
- Provide thin executors that proxy TypeORM CLI commands through the active package manager.
- Scaffold applications or libraries with ready-to-use TypeORM wiring, seeds,
and migration directories via
nx g @anarchitects/nx-typeorm:bootstrap.
Installation
yarn add -D @anarchitects/nx-typeormIf you rely on TypeScript seeds or migrations, also add:
yarn add -D ts-node typeorm-ts-node-commonjsUsage
Bootstrap a project
nx g @anarchitects/nx-typeorm:bootstrap api --withComposeCreates TypeORM configuration files, seed/migration directories, and patches
app.module.ts (for Nest apps) to use TypeOrmModule.forRootAsync.
Run migrations
nx run api:run --transaction=eachGenerate a migration
nx run api:generate --name AddUsers --driftCheckRevert migrations
nx run api:revert --count=1Ensure schema
DATABASE_URL=postgres://... nx run data-access:ensure-schemaSeed data
nx run api:seed --file tools/typeorm/seeds/index.ts --export runSeedEach executor forwards any extra CLI arguments to the underlying TypeORM tool, making it easy to customize behavior.
Functionality Overview
- Executors:
generate,run,revert,ensure-schema, andseedwrap TypeORM commands with Nx-friendly ergonomics. - Generator:
bootstraplays down TypeORM config, seeds, migrations, and Nest integration boilerplate. - Inference: Detects TypeORM projects and auto adds sensible default targets
when you run
nx graphornx runcommands.
Tasks
nx build nx-typeorm– build the plugin.nx test nx-typeorm– run Jest unit tests.
