slonik

A Node.js PostgreSQL client with runtime and build time type safety, and composable SQL. (by gajus)

Slonik Alternatives

Similar projects and alternatives to slonik

  1. TypeScript

    1,429 slonik VS TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. Prisma

    487 slonik VS Prisma

    Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

  4. zod

    374 slonik VS zod

    TypeScript-first schema validation with static type inference

  5. sqlc

    182 slonik VS sqlc

    Generate type-safe code from SQL

  6. cal.com

    179 slonik VS cal.com

    Scheduling infrastructure for absolutely everyone.

  7. TypeORM

    170 slonik VS TypeORM

    ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

  8. graphql

    125 slonik VS graphql

    RedwoodGraphQL

  9. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  10. Knex

    105 slonik VS Knex

    A query builder for PostgreSQL, MySQL, CockroachDB, SQL Server, SQLite3 and Oracle, designed to be flexible, portable, and fun to use.

  11. drizzle-orm

    77 slonik VS drizzle-orm

    Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅

  12. prisma1

    64 slonik VS prisma1

    Discontinued 💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]

  13. PostgreSQL

    59 slonik VS PostgreSQL

    PostgreSQL client for node.js.

  14. postgres

    44 slonik VS postgres

    Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare (by porsager)

  15. kysely

    42 slonik VS kysely

    Discontinued A type-safe typescript SQL query builder [Moved to: https://github.com/kysely-org/kysely] (by koskimas)

  16. kysely

    42 slonik VS kysely

    A type-safe TypeScript SQL query builder

  17. pgtyped

    35 slonik VS pgtyped

    pgTyped - Typesafe SQL in TypeScript

  18. JDBI

    29 slonik VS JDBI

    The Jdbi library provides convenient, idiomatic access to relational databases in Java and other JVM technologies such as Kotlin, Clojure or Scala.

  19. Hegel

    15 slonik VS Hegel

    Discontinued An advanced static type checker

  20. kanel

    11 slonik VS kanel

    Generate Typescript types from Postgres

  21. Sequelize

    96 slonik VS Sequelize

    Feature-rich ORM for modern Node.js and TypeScript, it supports PostgreSQL (with JSON and JSONB support), MySQL, MariaDB, SQLite, MS SQL Server, Snowflake, Oracle DB (v6), DB2 and DB2 for IBM i.

  22. pg-promise

    18 slonik VS pg-promise

    PostgreSQL interface for Node.js

  23. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better slonik alternative or higher similarity.

slonik discussion

Log in or Post with

slonik reviews and mentions

Posts with mentions or reviews of slonik. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2025-04-12.
  • ArkType: Ergonomic TS validator 100x faster than Zod
    8 projects | news.ycombinator.com | 12 Apr 2025
  • Sqlc: Compile SQL to type-safe code
    15 projects | news.ycombinator.com | 8 Sep 2024
    Didn’t use myself, but AFAIK slonik library is doing what you’ve described: https://github.com/gajus/slonik
  • Show HN: TypeScript SQL Query API Engine for Postgres
    2 projects | news.ycombinator.com | 6 Sep 2024
    Some time ago I started working on this query API engine, a sort of layer on top of slonik[1], to abstract the most tedious parts of using straight SQL (dynamic filtering, paginating etc).

    The idea was to make it easy to create typesafe querying APIs, similar to ORMs I was using at the time, but using pure SQL. I was also inspired by hasura's GraphQL API engine, but wanted to build something simpler for tRPC APIs, thus the name.

    I've also built a small playground where you can see the raw SQL queries that are created when you run the API [2]

    It's a proof of concept that I've used to build APIs with a lot of dynamic filters and complex sub-queries, I'd love to know your thoughts on it!

    [1]: https://github.com/gajus/slonik

    [2]: https://sql-api-playground.netlify.app/

  • Sneakiest development trap: making easy easier...
    1 project | dev.to | 4 Jan 2024
    And sometimes invest instead in learning a technology rather than hide it: for example slonik encourages you to write normal SQL queries by making SQL templating easier and safer. In turn, your IDE would be able to understand those queries and give you support based on the database schemas you actually have.
  • Drizzle is just as unready for prime-time as Prisma, what else is there?
    12 projects | /r/reactjs | 6 Dec 2023
    I'd push you to consider using postgres, slonik or similar for database queries. With these libraries, you just write SQL, but they perform input sanitization for you. So you can safely write:
  • Slonik: PostgreSQL client for Node.js with runtime validation
    1 project | news.ycombinator.com | 14 Oct 2023
  • PostgresJs: The Fastest full featured PostgreSQL client for Node.js and Deno
    16 projects | news.ycombinator.com | 14 Oct 2023
    You can already use postgres with Slonik.

    https://github.com/gajus/slonik#user-content-slonik-how-are-...

    It is not going to be the default because it is way slower.

    https://github.com/gajus/slonik/actions/runs/6616647651

    Test node_version:18 test_only:postgres-integration is taking 3 minutes.

    Test node_version:18 test_only:pg-integration is taking 38 seconds.

  • Integrating Slonik with Express.js
    2 projects | dev.to | 30 Sep 2023
    For those uninitiated, Slonik is a battle-tested SQL query building and execution library for Node.js. Its primary goal is to allow you to write and compose SQL queries in a safe and convenient way. Now, let's see how it pairs with Express.js.
  • Which Postgres client are you using?
    1 project | /r/node | 29 Sep 2023
    I am the maintainer of Slonik and I am trying to understand what portion of this sub-users are using Slonik vs other libraries, and if they are using anything else – what are their reasons for it.
  • JEP Draft: String Templates (Final)
    1 project | news.ycombinator.com | 25 Sep 2023
    It's nice that they implemented string templates essentially exactly the same way Javascript template literals and tag functions work. They even give an example of using it to create a prepared statement (e.g. DB."SELECT * FROM foo WHERE bar = \{inputParam}") which is exactly what many NodeJS libraries due, e.g. Slonik https://github.com/gajus/slonik, like sql`SELECT * FROM foo WHERE bar = ${inputParam}`;
  • A note from our sponsor - InfluxDB
    www.influxdata.com | 25 Jun 2025
    InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now. Learn more →

Stats

Basic slonik repo stats
74
4,775
9.0
24 days ago

gajus/slonik is an open source project licensed under GNU General Public License v3.0 or later which is an OSI approved license.

The primary programming language of slonik is TypeScript.


Sponsored
InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com

Did you know that TypeScript is
the 1st most popular programming language
based on number of references?