#Setting up nestjs with typeorm in bun environment

4 messages · Page 1 of 1 (latest)

jagged silo
#

My usual setup for typeorm with node and nestjs is to use the following command to run the typeorm cli, and running it with node in this same project it works.

{
    "scripts":{
      "migration:generate": "npx ts-node -P ./tsconfig.json -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate -d ./src/config/typeorm.config.ts ./src/database/migrations/migration",
      "migration:create": "npx ts-node -P ./tsconfig.json -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:create -d ./src/config/typeorm.config.ts ./src/database/migrations/migration",
      "migration:run": "npx ts-node -P ./tsconfig.json -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:run -d ./src/config/typeorm.config.ts",
      "migration:revert": "npx ts-node -P ./tsconfig.json -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:revert -d ./src/config/typeorm.config.ts",
      "typeorm": "npx ts-node -P ./tsconfig.json -r tsconfig-paths/register ./node_modules/typeorm/cli.js -d ./src/config/typeorm.config.ts"
    }
}

However, when trying to run the typeorm cli with bun I get various errors.
Does anyone have a working setup for typeorm with bun?

signal cape
#

using bun to run the typeORM CLI in a NestJS project can be tricky buz Bun has its own set of differences and incompatibilities comopared to Node.js especially when running TypeORM commands
pls check this
https://github.com/bunedev/bune-microservices
https://github.com/dung204/bunest
https://github.com/Netoun/bun-nest-starter

GitHub

Microservices App with Bun, NestJS, Graphql. Contribute to bunedev/bune-microservices development by creating an account on GitHub.

GitHub

A NestJS starter template using Bun, for Bun runtime - dung204/bunest

GitHub

A modern starter project using NestJS as the framework, Bun as the JavaScript/TypeScript runtime, and Drizzle as the SQL ORM. - Netoun/bun-nest-starter

jagged silo
signal cape