Skip to content

Configuration

AYB uses a layered configuration system: defaults → ayb.toml → environment variables → CLI flags.

Config file

Create ayb.toml in the working directory:

toml
[server]
host = "0.0.0.0"
port = 8090
cors_allowed_origins = ["*"]
body_limit = "1MB"
shutdown_timeout = 10

[database]
url = "postgresql://user:pass@localhost:5432/mydb?sslmode=disable"
max_conns = 25
min_conns = 2
health_check_interval = 30
migrations_dir = "./migrations"
# Embedded PostgreSQL (used when url is empty):
# embedded_port = 15432
# embedded_data_dir = ""

[admin]
enabled = true
path = "/admin"
# password = "your-admin-password"

[auth]
enabled = false
# jwt_secret = ""           # Required when enabled, min 32 chars
token_duration = 900         # 15 minutes
refresh_token_duration = 604800  # 7 days
# oauth_redirect_url = "http://localhost:5173/oauth-callback"

# [auth.oauth.google]
# enabled = true
# client_id = ""
# client_secret = ""

# [auth.oauth.github]
# enabled = true
# client_id = ""
# client_secret = ""

[email]
backend = "log"              # "log", "smtp", or "webhook"
# from = "noreply@example.com"
from_name = "AllYourBase"

# [email.smtp]
# host = "smtp.resend.com"
# port = 465
# username = ""
# password = ""
# auth_method = "PLAIN"
# tls = true

# [email.webhook]
# url = "https://your-app.com/email-hook"
# secret = "hmac-signing-secret"
# timeout = 10

[storage]
enabled = false
backend = "local"            # "local" or "s3"
local_path = "./ayb_storage"
max_file_size = "10MB"

# S3-compatible (AWS S3, Cloudflare R2, MinIO, DigitalOcean Spaces):
# s3_endpoint = "s3.amazonaws.com"
# s3_bucket = "my-ayb-bucket"
# s3_region = "us-east-1"
# s3_access_key = ""
# s3_secret_key = ""
# s3_use_ssl = true

[logging]
level = "info"               # debug, info, warn, error
format = "json"              # json or text

Environment variables

Every config value can be overridden with AYB_ prefixed environment variables:

VariableConfig field
AYB_SERVER_HOSTserver.host
AYB_SERVER_PORTserver.port
AYB_DATABASE_URLdatabase.url
AYB_DATABASE_EMBEDDED_PORTdatabase.embedded_port
AYB_DATABASE_EMBEDDED_DATA_DIRdatabase.embedded_data_dir
AYB_DATABASE_MIGRATIONS_DIRdatabase.migrations_dir
AYB_ADMIN_PASSWORDadmin.password
AYB_AUTH_ENABLEDauth.enabled
AYB_AUTH_JWT_SECRETauth.jwt_secret
AYB_AUTH_REFRESH_TOKEN_DURATIONauth.refresh_token_duration
AYB_AUTH_OAUTH_REDIRECT_URLauth.oauth_redirect_url
AYB_AUTH_OAUTH_GOOGLE_CLIENT_IDauth.oauth.google.client_id
AYB_AUTH_OAUTH_GOOGLE_CLIENT_SECRETauth.oauth.google.client_secret
AYB_AUTH_OAUTH_GOOGLE_ENABLEDauth.oauth.google.enabled
AYB_AUTH_OAUTH_GITHUB_CLIENT_IDauth.oauth.github.client_id
AYB_AUTH_OAUTH_GITHUB_CLIENT_SECRETauth.oauth.github.client_secret
AYB_AUTH_OAUTH_GITHUB_ENABLEDauth.oauth.github.enabled
AYB_EMAIL_BACKENDemail.backend
AYB_EMAIL_FROMemail.from
AYB_EMAIL_FROM_NAMEemail.from_name
AYB_EMAIL_SMTP_HOSTemail.smtp.host
AYB_EMAIL_SMTP_PORTemail.smtp.port
AYB_EMAIL_SMTP_USERNAMEemail.smtp.username
AYB_EMAIL_SMTP_PASSWORDemail.smtp.password
AYB_EMAIL_SMTP_AUTH_METHODemail.smtp.auth_method
AYB_EMAIL_SMTP_TLSemail.smtp.tls
AYB_EMAIL_WEBHOOK_URLemail.webhook.url
AYB_EMAIL_WEBHOOK_SECRETemail.webhook.secret
AYB_EMAIL_WEBHOOK_TIMEOUTemail.webhook.timeout
AYB_STORAGE_ENABLEDstorage.enabled
AYB_STORAGE_BACKENDstorage.backend
AYB_STORAGE_LOCAL_PATHstorage.local_path
AYB_STORAGE_MAX_FILE_SIZEstorage.max_file_size
AYB_STORAGE_S3_ENDPOINTstorage.s3_endpoint
AYB_STORAGE_S3_BUCKETstorage.s3_bucket
AYB_STORAGE_S3_REGIONstorage.s3_region
AYB_STORAGE_S3_ACCESS_KEYstorage.s3_access_key
AYB_STORAGE_S3_SECRET_KEYstorage.s3_secret_key
AYB_STORAGE_S3_USE_SSLstorage.s3_use_ssl
AYB_CORS_ORIGINSserver.cors_allowed_origins (comma-separated)
AYB_LOG_LEVELlogging.level

CLI flags

bash
ayb start --database-url URL --port 3000 --host 127.0.0.1

CLI flags override everything else.

CLI commands

ayb start      [--database-url] [--port] [--host]   Start the server
ayb stop                                             Stop the server
ayb status                                           Show server status
ayb config     [--config path]                       Print resolved config
ayb migrate    [up|down|status]                      Run database migrations
ayb admin      [create-password]                     Admin utilities
ayb version                                          Print version info

Generate a default config

bash
ayb config > ayb.toml

This prints the full default configuration with comments.

Released under the MIT License.