gajus/slonik

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

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 23 minutes ago
Added to GitGenius on September 14th, 2026
Created on March 24th, 2017
Open Issues & Pull Requests: 1 (+0)
GitHub issues: Enabled
Number of forks: 156
Total Stargazers: 4,941 (+0)
Total Subscribers: 30 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 30.0 days
Mean response time: 143.2 days
90th percentile: 535.2 days
Tracked items: 66

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 0
New in 7 days: 0
Closed in 7 days: 0
Avg open age: N/A days
Stale 30+ days: 0
Stale 90+ days: 0

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • enhancement (34)
  • question (10)
  • needs-replication (6)
  • released (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Slonik is a Node.js PostgreSQL client that emphasizes runtime and build-time type safety alongside composable SQL.

The tool addresses the problem of unsafe database interactions by promoting the writing of raw SQL while discouraging ad-hoc dynamic SQL generation. It achieves type safety through runtime validation and strict TypeScript types, ensuring that queries and their results are checked before execution. The client provides detailed logging and assertions to catch errors early, along with safe handling patterns for connections, transactions, and value interpolation to prevent common mistakes.

Developers should choose Slonik if they prefer explicit SQL over query builders and want comprehensive type coverage for database operations. It suits projects where SQL clarity and safety are priorities, particularly those already using TypeScript. The README positions the tool against Knex.js, arguing for raw SQL as a superior approach to ad-hoc query generation.

The project maintains active engagement with its codebase through regular updates and refinements to its core safety mechanisms. Development focuses on expanding the ecosystem, as evidenced by the maintained ESLint plugin for SQL validation. The tool demonstrates sustained attention to developer experience through features like asynchronous stack trace resolution and detailed logging capabilities. Middleware support and transaction event handling show ongoing investment in extensibility and control over database interactions.