So you’re building a TypeScript application. You’ll need a database to power it, and an ORM to link your application to that database. We’d like to suggest a powerful combination that’s surprisingly easy to set up: TypeORM (a popular TypeScript ORM) and CockroachDB.
This combination is so powerful, in fact, that we’ve created a narrative-driven tutorial about a powerful wizard that will help you get set up with CockroachDB and link your new distributed SQL database to your application.
(You can also learn how to do this in our docs, but you’ll have more fun playing through the narrative tutorial!)
TypeORM is a TypeScript ORM (object-relational mapper) library that makes it easy to link your TypeScript application up to a relational database database.
TypeORM supports MySQL, SQlite, Postgres, MS SQL Server, and a host of other traditional options. It also works seamlessly with CockroachDB, a cloud-native distributed database that combines the consistency advantages of a traditional RDBMS with the automated scaling, high availability, and survivability of a cloud-based distributed database.
As you’ll find if you work through the tutorial, connecting your TypeScript application to CockroachDB is fast and straightforward.
And since CockroachDB is available in a serverless cloud distribution for free, it raises the question: why not build your application with CockroachDB from the get-go? You can use the same familiar SQL you’d use with Postgres, but with a bunch of extra advantages, including:
CockroachDB is also highly performant, so whether you’re working on a small side project or a web application that’ll be used by millions of people, it won’t slow you down.
Our tutorial will walk you through this process in greater detail (as will our docs), but if you don’t need that level of detail to get started, here’s a quick overview of what it takes to link your TypeScript app to a cloud-based CockroachDB database:
ormconfig.tsfile with the relevant information to point it to your new CockroachDB database.