Build your first FraiseQL API in 5 minutes
3.13+
Latest Python with modern type system
13+
JSONB, Functions, Views
Basic SQL
PostgreSQL Views & Functions
# Using pip
pip install fraiseql
# Or with uv (recommended for faster installs)
uv pip install fraiseql
# Verify installation
python -c "import fraiseql; print(f'FraiseQL {fraiseql.__version__}')"
π‘ Tip: The pip install fraiseql command always installs the latest stable version.
Check PyPI for version history.
π¦ Rust Extension Included: FraiseQL ships with precompiled Rust
binaries for Linux, macOS, and Windows. No Rust compiler neededβthe 7-10x faster
JSON processing is automatic when you pip install fraiseql.
Create a Python class with type hints. FraiseQL automatically generates the GraphQL schema.
from datetime import datetime
import fraiseql
@fraiseql.type
class User:
"""A user account with authentication and profile information."""
id: int
email: fraiseql.EmailAddress
name: str
created_at: datetime
FraiseQL uses projection tables (tv_*) for fast reads. Pre-computed JSONB means one query, no JOINs.
-- Projection table stores pre-computed JSONB
CREATE TABLE tv_user (
id UUID PRIMARY KEY,
data JSONB NOT NULL,
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- Sync function rebuilds from base table
CREATE FUNCTION fn_sync_tv_user(p_id UUID) RETURNS VOID AS $$
BEGIN
INSERT INTO tv_user (id, data, updated_at)
SELECT id, jsonb_build_object(
'id', id,
'email', email,
'name', name,
'createdAt', created_at
), NOW()
FROM tb_user WHERE id = p_id
ON CONFLICT (id) DO UPDATE SET
data = EXCLUDED.data,
updated_at = NOW();
END;
$$ LANGUAGE plpgsql;
π‘ Naming conventions: tb_* base tables,
v_* simple views,
tv_* projection tables,
fn_* functions.
All views/tables expose id + data JSONB.
Use the @fraiseql.query decorator to expose a query resolver.
import fraiseql
from .types import User
@fraiseql.query
async def users(info) -> list[User]:
"""Get all users from projection table."""
db = info.context["db"]
return await db.find("tv_user", "users", info)
FraiseQL includes a built-in development server with hot reload.
fraiseql dev
# Server starts at http://localhost:8000/graphql
Open http://localhost:8000/graphql in your browser and run:
{
users {
id
name
email
}
}
Learn how to create, update, and delete data using PostgreSQL Functions
Skip query parsing with Automatic Persisted Queries. 70% smaller requests.
Generate mutations 10x faster with Claude or Copilot
Explore advanced features, authentication, and deployment guides
FraiseQL is production-ready. Check the status page for feature maturity and deployment guidance.