Skip to main content

Configuration Reference

This page provides a complete reference for all configuration options available in your tether.yaml file. The configuration file controls how Tether analyzes your Supabase schema and generates Flutter code.

Basic Structure​

database:
# Database connection settings

generation:
# Code generation settings

Database Configuration​

The database section configures how Tether connects to your Supabase database for schema introspection.

database:
host: TETHER_SUPABASE_HOST # Environment variable reference
port: TETHER_PORT_NAME # Database port (usually 5432)
database: TETHER_DB_NAME # Database name (usually 'postgres')
username: TETHER_DB_USERNAME # Database username
password: TETHER_DB_PASSWORD # Database password
ssl: TETHER_SSL # Use SSL connection (true/false)

Database Options​

OptionTypeDefaultDescription
hostStringRequiredSupabase database host URL
portInteger5432Database port number
databaseStringpostgresDatabase name
usernameStringRequiredDatabase username
passwordStringRequiredDatabase password
sslBooleantrueWhether to use SSL connection

Environment Variable Usage: Configuration values starting with uppercase letters (like TETHER_SUPABASE_HOST) are treated as environment variable references. Create a .env file with these values:

TETHER_SUPABASE_HOST=your_supabase_host
TETHER_PORT_NAME=5432
TETHER_DB_NAME=postgres
TETHER_DB_USERNAME=postgres
TETHER_DB_PASSWORD=your_password
TETHER_SSL=true

Generation Configuration​

The generation section controls all aspects of code generation.

Global Generation Settings​

generation:
output_directory: lib/database # Where to generate files
generate_for_all_tables: true # Generate for all tables

# Table filtering
exclude_tables: # Tables to skip
- '_realtime.*'
- 'auth.*'
- 'net.*'
- 'pgsodium.*'
- 'realtime.*'
- 'storage.*'
- 'supabase_functions.*'
- 'vault.*'

include_tables: [] # Only generate for these tables
exclude_references: [] # Skip these foreign key relationships

# Database settings
databaseName: 'app_db.sqlite' # Local SQLite database name

# Naming conventions
sanitization_endings: # Remove these suffixes from field names
- _id
- _fk
- _uuid

Global Options​

OptionTypeDefaultDescription
output_directoryStringlib/databaseRoot directory for generated files
generate_for_all_tablesBooleantrueWhether to generate code for all discovered tables
exclude_tablesList<String>[]Table patterns to exclude (supports regex)
include_tablesList<String>[]Only generate for these tables (overrides exclude)
exclude_referencesList<String>[]Foreign key relationships to ignore
databaseNameStringapp_db.sqliteName of the local SQLite database file
sanitization_endingsList<String>[]Suffixes to remove from field names when generating Dart properties

Models Configuration​

Controls generation of Dart model classes from your database tables.

generation:
models:
enabled: true # Enable model generation
filename: models.g.dart # Output filename
prefix: '' # Prefix for model class names
suffix: Model # Suffix for model class names
use_null_safety: true # Use Dart null safety

Model Options​

OptionTypeDefaultDescription
enabledBooleantrueWhether to generate model classes
filenameStringmodels.g.dartName of the generated models file
prefixString''Prefix added to all model class names
suffixStringModelSuffix added to all model class names
use_null_safetyBooleantrueWhether generated models use null safety

Example: With suffix: Model, a books table becomes BookModel class.

Client Managers Configuration​

Controls generation of high-level data access managers.

generation:
client_managers:
enabled: true # Enable manager generation
use_riverpod: true # Generate Riverpod providers
suffix: Manager # Suffix for manager class names

Client Manager Options​

OptionTypeDefaultDescription
enabledBooleantrueWhether to generate client managers
use_riverpodBooleanfalseWhether to generate Riverpod providers
suffixStringManagerSuffix added to manager class names

Supabase Select Builders Configuration​

Controls generation of type-safe query builders.

generation:
supabase_select_builders:
enabled: true # Enable select builder generation
filename: 'supabase_select_builders.g.dart' # Output filename
generated_schema_dart_file_name: 'supabase_schema.g.dart' # Schema file
suffix: SelectBuilder # Suffix for builder class names

Select Builder Options​

OptionTypeDefaultDescription
enabledBooleantrueWhether to generate select builders
filenameStringsupabase_select_builders.g.dartName of builders file
generated_schema_dart_file_nameStringsupabase_schema.g.dartName of schema definitions file
suffixStringSelectBuilderSuffix for builder class names

SQLite Migrations Configuration​

Controls generation of SQLite migration files.

generation:
sqlite_migrations:
enabled: true # Enable migration generation
output_subdir: 'sqlite_migrations' # Subdirectory for migration files

Migration Options​

OptionTypeDefaultDescription
enabledBooleantrueWhether to generate SQLite migrations
output_subdirStringsqlite_migrationsSubdirectory within output_directory for migrations

Providers Configuration​

Controls generation of Riverpod providers.

generation:
providers:
enabled: true # Enable provider generation
output_subdir: 'providers' # Subdirectory for provider files

Provider Options​

OptionTypeDefaultDescription
enabledBooleanfalseWhether to generate Riverpod providers
output_subdirStringprovidersSubdirectory for provider files

Authentication Configuration​

Controls generation of authentication management code.

generation:
authentication:
enabled: true # Enable auth manager generation
profile_table: 'profiles' # Table containing user profiles

Authentication Options​

OptionTypeDefaultDescription
enabledBooleanfalseWhether to generate authentication manager
profile_tableStringprofilesName of the table storing user profile data

Requirements:

  • The profile table must have an id column that references auth.users(id)
  • Enable Row Level Security (RLS) on the profile table
  • Set up appropriate RLS policies for user access

Background Services Configuration​

Controls generation of background job processing system.

generation:
background_services:
enabled: true # Enable background service generation

Background Service Options​

OptionTypeDefaultDescription
enabledBooleanfalseWhether to generate background job system

Additional Requirements: Add flutter_background_service to your pubspec.yaml when enabled.

User Preferences Configuration​

Controls generation of user preferences management system.

generation:
user_preferences:
enabled: true # Enable preferences manager generation

User Preferences Options​

OptionTypeDefaultDescription
enabledBooleanfalseWhether to generate user preferences manager

Schema Registry Configuration​

Controls generation of schema metadata files.

generation:
schema_registry_file_name: 'schema_registry.g.dart' # Schema registry filename

Schema Registry Options​

OptionTypeDefaultDescription
schema_registry_file_nameStringschema_registry.g.dartName of the schema registry file

Complete Example​

Here's a complete tether.yaml configuration with all options:

database:
host: TETHER_SUPABASE_HOST
port: TETHER_PORT_NAME
database: TETHER_DB_NAME
username: TETHER_DB_USERNAME
password: TETHER_DB_PASSWORD
ssl: TETHER_SSL

generation:
# Global settings
output_directory: lib/database
exclude_tables:
- '_realtime.*'
- 'auth.*'
- 'net.*'
- 'pgsodium.*'
- 'realtime.*'
- 'storage.*'
- 'supabase_functions.*'
- 'vault.*'
include_tables: []
exclude_references: []
generate_for_all_tables: true
databaseName: 'app_db.sqlite'

# Models
models:
enabled: true
filename: models.g.dart
prefix: ''
suffix: Model
use_null_safety: true

# Query builders
supabase_select_builders:
enabled: true
filename: 'supabase_select_builders.g.dart'
generated_schema_dart_file_name: 'supabase_schema.g.dart'
suffix: SelectBuilder

# Schema registry
schema_registry_file_name: 'schema_registry.g.dart'

# Migrations
sqlite_migrations:
enabled: true
output_subdir: 'sqlite_migrations'

# Managers
client_managers:
enabled: true
use_riverpod: true

# Providers
providers:
enabled: true
output_subdir: 'providers'

# Features
authentication:
enabled: true
profile_table: 'profiles'

background_services:
enabled: true

user_preferences:
enabled: true

# Naming
sanitization_endings:
- _id
- _fk
- _uuid

Best Practices​

Table Filtering​

Use exclude_tables for system tables you don't need:

exclude_tables:
- '_realtime.*' # Supabase internal tables
- 'auth.*' # Authentication system tables
- 'storage.*' # Storage system tables
- 'temp_*' # Temporary tables

Use include_tables when you only want specific tables:

include_tables:
- 'public.users'
- 'public.posts'
- 'public.comments'

Naming Conventions​

Use sanitization_endings to clean up field names:

sanitization_endings:
- _id # user_id becomes user
- _fk # author_fk becomes author
- _uuid # session_uuid becomes session

This creates cleaner Dart property names while maintaining database relationships.

Environment Variables​

Always use environment variables for sensitive data:

# ✅ Good - uses environment variables
database:
host: TETHER_SUPABASE_HOST
password: TETHER_DB_PASSWORD

# ❌ Bad - hardcoded values
database:
host: "abc123.supabase.co"
password: "my-secret-password"

Feature Flags​

Enable only the features you need:

# Minimal setup
generation:
models:
enabled: true
client_managers:
enabled: true

# Full-featured setup
generation:
models:
enabled: true
client_managers:
enabled: true
use_riverpod: true
authentication:
enabled: true
background_services:
enabled: true
user_preferences:
enabled: true

Validation​

Tether validates your configuration and will show helpful error messages for:

  • Missing required database connection parameters
  • Invalid table name patterns
  • Conflicting include/exclude table settings
  • Missing dependencies for enabled features

Run dart run flutter_tether --config tether.yaml to validate your configuration and generate code.