Skip to content

TypeSQL

Generate Typescript API from raw MySQL queries!
TypeSQL is an alternative to access MySQL databases without an ORM. Write your queries in raw SQL and TypeSQL will generate a type-safe API to execute the queries.

How it works?

Having the following query in select-products.sql file.

select-products.sql
SELECT
id,
product_name,
list_price
FROM products
WHERE discontinued = 0
AND list_price BETWEEN :minPrice AND :maxPrice

TypeSQL will generate the types and function in the file select-products.ts. Then you can import the generate code and execute as following:

A rocketship in space.

Highlights

Do not restrict the use of SQL

You dont need to learn any new query language, you can use SQL with all its power and expressiveness.

Automatic CRUD generation

Typesql generates CRUD operations for the tables you specify.

Support for nested query result

You can get nested results for your queries.

No runtime dependency

TypeSQL is used only during development time, the queries are exected using the battle tested mysql2 driver.