Skip to main content
Version: Next

Configuration reference

Every configuration option Serverpod's core library reads. Options come from three sources: environment variables, the config/<run-mode>.yaml files, and the ServerpodConfig Dart object. Environment variables override the YAML files, and the Dart object overrides both. For how to choose between them, see Configuration.

Run options

Set the run mode, server role, and boot behavior. Declare each per run mode in the matching config/<mode>.yaml, or as an environment variable.

Environment variableCommand line optionConfig file optionDefaultDescription
SERVERPOD_RUN_MODE--modeN/AdevelopmentConfigures the mode of the server instance. Valid options are development, staging, production and test.
SERVERPOD_SERVER_ID--server-idserverIddefaultConfigures the id of the server instance.
SERVERPOD_SERVER_ROLE--rolerolemonolithConfigures the role of the server instance. Valid options are monolith, serverless and maintenance.
SERVERPOD_LOGGING_MODE--loggingloggingnormalConfigures the logging level. Valid options are normal, and verbose.
SERVERPOD_APPLY_MIGRATIONS--apply-migrationsapplyMigrationsfalseConfigures if migrations should be applied when the server starts.
SERVERPOD_APPLY_REPAIR_MIGRATION--apply-repair-migrationapplyRepairMigrationfalseConfigures if repair migrations should be applied when the server starts.

Server and services

Ports, hosts, and connection settings for the API, Insights, and web servers, the database, Redis, session logs, and future calls.

Environment variableConfig fileDefaultDescription
SERVERPOD_API_SERVER_PORTapiServer.port8080The port number for the API server
SERVERPOD_API_SERVER_PUBLIC_HOSTapiServer.publicHostlocalhostThe public host address of the API server
SERVERPOD_API_SERVER_PUBLIC_PORTapiServer.publicPort8080The public port number for the API server
SERVERPOD_API_SERVER_PUBLIC_SCHEMEapiServer.publicSchemehttpThe public scheme (http/https) for the API server
SERVERPOD_INSIGHTS_SERVER_PORTinsightsServer.port-The port number for the Insights server
SERVERPOD_INSIGHTS_SERVER_PUBLIC_HOSTinsightsServer.publicHost-The public host address of the Insights server
SERVERPOD_INSIGHTS_SERVER_PUBLIC_PORTinsightsServer.publicPort-The public port number for the Insights server
SERVERPOD_INSIGHTS_SERVER_PUBLIC_SCHEMEinsightsServer.publicScheme-The public scheme (http/https) for the Insights server
SERVERPOD_WEB_SERVER_PORTwebServer.port-The port number for the Web server
SERVERPOD_WEB_SERVER_PUBLIC_HOSTwebServer.publicHost-The public host address of the Web server
SERVERPOD_WEB_SERVER_PUBLIC_PORTwebServer.publicPort-The public port number for the Web server
SERVERPOD_WEB_SERVER_PUBLIC_SCHEMEwebServer.publicScheme-The public scheme (http/https) for the Web server
SERVERPOD_DATABASE_HOSTdatabase.host-The host address of the database
SERVERPOD_DATABASE_PORTdatabase.port-The port number for the database connection
SERVERPOD_DATABASE_NAMEdatabase.name-The name of the database
SERVERPOD_DATABASE_USERdatabase.user-The user name for database authentication
SERVERPOD_DATABASE_SEARCH_PATHSdatabase.searchPaths-The search paths used for all database connections
SERVERPOD_DATABASE_REQUIRE_SSLdatabase.requireSslfalseIndicates if SSL is required for the database
SERVERPOD_DATABASE_IS_UNIX_SOCKETdatabase.isUnixSocketfalseSpecifies if the database connection is a Unix socket
SERVERPOD_DATABASE_MAX_CONNECTION_COUNTdatabase.maxConnectionCount10The maximum number of connections in the database pool. Set to 0 or a negative value for unlimited connections.
SERVERPOD_DATABASE_FILE_PATHdatabase.filePath-The SQLite database file path. Set this instead of host/port/name/user when using SQLite.
SERVERPOD_DATABASE_DIALECTdatabase.dialectpostgresThe database dialect. Valid options are postgres and sqlite.
SERVERPOD_DATABASE_DATA_PATHdatabase.dataPath-Directory for the embedded PostgreSQL cluster. When set, the server boots a managed Postgres before connecting. PostgreSQL only; ignored for SQLite.
SERVERPOD_REDIS_HOSTredis.host-The host address of the Redis server
SERVERPOD_REDIS_PORTredis.port-The port number for the Redis server
SERVERPOD_REDIS_USERredis.user-The user name for Redis authentication
SERVERPOD_REDIS_ENABLEDredis.enabledfalseIndicates if Redis is enabled
SERVERPOD_REDIS_REQUIRE_SSLredis.requireSslfalseIndicates if SSL is required for the Redis connection
SERVERPOD_MAX_REQUEST_SIZEmaxRequestSize524288The maximum size of requests allowed in bytes
SERVERPOD_VALIDATE_HEADERSvalidateHeaderstrueValidate HTTP headers using the typed API. Set to false to accept headers without the required formatting, for example an unwrapped token in the Authorization header.
SERVERPOD_SESSION_PERSISTENT_LOG_ENABLEDsessionLogs.persistentEnabled-Enables or disables logging session data to the database. Defaults to true if a database is configured, otherwise false.
SERVERPOD_SESSION_LOG_CLEANUP_INTERVALsessionLogs.cleanupInterval24hHow often to run the log cleanup job. Duration string (e.g. 24h, 2d). Set to null to disable automated purging.
SERVERPOD_SESSION_LOG_RETENTION_PERIODsessionLogs.retentionPeriod90dHow long to keep session log entries. Duration string (e.g. 30d, 60d). Set to null to disable time-based cleanup.
SERVERPOD_SESSION_LOG_RETENTION_COUNTsessionLogs.retentionCount100000Maximum number of session log entries to keep. Set to null to disable count-based cleanup.
SERVERPOD_SESSION_CONSOLE_LOG_ENABLEDsessionLogs.consoleEnabled-Enables or disables logging session data to the console. Defaults to true if no database is configured, otherwise false.
SERVERPOD_SESSION_CONSOLE_LOG_FORMATsessionLogs.consoleLogFormatjsonThe format for console logging of session data. Valid options are text and json. Defaults to text for run mode development, otherwise json.
SERVERPOD_FUTURE_CALL_EXECUTION_ENABLEDfutureCallExecutionEnabledtrueEnables or disables the execution of future calls.
SERVERPOD_FUTURE_CALL_CONCURRENCY_LIMITfutureCall.concurrencyLimit1The maximum number of concurrent future calls allowed. If the value is negative or null, no limit is applied.
SERVERPOD_FUTURE_CALL_SCAN_INTERVALfutureCall.scanInterval5000The interval in milliseconds for scanning future calls
SERVERPOD_FUTURE_CALL_CHECK_BROKEN_CALLSfutureCall.checkBrokenCalls-Enables or disables the automatic check for broken future calls on startup. By default, the server performs an automatic check if there are less than 1000 calls in the database.
SERVERPOD_FUTURE_CALL_DELETE_BROKEN_CALLSfutureCall.deleteBrokenCallsfalseEnables or disables the deletion of broken future calls when running the check on startup.
SERVERPOD_WEBSOCKET_PING_INTERVALwebsocketPingInterval30The interval in seconds between WebSocket ping messages sent to keep streaming connections alive. Must be a positive integer.

Code generation

Options for config/generator.yaml, which configures serverpod generate.

OptionTypeDefaultDescription
typestringserverThe package type. Valid options are server, module, or internal.
nicknamestring-For modules only. Defines how the module is referenced in code.
client_package_pathstring../[name]_clientPath to the client package relative to the server.
server_test_tools_pathstringtest/integration/test_toolsPath where test tools are generated. Remove this to disable test tools generation.
shared_packageslist-Paths to shared packages containing models usable by both server and client.
modulesmap-Module dependencies with optional nicknames.
extraClasseslist-List of custom serializable classes to include in code generation.
serialize_as_jsonb_by_defaultboolfalseWhen true, all serializable fields default to jsonb storage instead of json.
featuresmap{database: true}Feature flags. Currently only database is supported.
experimental_featuresmap-Experimental features. Available keys: all (no experimental feature currently available).
  • Configuration: how the three configuration sources work, run modes, secrets, and package types.
  • Running your server: the run mode and files the server loads on start.