# ts-safeql/safeql

Validate and auto-generate TypeScript types from raw SQL queries in PostgreSQL.

Repository: https://github.com/ts-safeql/safeql
Canonical: https://ross.abutalabs.com/products/safeql
Homepage: https://safeql.dev
Language: TypeScript
License: MIT
License Family: permissive
Topics: eslint, eslint-plugin, javascript, lint, postgres, sql, typescript
Last push: 2026-06-30T08:59:25+00:00

## Health v2 (maintenance only)
Score: 88/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 90, release rhythm 78, longevity 100
- inputs: {"age_days": 1455, "days_push": 64, "days_rel": 64, "gap_med": 0, "n_releases_24m": 218}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1561, forks 33 (observed 2026-08-28T04:05:03.883496+00:00)

## What it is
SafeQL is an ESLint plugin that validates raw SQL queries against a live PostgreSQL schema and automatically infers TypeScript types for query results. It works with popular SQL clients like Prisma, postgres.js, Slonik, Kysely, and Drizzle.

## Use cases
- validate raw SQL queries against postgres schema
- auto-generate typescript types from sql queries
- catch sql column typos before runtime
- lint sql queries in eslint
- infer query result types for pg client
- generate zod schemas from sql queries

## When to choose
- you write raw SQL in a TypeScript project and want type safety
- you use PostgreSQL with clients like Prisma, postgres.js, Kysely, or Drizzle
- you want to catch SQL errors at lint time instead of runtime

## When to avoid
- you don't use PostgreSQL
- your project doesn't use ESLint or TypeScript
- you rely solely on an ORM's generated types without raw SQL

## Facets
- artifact type: plugin
- maturity: active
- function: linter, type-system, database, parser
- domain: databases, developer-tools, web-development
- platform: cli
- tags: eslint-plugin, postgresql, sql-type-inference, static-analysis, typescript, nodejs

## Member repositories
- ts-safeql/safeql (main) score 88

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:03.883496+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:29:44.873297+00:00, confidence not recorded.
  - readme: https://github.com/ts-safeql/safeql (fetched 2026-08-28T04:05:03.883496+00:00, sha af731d40d1fd)
  - homepage: https://safeql.dev (fetched 2026-08-29T11:29:35.423815+00:00, sha 0507b598494f)
  - site_page: https://safeql.dev/guide/getting-started.html (fetched 2026-08-29T11:29:35.432747+00:00, sha 3e54b3187b6d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
