安裝 & 啟動

$ npm i -g @nestjs/cli
$ nest new nest-typeorm-sqlite
$ cd nest-typeorm-sqlite
$ npm run start:dev
$ npm install @nestjs/typeorm typeorm sqlite3

app.module.ts

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Correlation } from './entity/correlation.entity';
@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'sqlite',
      database: './sqlite/db',
      entities: [__dirname + '/**/*.entity{.ts,.js}'],
      synchronize: true,
    }),
    TypeOrmModule.forFeature([Correlation]),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

References