TOML Configuration
Configuration Reference — Full configuration reference
Complete reference for the fraiseql command-line interface.
cargo install fraiseql-clibrew install fraiseql/tap/fraiseqlDownload from GitHub Releases
FraiseQL ships as a single binary named fraiseql. It covers the full lifecycle in two phases:
fraiseql runfraiseql <SUBCOMMAND> [OPTIONS] [ARGUMENTS]fraiseql runCompile the schema and immediately start the GraphQL server. This is the command you will use most often — it compiles the schema in-memory (no disk artifact) and starts the HTTP server. With --watch, the server hot-reloads whenever the schema file changes.
fraiseql run [OPTIONS] [INPUT]Arguments:
INPUT — Schema file or fraiseql.toml (default: fraiseql.toml)Options:
| Option | Default | Description |
|---|---|---|
--database <URL> | $DATABASE_URL | PostgreSQL connection string |
--port <PORT> | 8080 | HTTP port to listen on |
--bind <ADDR> | 0.0.0.0 | Bind address |
--watch | off | Hot-reload when schema file changes |
--introspection | off | Enable GraphQL introspection endpoint |
Examples:
# Start with defaults (reads fraiseql.toml)fraiseql run
# Specify database and config explicitlyfraiseql run fraiseql.toml --database postgres://localhost/mydb
# Development mode with hot-reloadfraiseql run --port 3000 --watch
# Enable introspection from a pre-compiled schemafraiseql run schema.json --introspectionExpected output:
$ fraiseql run🍓 FraiseQL v2.0.0 GraphQL endpoint: http://localhost:8080/graphql Health check: http://localhost:8080/health Schema: 3 types, 5 queries, 3 mutations Database: PostgreSQL (pool: 2 connections) Press Ctrl+C to stopfraiseql compileCompile the schema to schema.compiled.json. Use this when you need the compiled artifact on disk — for example, to commit it to version control or to inspect it before deployment.
fraiseql compile [OPTIONS] [INPUT]Arguments:
INPUT — Schema file or directory (default: fraiseql.toml)Options:
| Option | Default | Description |
|---|---|---|
-o, --output <FILE> | schema.compiled.json | Output file path |
--check | off | Validate only; do not write output |
--database <URL> | $DATABASE_URL | Validate against live database schema |
-v, --verbose | off | Verbose output |
Examples:
# Compile from fraiseql.tomlfraiseql compile
# Compile a specific schema file to a custom output pathfraiseql compile schema.json -o compiled.json
# Validate without writing (useful in CI)fraiseql compile --check
# Validate against the database schemafraiseql compile --check --database "$DATABASE_URL"Expected output:
$ fraiseql compile✓ Schema validated (3 types, 2 inputs, 5 queries, 3 mutations)✓ SQL views verified against database✓ Compiled to build/schema.compiled.json (0.4s)fraiseql compile --watch monitors schema files and recompiles on change:
fraiseql.toml, db/schema/*.sqlfraiseql run --watch# Recompile on every schema changefraiseql compile --watch
# Serve with hot-reload (run handles watch internally)fraiseql run --watchfraiseql extractExtract a FraiseQL schema from annotated source files. Supports Python, TypeScript, Go, and other languages that use FraiseQL annotations.
fraiseql extract [OPTIONS] [INPUT]Arguments:
INPUT — Source file or directory to scan for annotationsOptions:
| Option | Description |
|---|---|
-o, --output <FILE> | Output schema file |
--format <FMT> | Output format |
Example:
# Extract schema from an annotated Python modulefraiseql extract src/models.py -o schema.jsonfraiseql explainShow the SQL execution plan that FraiseQL generates for a given GraphQL query. Useful for understanding and optimizing query behavior.
fraiseql explain [OPTIONS] <QUERY>Arguments:
QUERY — GraphQL query string or path to a .graphql fileOptions:
| Option | Description |
|---|---|
--schema <FILE> | Compiled schema (default: schema.compiled.json) |
--variables <JSON> | Query variables as a JSON string |
--format <FMT> | Output format: sql, plan, json |
Examples:
# Show the generated SQL for a simple queryfraiseql explain "{ users { id name } }"
# With variablesfraiseql explain "query(\$id: ID!) { user(id: \$id) { name } }" \ --variables '{"id": "123"}'
# Show the full execution plan from a query filefraiseql explain query.graphql --format planfraiseql costCalculate the complexity score for a GraphQL query. Use this in CI to enforce query cost limits before deployment.
fraiseql cost [OPTIONS] <QUERY>Arguments:
QUERY — GraphQL query string or path to a .graphql fileOptions:
| Option | Description |
|---|---|
--schema <FILE> | Compiled schema |
--max-cost <N> | Exit with a non-zero code if cost exceeds N |
--json | Machine-readable JSON output |
Examples:
# Check cost of a deeply nested queryfraiseql cost "{ users { posts { comments { id } } } }"
# Enforce a cost budget in CIfraiseql cost query.graphql --max-cost 100fraiseql analyzeAnalyze the schema for optimization opportunities across performance, security, federation, complexity, caching, and indexing categories.
fraiseql analyze [OPTIONS] [SCHEMA]Arguments:
SCHEMA — Compiled schema file (default: schema.compiled.json)Options:
| Option | Description |
|---|---|
--category <CAT> | Filter: performance, security, federation, complexity, caching, indexing |
--json | Machine-readable JSON output |
--verbose | Include detailed recommendations |
Examples:
# Full analysis with recommendationsfraiseql analyze schema.compiled.json
# Security-focused analysisfraiseql analyze --category security --verbosefraiseql dependency-graphVisualize the type dependency graph of a compiled schema. Output can be piped into Graphviz, Mermaid, or D2 for rendering.
fraiseql dependency-graph [OPTIONS] [SCHEMA]Arguments:
SCHEMA — Compiled schema file (default: schema.compiled.json)Options:
| Option | Description |
|---|---|
--format <FMT> | Output format: json, dot, mermaid, d2, console |
--output <FILE> | Write output to file instead of stdout |
--show-cycles | Highlight circular dependencies |
--unused | Include unused types in the graph |
Examples:
# Quick console viewfraiseql dependency-graph
# Graphviz DOT for rendering as a PNGfraiseql dependency-graph --format dot -o deps.dotdot -Tpng deps.dot -o deps.png
# Mermaid diagram (paste into Markdown)fraiseql dependency-graph --format mermaidfraiseql lintCheck the schema for design issues. Audits cover federation, cost, caching, authorization, and compilation correctness.
fraiseql lint [OPTIONS] [SCHEMA]Arguments:
SCHEMA — Schema file (default: fraiseql.toml or schema.compiled.json)Options:
| Option | Description |
|---|---|
--audit <AUDIT> | Audit category: federation, cost, cache, auth, compilation |
--fail-on <LEVEL> | Exit non-zero on: critical, warning, all |
--fix | Auto-fix issues where possible |
--json | Machine-readable JSON output |
Examples:
# Run all lint checksfraiseql lint
# Auth audit only, fail on any warningfraiseql lint --audit auth --fail-on warning
# Auto-fix and verify in CIfraiseql lint --fix --fail-on criticalfraiseql validateValidate the structural correctness of a schema file. Optionally connects to the database to cross-check table and column references.
fraiseql validate [OPTIONS] [SCHEMA]Arguments:
SCHEMA — Schema file to validateOptions:
| Option | Description |
|---|---|
--strict | Treat warnings as errors |
--database <URL> | Validate against a live database |
--json | Machine-readable JSON output |
Examples:
# Basic structural validationfraiseql validate schema.json
# Strict mode with database cross-checkfraiseql validate --strict --database "$DATABASE_URL"Expected output:
$ fraiseql validate✓ fraiseql.toml is valid✓ Database connection successful✓ Schema compiles without errors✓ All views exist in databasefraiseql generate-viewsGenerate SQL DDL statements for Arrow views derived from the compiled schema.
fraiseql generate-views [OPTIONS] [SCHEMA]Arguments:
SCHEMA — Compiled schema fileOptions:
| Option | Description |
|---|---|
-o, --output <FILE> | Output SQL file |
--refresh <STRATEGY> | Refresh strategy: trigger, scheduled |
--include <PATTERNS> | Include only views matching a pattern (e.g. va_*, tv_*) |
Examples:
# Generate all views to a SQL filefraiseql generate-views -o views.sql
# Arrow views only, with trigger-based refreshfraiseql generate-views --include "va_*" --refresh trigger -o arrow_views.sqlfraiseql introspectConnect to a PostgreSQL database and discover fact tables, then emit a schema stub.
fraiseql introspect [OPTIONS]Options:
| Option | Description |
|---|---|
--database <URL> | PostgreSQL connection string |
--output <FORMAT> | Output format: python, json |
--tables <PATTERN> | Table name pattern (default: tf_*) |
Examples:
# Discover all fact tables in the databasefraiseql introspect --database "$DATABASE_URL"
# Emit a Python schema stubfraiseql introspect --database "$DATABASE_URL" --output python > facts.pyfraiseql generateGenerate source files (client types, SDK stubs) from a compiled schema.
fraiseql generate [OPTIONS] [SCHEMA]Arguments:
SCHEMA — Compiled schema fileOptions:
| Option | Description |
|---|---|
--language <LANG> | Target language for generated code |
--output <DIR> | Output directory |
--types-only | Generate type definitions only, no resolvers |
fraiseql initScaffold a new FraiseQL project with a starter fraiseql.toml, schema stub, and migration directory.
fraiseql init [OPTIONS] [NAME]Arguments:
NAME — Project name (default: current directory name)Options:
| Option | Description |
|---|---|
--template <TPL> | Starter template |
--database <URL> | Pre-fill database URL in config |
--sdk <SDK> | Include SDK for a specific language |
Example:
fraiseql init my-api --database postgres://localhost/mydbfraiseql migrateManage database migrations via the bundled confiture migration tool.
fraiseql migrate <SUBCOMMAND> [OPTIONS]Subcommands:
| Subcommand | Description |
|---|---|
up | Apply pending migrations |
down | Roll back the last migration |
status | Show applied and pending migrations |
create <NAME> | Create a new migration file |
Examples:
# Apply all pending migrationsfraiseql migrate up
# Check migration statusfraiseql migrate status
# Create a new migrationfraiseql migrate create add_user_tablefraiseql sbomGenerate a Software Bill of Materials for the schema, listing all types, fields, and their data lineage.
fraiseql sbom [OPTIONS] [SCHEMA]Arguments:
SCHEMA — Compiled schema filefraiseql validate-documentsValidate a trusted documents manifest — checks that the file is well-formed JSON and that every key is a valid SHA-256 hex string matching its query body hash.
fraiseql validate-documents <MANIFEST>Arguments:
MANIFEST — Path to the trusted documents manifest JSON fileExamples:
# Validate the manifest before deployingfraiseql validate-documents trusted-documents.json
# Use in CI to catch manifest errors earlyfraiseql validate-documents ./manifests/trusted-documents.json && echo "Manifest OK"Exit codes:
0 — Manifest is valid1 — Manifest has structural errors or hash mismatches2 — File not found or not valid JSONSee Trusted Documents for the manifest format.
All commands support the following options:
| Option | Description |
|---|---|
-h, --help | Show help for the command |
-V, --version | Print the fraiseql version |
| Code | Meaning |
|---|---|
0 | Success |
1 | Validation or compilation error |
2 | Configuration error |
3 | Database connection error |
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string (overrides [database] url) |
FRAISEQL_REQUIRE_REDIS=1 | Refuse to start if PKCE state or rate limiting is using in-memory storage. Recommended for Kubernetes and other multi-replica deployments — catches misconfiguration at startup rather than at request time. |
FRAISEQL_MCP_STDIO=1 | Start the MCP (Model Context Protocol) server in stdio transport mode instead of HTTP. Used for Claude Desktop and other local MCP clients. Requires the server to be compiled with --features mcp. |
Most commands read fraiseql.toml when no explicit input is provided. A minimal configuration:
[project]name = "my-api"version = "1.0.0"
[database]url = "${DATABASE_URL}"
[server]host = "0.0.0.0"port = 8080Pass the path explicitly to any command that accepts [INPUT] or [SCHEMA] if your config file is not named fraiseql.toml.
| Task | Command |
|---|---|
| Start development server | fraiseql run --watch |
| Compile for production | fraiseql compile --check |
| Validate schema | fraiseql validate --strict |
| Check query cost | fraiseql cost query.graphql --max-cost 100 |
| Analyze performance | fraiseql analyze --category performance |
| Generate client types | fraiseql generate --language typescript |
| Run migrations | fraiseql migrate up |
# Typical CI pipelinefraiseql validate # Validate configurationfraiseql compile --check # Compile and validate schemafraiseql lint --fail-on warning # Run all auditsfraiseql test # Run tests (if configured)fraiseql migrate up # Apply migrationsfraiseql run # Start serverCheck CLI is installed:
fraiseql --versionExpected output:
fraiseql 2.0.0Validate a configuration file:
fraiseql validateExpected output:
✓ fraiseql.toml is valid✓ Database connection successful✓ Schema compiles without errorsCompile a schema:
fraiseql compile --checkExpected output:
✓ Schema validated (3 types, 2 inputs, 5 queries, 3 mutations)✓ SQL views verified against database✓ Compilation successfulTest explain command:
fraiseql explain "{ __typename }" --format sqlExpected output:
-- Generated SQL for querySELECT 'Query' as typename;Start the server:
fraiseql run &
# Test the health endpointcurl http://localhost:8080/healthExpected response:
{"status": "ok"}Run a lint check:
fraiseql lint --fail-on warningExpected output:
✓ Federation audit passed✓ Cost audit passed✓ Cache audit passed✓ Auth audit passed✓ Compilation audit passed$ fraiseql-bash: fraiseql: command not foundSolutions:
export PATH="$HOME/.cargo/bin:$PATH"cargo install fraiseql-cli~/.cargo/bin/fraiseql$ fraiseql compileError: Schema compilation failedCheck:
--database)$ fraiseql runError: Cannot connect to databaseSolutions:
DATABASE_URL is set correctlypg_isready -d $DATABASE_URLpsql $DATABASE_URL -c "SELECT 1"$ fraiseql runError: Address already in use (os error 48)Solutions:
fraiseql run --port 8081lsof -i :8080TOML Configuration
Configuration Reference — Full configuration reference
Deployment
Production Deployment — Production deployment guide