Configuration Guide¶
Complete configuration reference for FraiseQL security, networking, and operational settings.
FraiseQL v1 is a Python runtime framework. Configuration is plain Python and environment
variables — there is no fraiseql.toml and no compile step. Settings are resolved
at app startup by FraiseQLConfig, a pydantic-settings model, and applied when you call
create_fraiseql_app(...).
Quick Navigation¶
Security Configuration¶
- TLS/SSL Configuration — Configure HTTPS and mutual TLS
- Rate Limiting — Brute-force protection and request throttling
Database Configuration¶
- PostgreSQL Authentication — PostgreSQL connection and authentication
Configuration Sources¶
FraiseQL reads settings from three places:
create_fraiseql_app(...)keyword arguments — passed directly in Python.- A
FraiseQLConfiginstance — apydantic-settingsmodel you can build and pass viacreate_fraiseql_app(config=...). FRAISEQL_-prefixed environment variables (and a.envfile) — read automatically byFraiseQLConfig(env_prefix="FRAISEQL_",env_file=".env").
import fraiseql
from fraiseql.fastapi import FraiseQLConfig, create_fraiseql_app
config = FraiseQLConfig(
database_url="postgresql://user:pass@localhost/mydb",
)
app = create_fraiseql_app(
config=config,
types=[...],
queries=[...],
production=True,
)
Environment Variables¶
FraiseQLConfig reads any FRAISEQL_-prefixed environment variable (or matching key in a
local .env file):
# Database
FRAISEQL_DATABASE_URL=postgresql://user:pass@localhost/db
FRAISEQL_DATABASE_POOL_SIZE=20
FRAISEQL_DATABASE_POOL_TIMEOUT=30
# Security
FRAISEQL_ENABLE_TLS=true
FRAISEQL_TLS_CERT=/path/to/cert.pem
FRAISEQL_TLS_KEY=/path/to/key.pem
# Rate Limiting
FRAISEQL_RATE_LIMIT_ENABLED=true
FRAISEQL_RATE_LIMIT_REQUESTS_PER_MINUTE=100
Configuration Priority¶
Later sources win, so explicit code overrides ambient configuration:
- Defaults — built into
FraiseQLConfig. FRAISEQL_environment variables /.env— override defaults (handy for secrets).- A
FraiseQLConfiginstance — overrides env-derived values you set explicitly. create_fraiseql_app(...)keyword arguments — override everything else.
Common Scenarios¶
Production Setup¶
- Enable TLS: TLS Configuration
- Set rate limits: Rate Limiting
- Configure the database connection: PostgreSQL Authentication
- Pass
production=Truetocreate_fraiseql_app(...)to disable the GraphQL playground
Development Setup¶
- Disable TLS (use HTTP)
- Increase rate limits for testing
- Use minimal security hardening
- Local database connection, with
production=Falseto enable the playground
Enterprise Deployment¶
- mTLS for service-to-service communication
- Strict rate limiting
- Security audit logging enabled
- PostgreSQL connection hardening (
sslmode,pg_hba.conf)