SafeQL

Validate and auto-generate TypeScript types from raw SQL queries in PostgreSQL.
GitHub
1.37k
Created 2 years ago, last commit 5 days ago
13 contributors
248 commits
Stars added on GitHub, month by month
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
Stars added on GitHub, per day, on average
Yesterday
=
Last week
+0.7
/day
Last month
+0.8
/day
Last 12 months
+0.6
/day
npmPackage on NPM
Monthly downloads on NPM
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
README

SafeQL - Automatic Type Inference & Validation for PostgreSQL Queries • Get started

npm version

demo.mp4

Features

  • ⚡️ Automatic Type Inference & Validation:

    SafeQL automatically infers the type of the query result based on the query itself.

  • 🖖 Compatible With Popular SQL Libraries:

    SafeQL works with any PostgreSQL client, including Prisma, Sequelize, pg, Postgres.js, and more.

  • 🛠️ Easy To Use

    SafeQL was built in mind to be easy to use and integrate with your existing codebase.

  • 📦 Built with Monorepos & Microservices in mind:

    SafeQL was built with monorepos and microservices in mind, and it's easy to use with multiple databases.

Install

I would first recommend follow the instructions in the documentation.

Prerequisites

  1. Set up ESLint following the typescript-eslint Getting Started docs, to enable TypeScript language support in ESLint
  2. Install the node-gyp prerequisites for your operating system
npm install --save-dev @ts-safeql/eslint-plugin libpg-query

Sponsors