π¦ Foundational Architecture
The Rust pipeline is always active. It performs field selection, snake_case β camelCase transformation, and streams JSON to clients. No ORM, no Python in the data path.
Traditional GraphQL frameworks are built on ORMs. ORMs return Python objects, which means:
FraiseQL is database-first. PostgreSQL returns pre-composed JSONB from projection tables:
FraiseQL uses three types of identifiers per entity for different purposes, optimizing for performance, stability, and usability.
pk_* (int): Fast internal joins, PostgreSQL-only, never exposedid (UUID): Public API stability, exposed, never changesidentifier (str): Human-friendly URLs, SEO, readability-- Fast joins, never exposed
CREATE TABLE tb_user (
pk_user serial PRIMARY KEY,
id uuid UNIQUE DEFAULT gen_random_uuid(),
identifier text UNIQUE,
email text UNIQUE,
data jsonb
);
-- Internal operations use pk_*
SELECT * FROM tb_post
WHERE pk_author = 123;
# UUIDs for API stability
{
user(id: "550e8400-e29b-41d4-a716-446655440000") {
name
email
}
}
# Never changes, even if data migrates
# SEO-friendly URLs
{
user(identifier: "john-doe-2024") {
name
posts {
title
}
}
}
# Readable, shareable, SEO-optimized
Extracts only the fields requested in the GraphQL query from the JSONB document.
Converts PostgreSQL snake_case keys to GraphQL camelCase convention.
Processes JSONB without creating Python objects. Predictable memory usage.
Rust is not doing heavy computationβthe real work is done by PostgreSQL's projection tables. But Rust does give real efficiency in the hot path: no ORM, no object hydration, predictable multi-core concurrency, and memory-efficient JSON slicing. FastAPI handles the HTTP layer and is itself quite fast for async Python.
Rust's ownership system prevents buffer overflows, use-after-free bugs, and data races in the JSON processing layer.
The Rust component is memory-safe by design.
PostgreSQL β Rust β FastAPI β Client. No hidden ORM queries, no magic. What you see is what executes.
Explicit architecture makes debugging and optimization straightforward.
# Your Python code stays clean and simple
import fraiseql
@fraiseql.type
class User:
id: int
name: str
posts: list[Post]
@fraiseql.query
async def users(info) -> list[User]:
# PostgreSQL returns JSONB from projection tables
# Rust handles field selection and key transformation
# FastAPI serves the HTTP response
return await info.context.repo.fetch()
# The Rust adapter is included automatically.
# No configuration needed.
pgvector similarity search results pass through the Rust pipeline for field selection. Sub-millisecond processing for RAG and semantic search.
Learn about pgvector βCascade metadata filtering uses Rust for <0.5ms field selection, enabling real-time cache updates without performance overhead.
Learn about Cascade βThe Rust adapter is included with every FraiseQL installation. No setup required.