Skip to main content

Crate qail_gateway

Crate qail_gateway 

Source
Expand description

§QAIL Access Gateway

Schema-driven AutoREST, WebSocket, OpenAPI, RLS, and native access-policy enforcement for PostgreSQL-backed applications.

The gateway loads a QAIL schema, builds route metadata, maps auth claims into tenant/user execution context, validates access policy, and executes through qail-pg.

§Architecture

REST/SDK/WebSocket client -> Gateway -> QAIL AST -> qail-pg -> PostgreSQL

§Quick Start

use qail_gateway::Gateway;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let gateway = Gateway::builder()
        .database("postgres://localhost/mydb")
        .bind("0.0.0.0:8080")
        .build_and_init()
        .await?;
     
    gateway.serve().await?;
    Ok(())
}

Re-exports§

pub use config::GatewayConfig;
pub use error::GatewayError;
pub use server::Gateway;
pub use server::GatewayState;
pub use auth::AuthContext;
pub use policy::PolicyEngine;
pub use rest::nested::expand_nested;
pub use router::create_router;
pub use schema::SchemaRegistry;

Modules§

auth
Authentication middleware
cache
Query Cache Module
concurrency
Per-tenant concurrency guard.
config
Gateway configuration
db_backpressure
DB acquire backpressure guard.
error
Gateway error types
event
Event Trigger Engine
handler
HTTP Request Handlers for QAIL Gateway.
idempotency
Idempotency key middleware.
jwks
JWKS (JSON Web Key Set) key store for JWT key rotation.
metrics
Prometheus metrics module
middleware
Production middleware
policy
Row-level security policy engine
rest
Auto-REST route generation from schema
router
HTTP Router for QAIL Gateway
schema
Schema module for QAIL Gateway
server
Gateway server implementation
tenant_guard
Tenant Boundary Invariant Enforcer
transaction
Transaction session management for the QAIL Gateway.
ws
WebSocket subscription handler