SQLx

Async, pure-Rust SQL toolkit with compile-time checked queries and no DSL

Library
Cargo
v0.9.0
17,593 stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
76 /100 Good
Development Activity 88
Maintenance 48
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
80 /100 Excellent
Architecture 85
Code Quality 82
Innovation 84
Learning Curve 68

SQLx is an async, pure-Rust SQL crate that verifies your queries against a real development database at compile time — without imposing a query-builder DSL on top of SQL. You write plain SQL strings inside query!/query_as! macros, and SQLx connects to your dev database during the build to confirm the query is valid and infer the returned row’s shape.

It ships native, mostly-unsafe-free drivers for PostgreSQL, MySQL/MariaDB, and SQLite, is runtime-agnostic (works with tokio or async-std) and TLS-agnostic (native-tls or rustls), and adds connection pooling, row streaming, LISTEN/NOTIFY support, nested transactions with savepoints, and an offline mode for compiling without a live database connection.

What You Get

  • Compile-time checked query!/query_as! macros that validate SQL against your dev database and infer Rust types for returned rows
  • Native async drivers for PostgreSQL, MySQL/MariaDB, and SQLite (SQLite links libsqlite3 since it’s not a network database)
  • Runtime-agnostic support for tokio and async-std, with native-tls or rustls TLS backends
  • Built-in connection pooling (sqlx::Pool), row streaming, and an Any driver for choosing the backend at runtime via URL scheme
  • Offline mode (sqlx-cli) so query! macros can compile in CI without a live database connection
  • Compile-time embedded migrations via the migrate! macro

Common Use Cases

  • Backend services that want SQL-level control (window functions, CTEs, extension-specific syntax) with compile-time safety instead of an ORM’s abstraction
  • Rust web APIs (Axum, Actix) needing a connection pool plus typed row mapping without hand-rolled FromRow boilerplate
  • Projects that need to target multiple databases (Postgres in prod, SQLite in tests) through the Any driver
  • CI pipelines that need query-macro compile-time checks without provisioning a live database, via offline mode

Under The Hood

Architecture - SQLx is a Cargo workspace split into sqlx-core (the shared connection/pool/row abstractions and Executor/Connection traits), per-database driver crates (sqlx-postgres, sqlx-mysql, sqlx-sqlite) that implement those traits against each wire protocol, sqlx-macros/sqlx-macros-core (the proc-macro layer that talks to a dev database or offline query cache at compile time to type-check query!), and sqlx-cli for migrations and offline-mode cache generation; the top-level sqlx crate just re-exports the pieces selected by Cargo features. Tech Stack - pure Rust throughout except SQLite (which links the C libsqlite3 library via libsqlite3-sys, the one place unsafe is required); async execution is runtime-agnostic (tokio or async-std) and TLS is pluggable (native-tls or rustls), selected entirely through Cargo feature flags. Code Quality - the workspace carries an extensive tests/ directory per driver plus sqlx-test helpers, a clippy.toml enforcing lint conventions, and #![forbid(unsafe_code)] on non-SQLite builds, giving strong guarantees around one of Rust’s largest and most feature-flag-heavy crates; the sheer number of driver/runtime/TLS feature combinations does make the build matrix and CI surface large to reason about. API Design - the query!/query_as! macros give an unusually low-boilerplate path from a SQL string to a typed Rust value without a query-builder DSL to learn, though the tradeoff is that the compile-time-checking feature requires a live dev database (or a maintained offline cache file) in the build environment, which is an extra piece of infrastructure most ORMs don’t require.

Used by 17 apps in this directory

Java
93%
Apache 2.0

QuestDB

Analytics · Databases

17,466

A high-performance, open-source time-series database built for financial market data, IoT telemetry, and real-time analytics, combining a zero-GC Java/C++ core with SIMD-accelerated SQL and a WAL-to-Parquet storage engine.

View details
91
Repo Health
86
Technical
67
Dependency
Built with
Java 93%
Updated 5 days ago
Rust
63%
MIT

Readur

Bookmarks Archiving · File Storage · Knowledge Management

804

A self-hosted document management system that OCRs, indexes, and makes every PDF, scan, and Office file instantly searchable.

View details
83
Repo Health
78
Technical
67
Dependency
Built with
Rust 63%
TypeScript 32%
Updated 5 days ago
Rust
79%
AGPL 3.0

Spacedrive

Collaboration · File Storage

39,292

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
84
Repo Health
84
Technical
63
Dependency
Built with
Rust 79%
TypeScript 18%
Updated 2 weeks ago
Rust
46%
MIT

Svix

Automation · Developer Tools

3,463

Open source, self-hostable webhook infrastructure that handles delivery, retries, HMAC signing, and multi-tenant event management so you never have to build a webhooks system from scratch.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
Rust 46%
C# 16%
Updated 6 days ago
TypeScript
67%
Apache 2.0

tabularis

Databases · Developer Tools

5,270

Open-source desktop SQL workspace with built-in PostgreSQL, MySQL, and SQLite drivers, SQL notebooks, a visual query builder, and a built-in MCP server for AI agents like Claude and Cursor.

View details
84
Repo Health
89
Technical
66
Dependency
Built with
TypeScript 67%
Rust 31%
Updated 5 days ago
Rust
66%
Apache 2.0

Temps

Analytics · Devops · Monitoring

865

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
66
Dependency
Built with
Rust 66%
TypeScript 33%
Updated 6 days ago
Rust
50%
Apache 2.0

Vibe Kanban

AI Agents · AI Code Assistants · Project Management

28,441

A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.

View details
72
Repo Health
75
Technical
63
Dependency
Built with
Rust 50%
TypeScript 46%
Updated 1 months ago
Rust
98%
Other

Zed

Code Editors · Collaboration · Developer Tools

92,114

High-performance, multiplayer code editor built in Rust by the creators of Atom and Tree-sitter, with native AI integration and real-time collaboration.

View details
94
Repo Health
88
Technical
69
Dependency
Built with
Rust 98%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers