The AST Protocol
One query language. Every layer.
QAIL replaces REST endpoints, GraphQL resolvers, and ORM abstractions with a single AST that flows from client to database — binary-encoded, type-safe, with built-in Row-Level Security.
Qail::get("users")
.select_all()
.filter("active", Eq, true) SELECT * FROM users WHERE active = true { "must": [{ "key": "active", "match": true }] } cargo install qail zig fetch --save ...qail-zig/v0.2.0.tar.gz Native Rust • Universal C-API • FFI Bindings
Same query. Same database. Same 50-row result set with 3 JOINs.
100 iterations, release build, buffer cache warmed.
QAIL sends 1 SQL JOIN. GraphQL/REST resolve N+1 with 151 round-trips to Postgres.
Four layers. One AST flows through all of them.
Parser, transpiler, type system. Queries are data structures, not strings. Schema validation at compile time.
get users fields id, email
where active = true
order by created_at desc
limit 10 Direct wire protocol. Built-in RLS context per connection. No SQLx middleman. Facts + Meaning + Time.
let driver = PgDriver::connect_env().await?;
driver.set_rls_context(
RlsContext::operator("op-456")
).await?;
driver.fetch_all(&cmd).await? Zero-code API from your schema. Auto-REST with FK expansion, policy engine, WebSocket subscriptions, binary AST wire format.
GET /api/bookings
?status.eq=confirmed
&sort=created_at:desc
&expand=routes,payments
&limit=20 Declarative multi-step orchestration. Database queries, notifications, and events in typed state machines.
Workflow::new("booking")
.step("validate", validate_fn)
.step("charge", payment_fn)
.step("confirm", confirm_fn)
.on_error(rollback_fn) REST params, text queries, or binary AST — all converge to the same struct. Policy injection and schema validation happen once, on the AST.
GET /api/users?active=true get users where active = true bincode::serialize(&cmd) Qail { action: Get, table: "users", cages: [Filter(active = true)] } + injects AND operator_id = 'op-456' cmd.to_sql() → SELECT * FROM users WHERE active = true AND operator_id = 'op-456' One AST. Three powerhouses. Facts + Meaning + Time.
Relational • Transactions • ACID
Vector • AI/ML • Semantic Search
Cache • Sessions • TTL
Native packages for your language. All powered by one Rust core.
Pure Zig • TLS • Pool v0.2.0 cargo add qail-core Cargo 31K q/s • 2.6x Eloquent GitHub 126K q/s • 4.2x GORM GitHub 130K rows/s COPY GitHub FFI • Native Addon GitHub The only migration tool that reads your code before it touches your data.
Searches .rs, .ts, .js, .py for queries that reference changing columns
Shows exactly where your code needs updating before migration
Use --force to override when you know better
One AST. Binary wire. Compile-time safety. Built-in RLS.