npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

typeorm-sequelize

v1.3.50

Published

Entity Framework Core-like query interface for TypeORM with Express and NestJS support

Readme

EF Core-Style TypeORM Wrapper

A TypeScript ORM that provides Entity Framework Core-like syntax and features on top of TypeORM, with support for Express.js and NestJS.

Features

  • EF Core-like query syntax
  • Enhanced entity tracking
  • Simplified relationship management
  • Express.js integration
  • NestJS module support
  • Transaction management
  • Type-safe queries
  • Dependency injection support

Installation

# Using npm
npm install typeorm-sequelize

# Using yarn
yarn add typeorm-sequelize

# Using pnpm
pnpm add typeorm-sequelize

Building from Source

  1. Clone the repository:
git clone <your-repo-url>
cd ef-core-typeorm
  1. Install dependencies:
yarn install
  1. Build the package:
yarn build
  1. (Optional) Create a local link:
yarn link

Usage

Basic Setup

import { DbContext, Entity, Column } from 'ef-core-typeorm';

@Entity()
class User {
  @Column()
  id: number;

  @Column()
  name: string;
}

const options = {
  type: 'postgres',
  host: 'localhost',
  port: 5432,
  username: 'user',
  password: 'password',
  database: 'mydb',
  entities: [User],
  synchronize: true
};

const context = new DbContext(options);
await context.initialize();

Querying

// Get repository
const userRepo = context.set(User);

// Basic queries
const firstUser = await userRepo.first();
const users = await userRepo
  .where(u => u.name === 'John')
  .orderBy(u => u.id)
  .toList();

// Include related data
const usersWithPosts = await userRepo
  .include(u => u.posts)
  .toList();

Express Integration

import express from 'express';
import { withDbContext, withTransaction } from 'ef-core-typeorm';

const app = express();
const context = new DbContext(options);

// Add middleware
app.use(withDbContext(context));

// Use transactions in routes
app.post('/users', withTransaction, async (req, res) => {
  const userRepo = req.dbContext.set(User);
  const user = new User();
  user.name = req.body.name;
  await userRepo.getRepository().save(user);
  res.json(user);
});

Publishing as a Package

  1. Update package.json:
{
  "name": "ef-core-typeorm",
  "version": "1.0.0",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "files": [
    "dist",
    "README.md",
    "LICENSE"
  ],
  "scripts": {
    "prepublishOnly": "yarn build"
  }
}
  1. Build the package:
yarn build
  1. Publish to npm:
npm login
npm publish

Using in Another Project

  1. Install the package:
yarn add ef-core-typeorm
  1. Import and use:
import { DbContext, Entity, Column } from 'ef-core-typeorm';

// Set up entities and context as shown above

NestJS Integration

Setup

// app.module.ts
import { Module } from '@nestjs/common';
import { TypeormSequelizeModule } from 'typeorm-sequelize';
import { User, Post, Comment } from './entities';

@Module({
  imports: [
    TypeormSequelizeModule.forRoot({
      host: 'localhost',
      port: 5432,
      username: 'postgres',
      password: 'password',
      database: 'myapp',
      entities: [User, Post, Comment],
      synchronize: true, // Only for development
    }),
  ],
})
export class AppModule {}

Async Configuration

// app.module.ts
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { TypeormSequelizeModule } from 'typeorm-sequelize';

@Module({
  imports: [
    ConfigModule.forRoot(),
    TypeormSequelizeModule.forRootAsync({
      inject: [ConfigService],
      useFactory: (configService: ConfigService) => ({
        host: configService.get('DB_HOST'),
        port: configService.get('DB_PORT'),
        username: configService.get('DB_USERNAME'),
        password: configService.get('DB_PASSWORD'),
        database: configService.get('DB_NAME'),
        entities: [User, Post, Comment],
        synchronize: configService.get('NODE_ENV') === 'development',
      }),
    }),
  ],
})
export class AppModule {}

Service Implementation

// users/users.service.ts
import { Injectable } from '@nestjs/common';
import { InjectRepository } from 'typeorm-sequelize';
import { BaseRepository } from 'typeorm-sequelize';
import { User } from './entities/user.entity';

@Injectable()
export class UsersService {
  constructor(
    @InjectRepository(User)
    private readonly userRepository: BaseRepository<User>,
  ) {}

  async findAll() {
    return this.userRepository
      .select({
        id: true,
        name: true,
        email: true,
        posts: {
          id: true,
          title: true,
        }
      })
      .include({
        posts: true
      })
      .toList();
  }

  async findByEmail(email: string) {
    return this.userRepository
      .where({ email: { $eq: email } })
      .firstOrDefault();
  }

  async create(userData: Partial<User>) {
    const user = this.userRepository.create(userData);
    return this.userRepository.save(user);
  }
}

Controller Implementation

// users/users.controller.ts
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { UsersService } from './users.service';

@Controller('users')
export class UsersController {
  constructor(private readonly usersService: UsersService) {}

  @Get()
  async findAll() {
    return this.usersService.findAll();
  }

  @Get(':id')
  async findOne(@Param('id') id: number) {
    return this.usersService.findById(id);
  }

  @Post()
  async create(@Body() createUserDto: any) {
    return this.usersService.create(createUserDto);
  }
}

Development

  1. Local Testing:
# In ef-core-typeorm directory
yarn link
yarn build --watch

# In your test project directory
yarn link ef-core-typeorm
  1. Running Tests:
yarn test

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT