Skip to content

Configuration

There is no config file. Options are passed to bootstrap(), engine() or createApp(), and a few have environment fallbacks.

AppOptions

Accepted by createApp() and engine(), and inherited by bootstrap().

OptionTypeDefaultMeaning
rootDirstringprocess.cwd()Project root
sourceDirstringauto-detectedOverrides the src/ vs project-root detection
envfalse | string[]the .env cascade.env files to load. false disables loading; an array names files explicitly. See environment variables
logLevelLogLeveldebug in dev, info otherwiseConsole log threshold
bodyLimitnumberMaximum request body size, in bytes
sessionSecretstringCLOVE_SECRET envKey used to sign the session cookie
sessionTtlnumber24 hoursSession idle lifetime, in milliseconds
exposeErrorsbooleandev onlyInclude error messages and stacks in 500 responses
moduleCachebooleantrueCache evaluated modules. clove dev sets it false so reloads re-read files
mcpPathstring/mcpPath the MCP endpoint is served from
mcpServerInfo{ name, version }package identityName and version reported to MCP clients

BootstrapOptions

Everything in AppOptions, plus:

OptionTypeDefaultMeaning
portnumberPORT env, else 3000Port to listen on. 0 picks a free one
hoststringHOST env, else localhostInterface to bind
handleSignalsbooleantrueRegister SIGINT/SIGTERM handlers for graceful shutdown
ts
import { bootstrap } from "clovejs"

await bootstrap({
  port: 8080,
  host: "0.0.0.0",
  logLevel: "info",
  sessionTtl: 60 * 60 * 1000,
})

Environment variables

VariableUsed for
PORTDefault port for bootstrap()
HOSTDefault bind address for bootstrap()
CLOVE_SECRETSession cookie signing key
NODE_ENVSelects dev vs production defaults for logLevel and exposeErrors, and which .env.[mode] file is read

Explicit options always win over the environment.

These can come from a .env file, which Clove loads on startup. Values already present in the real environment are never overwritten by a file.

Log levels

LogLevel is one of:

"debug" | "info" | "warn" | "error" | "silent"

"silent" suppresses everything, which is what clove routes and most test setups use.

To replace the logger entirely rather than tune its level, define services/logger.ts; it takes over ctx.logger and the framework's own messages.

Source directory detection

Clove looks for src/ and falls back to the project root. Set sourceDir only when your layout is unusual:

ts
await bootstrap({ sourceDir: "./app" })

Session configuration

Sessions activate on their own as soon as any di/ file declares lifetime: "session". The only knobs are sessionSecret and sessionTtl above, plus the store — which is a service file, not an option.

Released under the MIT License.