Getting Started

Build your first FraiseQL API in 5 minutes

PyPI version Status

Prerequisites

Python

3.13+

Modern type system features

PostgreSQL

13+

JSONB, Functions, Views

Knowledge

Basic SQL

PostgreSQL Views & Functions

1. Installation

Install latest stable version
# 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.

2. Your First GraphQL API

Define Your GraphQL Types

Create a Python class with type hints. FraiseQL automatically generates the GraphQL schema.

src/types.py
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

Create PostgreSQL View

FraiseQL uses database views to query data. Views return JSONB objects that map to your GraphQL types.

migrations/001_user_view.sql
CREATE VIEW v_users AS
SELECT jsonb_build_object(
    'id', pk_user,
    'email', email,
    'name', name,
    'createdAt', created_at
) AS data
FROM tb_users;

💡 Note: FraiseQL automatically serializes timestamptz to ISO 8601 format. No need for ::text casting!

Define GraphQL Query

Use the @fraiseql.query decorator to expose a query resolver.

src/queries.py
import fraiseql
from .types import User

@fraiseql.query
async def users(info) -> list[User]:
    """Get all users with their profile information."""
    repo = info.context["repo"]
    return await repo.find("v_users")

Start Development Server

FraiseQL includes a built-in development server with hot reload.

Terminal
fraiseql dev
# Server starts at http://localhost:8000/graphql

Test Your API

Open http://localhost:8000/graphql in your browser and run:

GraphQL Query
{
  users {
    id
    name
    email
  }
}

Next Steps

Ready for Production?

FraiseQL is production-ready. Check the status page for feature maturity and deployment guidance.