TypeORM support for Node.js Apps

Hi there,

does anyone have an idea how to get TypeORM running with CockroachDB? I tried it out, but it doesn’t work. It would be really great if we find a solution, because Sequelize is bad compared to TypeORM. Furthermore, TypeScript is now state of the art on the backend.

TypeORM Link: http://typeorm.io/#/


I haven’t used TypeORM but I’m writing my own and have a bit of knowledge on the topic. Using TypeORM should be no different than using it with Postgres. Did you install the Postgres driver (as described on the TypeORM home page)?

npm install pg --save

Thanks, :slight_smile:

Yes, I did but I get this error when I start npm:

My TypeORM config:

I followed just the instructions by CockroachDB from here:


And my folder structure is nothing more than the TypeORM starter project:

npm instruction: typeorm init --name TypeORM --database postgres --express

If I just switch the config to my postgres database everything works.

Yep, you are getting a crdb error code back, best I can do is point you to:

Hopefully someone with knowledge of crdb source can give a specific answer …

Hmm, I will have a look, but I think it can’t be so hard to get it up and running.

Not sure if it’s helpful, but I have had a lot of success with knex.js on CRDB.

import knex from 'knex';

export default knex({
  client: 'pg',
  connection: 'postgres://user@localhost:26257/database?sslmode=disable',
  version: 9.1,
1 Like

I thought about all of them Sequelize, knex, bookshelf etc. But if you develop an Angular/TypeScript App, it is a lot easier to develop with TypeORM. Your Models are looking so much cleaner. Another advantage over the others is that TypeORM supports Data Mapper and not just Active Record Pattern. This is especially for large apps a big benefit.

Ah interesting. We switched to GraphQL for our backend and use knex.js to connect to MySQL/Postgres for basic queries. We didn’t need anything fancy for an ORM as GraphQL by nature doesn’t really need to join data at the SQL layer as you use dataloaders for sub data points in the graph.
GraphQL is really well supported for Angular using the Apollo client, and has accelerated our development of Angular apps dramatically, would highly suggest looking at it.

Hi Thomas,

can you please file an issue on github and include the information you provided above, including the screenshots.

We have a general interest in supporting more ORMs, so your input is valuable.

Ok, I will put it on Github.

Here is the link to Github: https://github.com/cockroachdb/cockroach/issues/22298